Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411490 Posts in 69371 Topics- by 58428 Members - Latest Member: shelton786

April 24, 2024, 09:05:04 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsShipteroids!
Pages: [1] 2
Print
Author Topic: Shipteroids!  (Read 1678 times)
bayersglassey
Level 0
***



View Profile
« on: July 17, 2021, 10:48:06 PM »

List of posts:


Original post:

Hallo! I started a little game a couple of months ago (May 16 according to first git commit) and the basic gameplay seems pretty much done, so I'm looking for feedback.
The premise was to start with Asteroids-like gameplay, then add as many features as possible.
In particular, there are many different kinds of ship, with very different properties, weapons, and abilities.
There is also a light RPG sort of thing going on, where you explore a map of connected areas, collecting gold and buying upgrades and new types of ship.
So basically, the Asteroids-style gameplay of flying your ship around takes place on individual "areas", and by "warping" to the next area, you traverse the map (which is a directed graph - warping sends you along its edges).
Each area has certain kinds/amounts of ships, certain asteroid sizes/amounts, etc, so they're not all the same.

This is all in place now, but what's missing is a sense of purpose. So I think I need one final layer of gameplay over top of "flying around individual areas" and "traversing the map"; some kind of story, maybe.

At the moment, hitting Escape brings up a "Choose Ship" menu, which gets you a new ship with full health. So there's no way to lose. So feel free to explore. Smiley
(If you need a "purpose" to play in the absence of a story, consider trying to find all the stores, and buy & try out all the different kinds of ship...)

Play it in your browser here: https://bayersglassey.itch.io/shipteroids
Source code is here: https://github.com/bayersglassey/shipteroids

Title screen


Title screen getting shot up :O


Asteroids everywhere


The map


Heated space battle


A little swarm of ships works together to push an asteroid


Danger danger


Little firefight, showing the HUD and a fuel pickup floating by

« Last Edit: September 05, 2021, 01:08:38 PM by bayersglassey » Logged
JobLeonard
Level 10
*****



View Profile
« Reply #1 on: July 21, 2021, 04:24:09 AM »

This looks neat! I'll give it a go later today (at work now)
Logged
bayersglassey
Level 0
***



View Profile
« Reply #2 on: July 24, 2021, 06:23:39 PM »

Had a go at recording little clips of gameplay. Using byzanz-record for now (commandline thing on Ubuntu).

Wrecking the title screen
(Playing as the most basic ship type, "Fighter", based on the ships in Asteroids.)


Meeting your first hostile ship


Meeting a Crab ship
(Playing as an Assault ship, slow but hits hard.)


I've been trying to add "AI" to the computer-controlled ships, and it's working fairly well.
Previously, they would literally just hit random buttons.
Now, they hit random buttons... until attacked. Then whoever hit them becomes their "target", and a purple line is currently rendered to show their target (as you can see in the GIFs above).

If a CPU player's energy (ship "health") is above a certain amount, they try to point themselves at their target and shoot it, while staying at a certain distance. This distance is different for each type of ship -- for instance, the basic "fighter" ship (the triangle) knows to stay just within range of his lasers & rockets, whereas the Crab ship tries to get as close as possible so it can chomp at you.

If a CPU player's energy drops below a certain amount, they try to run away from their target.
Right now, that's so effective for some of the faster ships that it's just annoying to deal with. :D The current logic is they try to point themselves 90 degrees to the left or right of their target, and then hold down the thrust button. So you can't just follow behind them if you're faster, you need to keep turning, and somehow shoot ahead of them, which is basically impossible since they end up moving away. Hmmm.

Also, some ships don't move quite the same as other ships, so they need to override the AI logic entirely.
For instance, some "ships" are more like little astronauts, and they can land on asteroids and run around the circumference of their asteroid by pressing left and right. Pressing "up" causes them to jump off the asteroid and go back to operating more like a regular ship (left/right is turn, up/down is thrust/reverse). Like this guy:

Troop "ship" (astronaut) running around asteroids fighting Torch ships
(Torch ships have flamethrowers and lay mines. Troops have flamethrowers and, once standing on an asteroid, can fire missiles.)

« Last Edit: July 24, 2021, 07:30:01 PM by bayersglassey » Logged
bayersglassey
Level 0
***



View Profile
« Reply #3 on: July 24, 2021, 07:15:09 PM »

A couple more gameplay clips, showing various kinds of ship:

Playing as a Swarm of little ships, amid big asteroids


...in this clip, we're playing as a "swarm" of little ships. You control the slightly bigger one in the middle, and the others mimick your keypresses (as well as being connected to you via springs, rendered as a light blue line).
Every ship has two different "attacks", or rather 2 buttons which do different things. For many ships that means shooting two different kinds of weapon, but for the swarm, holding button #2 gathers your swarm-mates towards you and causes them to mimick your keypresses. So if you let go of button #2, they kind of fan out around you, moving around and firing at will (but mostly in the same direction). But while you hold button #2, you can control the swarm as a unit.

Also seen in the above clip are the Mole ship (more on that below) and the Engineer "ship".
The Engineer is another astronaut-type, as shown in the previous post. But the astronaut in the previous post was a "Troop", with flamethrowers and rockets, whereas Engineer has... ropes. Hitting button #2 fires out one end of a rope, and hitting it again fires out the other end. The ends of the rope are connected by a spring, and they stick to whatever they touch. So you can tie asteroids together, or tie ships to asteroids, or tie ships to ships. Ropes slowly fade and disappear after 8 seconds or so.
I'm not entirely sure whether ropes are "balanced" at the moment, they can make things pretty crazy. But in a fun way.


Playing as a Flagship, fighting Mole ships


The Flagship has two Turret ships, which are connected to it via springs (rendered as blue lines) -- it's fairly similar to the "swarm" (see above).
If a Turret is destroyed, the Flagship regenerates it after a few seconds. (This is true of the swarm also.)
The Flagship itself has fairly weak weapons -- it shoots 1 laser and 1 missile at a time.
Turrets on the other hand lay down a pretty crazy amount of fire.
In this clip, we're fighting some Mole ships, whose second "attack" is to enter asteroids and control them.
So you need to destroy the asteroid to get at the Mole inside. Meanwhile it can shoot you. In this clip a Mole takes down both Turrets before we get out of its way.

I'm hoping to get the CPU player AI to the point where "astronaut" types are able to fly towards asteroids controlled by friendly Mole ships, so you get these balls of destruction flying around, until the asteroid breaks apart and all the ships which were riding on it scramble for a new one...


Playing as a Bore ship in the "mines" area


The Bore ship is like a slightly weaker version of the basic Fighter ship, but the rockets it fires destroy asteroids immediately and produce gold.
(Gold, by the way, is the game's currency, and is usually produced whenever a ship is destroyed.)
The area in this clip is part of the "mines" part of the map, which contains Miners and Bores.
Miners are the third "astronaut" type (see Troops and Engineers above); after landing on an asteroid, they can "dig" on it once every few seconds, which produces some gold and reduces the asteroid's size.
So instead of trying to shoot down ships to get gold, you can visit the mines and collect all the gold being popped out by Miners... or you can unlock the Bore/Miner ships at a shop, and go off mining on your own.
A Miner can be seen in the above clip, mining an asteroid which is being piloted by a Mole.
The Mole could shoot the Miner off, but watching the clip I've just noticed that mining an asteroid apparently doesn't count as shooting it, and therefore CPU Mole ships don't target Miners digging apart their asteroids. Should probably fix that...


Edit: trying to record GIFs of specific things happening is pretty fun. Here's some small clips of standing on an asteroid, pissing off a passing swarm, then running to the other side of the asteroid...
« Last Edit: July 24, 2021, 07:59:35 PM by bayersglassey » Logged
bayersglassey
Level 0
***



View Profile
« Reply #4 on: July 24, 2021, 08:52:56 PM »

Another quick post, it's about time this "devlog" actually had some information about the game on it...

Warping around the map


The game is composed of "areas" connected together by a map.
You travel between areas by "warping": pressing "W" at any time causes your ship's thrust to fire extra-fast for a few seconds (during which time, hitting anything destroys it and damages you), after which you warp to the next area.
Which area is the "next" is determined by which areas your current one is connected to on the map.
If there are multiple connected areas, you're shown the map and can select your next area.
(Connections are generally one-way, so you usually can't warp back the way you came. The idea being to prevent "grinding" in an easy area.)
Warping costs 10 "fuel", and shooting asteroids open randomly drops fuel and energy pickups.
So while it's fairly easy to warp around without bothering to fight anyone, there are limitations: if you run out of fuel, or if you're low on energy and in an area with lots of things you might hit while warping, you're forced to slow down and farm for fuel and/or blow some stuff up to clear a "runway".
(Also, in case you find yourself out of fuel in an area with no asteroids, your fuel slowly recharges when below the 10 required for warping. But it takes about 10 seconds, so it's much nicer to stock up on fuel when you can.)


A shop


Certain areas have shops on them. When you first warp to such an area, your ship doesn't immediately appear; instead, you see the shop menu.
(The shop menu's interface is, uh, pretty lame. But it works for now...)
You can buy the following types of thing:
  • Trinkets (do nothing)
  • Max energy upgrade
  • Max fuel upgrade
  • Ship speed upgrade
  • Primary/secondary weapon/ability upgrade
  • Unlock new ship types

The weapon/ability upgrades are sometimes interesting.
For regular weapons, they of course just increase damage/range.
However, as mentioned in an earlier post, Swarm ship's button #2 isn't a weapon, it just causes swarm-mates to gather in and mimick your keypresses. So for Swarm, the "secondary weapon/ability upgrade" increases its max number of swarm-mates by one.
And mole's button #2 causes it to enter and control asteroids. So its secondary upgrade causes the asteroid it's in to recover health more quickly. (Hmm, maybe it should increase asteroid movement speed too?..)
Logged
JobLeonard
Level 10
*****



View Profile
« Reply #5 on: July 25, 2021, 07:37:07 AM »

I played it for a little bit. I was a bit surprised with how long it took for an asteroid to break up when I started shooting it - especially compared to the momentum it gained
Logged
diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #6 on: July 25, 2021, 09:26:21 AM »

I played for a while and it was quite fun! The weirdly high speeds felt weird at first but I really like the chaotic nature of the play field.

Not sure now relevant it is to know this but I had problems using arrow keys and space bar at the same time. Not all keyboard is the same, some allow for different combination of simultaneous key presses. But something to keep in mind as you develop, maybe.

I would also play around with inertia. I have a feeling it could be fun to speed in one direction and sort of 'drift' past targets while shooting at them.

My last suggestion is have the items easier to pick up. It's a pace killer to have to stop near them, move forward, miss it, back up a bit, adjust orientation, move forward, oops missed it again. OR make it an upgrade! the classic item magnet.
Logged

bayersglassey
Level 0
***



View Profile
« Reply #7 on: July 25, 2021, 03:58:52 PM »

I was a bit surprised with how long it took for an asteroid to break up when I started shooting it - especially compared to the momentum it gained

Ah, that's fair. When there aren't many asteroids in an area, they do tend to get away from you. I've gotten used to just waiting for them to come back (since space wraps around) but it's a bit counter-intuitive.
I toned it down, should now be possible to hunt down asteroids with your lasers (although missiles still send them flying, of course).


I played for a while and it was quite fun! The weirdly high speeds felt weird at first but I really like the chaotic nature of the play field.

Thank you. Smiley A chaotic play field is definitely the goal here...


Not sure now relevant it is to know this but I had problems using arrow keys and space bar at the same time.

Ah, yeah that's good to know. This is perfect feedback -- I'll put some time into adding menus for setting up controls.
I think I'll need to add save/load functionality too, for "settings" as well as for game progress. Probably a good time to start adding all this.
(There is basic gamepad support too, by the way! Just plug in a gamepad and try hitting some buttons. Not customizable unfortunately. There's rumble support too.)


I would also play around with inertia. I have a feeling it could be fun to speed in one direction and sort of 'drift' past targets while shooting at them.

Hmm, I'll take a look at that. Things are frenetic enough that I figured people would like having a ship which was "easy to control", not "too floaty" -- so, low inertia. (Low inertia is often an item you have to buy in Asteroids remakes.)
But it's also true that combat right now can end up being two ships pointing at each other shooting for all they're worth, so I'll see if I can make things just a touch more slidy.


My last suggestion is have the items easier to pick up. It's a pace killer to have to stop near them, move forward, miss it, back up a bit, adjust orientation, move forward, oops missed it again. OR make it an upgrade! the classic item magnet.

AH! Item magnet is a great idea -- I didn't want to just make items "bigger", since other ships can pick them up too. But having the player be "special" in that way due to a shop item is the perfect solution. Thanks! Smiley
Logged
bayersglassey
Level 0
***



View Profile
« Reply #8 on: July 25, 2021, 04:28:10 PM »

Added a "pickup magnet", which causes energy/fuel/gold pickups to float towards you!
(Thanks to diegzumillo for the idea.)
You start with it at level 0, which does nothing.
You can buy upgrades for it at the store, which increase its level by 1.
Each level increases its "suction" and also the range at which it activates.

At the moment the max you can get is 2 levels (because there are only 2 stores from which you can purchase it, for +1 level each).

Here it is at level 2:



Also played with the physics a little bit.
Since the game is written in Javascript + HTML5, it's easy to use query parameters in the URL as "settings". So I added a bunch of those to allow tweaking the physics.
If that doesn't make any sense to you, here's a link to the game in which the physics seem to be in "slow motion":
Play the game in slow motion (and starting in an area with a bunch of other ships)
...that link also makes all ships unlocked (the "all_ships=1" part of the URL).
A full list of these "cheat codes" can be found by looking at the source code. Smiley (Look for "getFloatParam" and "getBoolParam".)

Here are some clips of "slow motion" gameplay (one playing as Swarm, one as Scout):


Anyway, the point of this was really to try out the game with increased ship "slidiness" to see if it made it easier to strafe. So with that in mind:
Play the game with increased ship "slidiness"
...in this case, inertia is kept for longer, but as a result ships can end up going way too fast and it's just hard to hit anything.
Play the game with increased ship "slidiness", but also dampened velocity
...in this case, velocity is dampened, so everything moves a bit slower. It's playable, but makes me miss the punchiness of the standard physics.

I think I'll leave things as they are, but for what it's worth, each ship has its own physics.
That includes forwards and reverse speed of course, but also subtler things like inertia.
For instance, the "Hunter" ship has a lot of inertia -- it's easy to "coast" and strafe, etc.
And the "Scout" ship has two "modes": by default it's very slow, turns quickly, and has almost no inertia.
However, holding button #2 causes it to retract its stubby "wings" and change its physics: it becomes much faster, turns more slowly, and also retains its inertia. (See the rightmost slomo clip above.)
« Last Edit: July 25, 2021, 07:47:08 PM by bayersglassey » Logged
JobLeonard
Level 10
*****



View Profile
« Reply #9 on: July 25, 2021, 11:04:30 PM »

On a meta-level, I love the open-source game with web-based interactive debugging approach! Grin
Logged
a-k-
Level 2
**


View Profile
« Reply #10 on: July 31, 2021, 08:48:38 AM »

On a meta-level, I love the open-source game with web-based interactive debugging approach! Grin
... all contained in one JS file, no dependencies, no build process - so refreshing!
Logged

bayersglassey
Level 0
***



View Profile
« Reply #11 on: August 17, 2021, 10:58:08 PM »

Reorganized some of the code to allow for:
  • hotseat multiplayer!..
  • customizing keyboard controls


Basic multiplayer:


There are a couple of oddities with it still, e.g. when one player completes a warp, the other player is also transported to a new area.
Not sure how that should work, maybe forcing both players to agree when to warp... but also considering allowing both players to explore the map separately. So one player could warp around to a different area, and the other could go elsewhere entirely, and later they could meet up. I think it actually ends up being the cleanest "UI" experience, in terms of e.g. warping and shops.

Since multiplayer is still "beta", the only way to try it is by adding "?players=2" to the URL. Here's a link.
Player 1 controls: arrow keys + space + shift + enter + W
Player 2 controls: SXZC (up/down/left/right), V + B + H + Y


Keyboard controls can be customized:



...gamepad controls are hardcoded for now, but that's next.
« Last Edit: August 18, 2021, 11:37:22 PM by bayersglassey » Logged
JobLeonard
Level 10
*****



View Profile
« Reply #12 on: August 18, 2021, 12:40:10 AM »

Cool! Now I just need to find someone to play hotseat with Wink
Logged
bayersglassey
Level 0
***



View Profile
« Reply #13 on: August 19, 2021, 12:01:47 AM »

Cool! Now I just need to find someone to play hotseat with Wink

I'm definitely going to have a poke at adding online multiplayer support at some point.
Websockets look pretty easy to use, but you need a server.
In this case, the game logic is entirely inside the client, so the cheap-n-easy way to make it all work is probably choose one player (one client) to be the "host", and write a very small server program which just knows which client is the "host".
Then the clients need to pass their keypresses to the server, server passes them along to "host" client, who sends back updates on the game state... which is the really hard part. I think it'll be laggy as heck for the non-"host" clients. But I'm interested to give it all a try...
Logged
JobLeonard
Level 10
*****



View Profile
« Reply #14 on: August 19, 2021, 02:45:51 AM »

WebRTC?

https://developer.mozilla.org/en-US/docs/Web/Guide/API/WebRTC/Peer-to-peer_communications_with_WebRTC
Logged
bayersglassey
Level 0
***



View Profile
« Reply #15 on: August 20, 2021, 01:08:22 PM »

I had looked at that once, but it seems to require you to use some kind of special server (STUN or TURN or something) for peer discovery.

But it does look like once you've got a connection, you can send arbitrary blobs of bytes over it: RTCDataChannel.send()

Hmmm.

I kind of assume that ultimately with WebRTC, TCP packets aren't being sent directly from one client to another, there's a middleman of some kind involved. And so, why not just use websockets, and implement the server as something tiny in Python or whatever, and thereby have control over it?

Dunno though, maybe I should learn more about WebRTC before dismissing it...
Logged
JobLeonard
Level 10
*****



View Profile
« Reply #16 on: August 21, 2021, 01:13:00 AM »

I guess in your case the amount of data involved is quite small, so that probably makes more solutions viable that otherwise would be dismissed. Good luck!
Logged
bayersglassey
Level 0
***



View Profile
« Reply #17 on: August 22, 2021, 12:32:08 AM »

More code reorganization results in players being able to warp independently of one another!

Independent warping


The mechanic is basically:
  • Each position on the map can have an area loaded, or not
  • When a player warps to a position, they join its area if it's already loaded, otherwise a new area is created
  • When all players in an area have warped out of it, it is destroyed

...where an "area" means "a place with a specific width & height which contains asteroids, ships, etc".
When an area is created, its width, height, asteroids, and ships are randomly determined, according to parameters of its map node. For instance, a given map node might specify that between 2 or 5 rocks can be generated, and between 1 and 2 yellow Fighter ships, and between 0 and 3 blue Scout ships, etc.

The way these multiplayer mechanics work, one player can keep an area "alive" (loaded into its map node) while the other player warps away and then comes back.
Whereas if there is no player keeping an area "alive", then by warping away and back to it, you cause it to be regenerated, which can be used to "farm" (e.g. for gold by regenerating & fighting the ships in that area).
However, the connections between map nodes are generally one-way, so you usually can't warp away and then back to the same node.


Well anyway. Here's the kind of wacky thing you can do in multiplayer:

Multiplayer: one player riding another's asteroid



...and unrelatedly, here's a new ship (the Cannon).
Instead of shooting a moving projectile, it shoots a "laser beam" made up of multiple static projectiles, which all appear simultaneously. It's kind of interesting; for instance, if an asteroid is in front of you, you can shoot "through" it (the first half of your projectiles appear on top of the asteroid and hit it, the other half appear beyond it and can hit other things).

Multiplayer: Swarm and Cannon



Edit: added basic menu options for adding/removing players, and basic menu options for choosing a gamepad. Tested this out a bit with a friend, nothing crashed, and we had some fun. Smiley So multiplayer is good enough to be "released"!
https://bayersglassey.itch.io/shipteroids
« Last Edit: August 22, 2021, 09:31:12 PM by bayersglassey » Logged
JobLeonard
Level 10
*****



View Profile
« Reply #18 on: August 22, 2021, 11:46:02 AM »

So basically... garbage collection for active areas? Wink
Logged
bayersglassey
Level 0
***



View Profile
« Reply #19 on: August 22, 2021, 09:33:19 PM »

So basically... garbage collection for active areas? Wink

Quite literally yes! :D
Logged
Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic