aaryte

cave2d.com/game2 - good enough!

Recommended Posts

I think I'm done with this minimal 2D maze shooter, with one enemy, two weapons (shotgun and laser), six levels, and infinitely destructible terrain.

the game: cave2d.com/game2 :mellow:

level editor: cave2d.com/game2/edit

On touch screens, the buttons are on the bottom left corner: switch weapons, and fire. Everywhere else is treated like a big trackball. Tested on iOS Safari and Android Chrome.

On desktop, Z switches weapons and X fires. Arrow keys move, and you can hold "shift" for an extra speed boost. Mostly tested on Chrome, some Safari and Firefox. No idea about IE though.

I wrote this because I wanted to complete a basic, full-screen multi-level arcade game, for mobile (and desktop), using WebGL, Web Audio, and my physics engine (with continuous collision detection!) and editor code. Gameplay-wise I didn't want to do anything fancy because I thought this would be a starter project, one of many. It's a lot like http://plexode.com/fracas/, the first JS game I ever wrote, yeeeears ago. Not including the physics engine, the editor code, or a lot of other fundamentals, this took exactly 100 days.

Screenshot_20160609-103725.png

Screenshot_20160609-184540.png

Screenshot_20160609-201418.png

Screenshot_20160609-225750.png

Share this post


Link to post
Share on other sites

Wow, that's a pretty cool game, really liked playing it. It also reminds me a bit of this really old dos game called Snipes :D

Couple of things though:

  1. The shoot and explosion animations are all really nice, but in contrast there is no exit animation. It could use a little fireworks or something like that when you reach the level exit.
  2. You can dig through the terrain by shooting, but this is a little slow. I think it should be a bit faster, so make the shots damage to the walls a little more.
  3. It could use a third weapon choice, maybe a slightly fast and slightly scatter shot, like in between the current two. If you want to go fancy you could add a mines/bombs weapon.
  4. There's no shield when you respawn, which is a little frustrating when you spawn in the middle of a group of enemies.

Share this post


Link to post
Share on other sites

Thanks for playing, and taking the time to comment! I really appreciate the feedback.

1 hour ago, BdR said:

Wow, that's a pretty cool game, really liked playing it. It also reminds me a bit of this really old dos game called Snipes :D

Couple of things though:

  1. The shoot and explosion animations are all really nice, but in contrast there is no exit animation. It could use a little fireworks or something like that when you reach the level exit.
  2. You can dig through the terrain by shooting, but this is a little slow. I think it should be a bit faster, so make the shots damage to the walls a little more.
  3. It could use a third weapon choice, maybe a slightly fast and slightly scatter shot, like in between the current two. If you want to go fancy you could add a mines/bombs weapon.
  4. There's no shield when you respawn, which is a little frustrating when you spawn in the middle of a group of enemies.

Whoa, I saw Snipes ONCE in my life, and I never knew what it was called, but it made a big impression, so thanks for telling me the name.

I agree I need a cool-looking level-exit effect. The abrupt transition is not great. Maybe a better entrance, too, or just re-use the respawn gold-ring effect.

As I developed, I tried to adjust the digging to not be so fast that players would be tempted to dig safely through the whole level to the exit. But I'll turn it up a bit - if you want to dig, then you should be able to dig, if it's fun! Originally I was going to have a bunch of powerups, and one would be super-digging, but I'm saving that for another game, or maybe a whole game about digging.

Nuclear Throne and Gridrunner (for iOS) made me want to have tons of weapons and powerups, but for game2 I think I'll stop where it is. Originally I have a fast triple-shot weapon which is like what you described, but I decided I wanted just two extremes, sort of like slash and lunge in a fighting game. Plus having two makes weapon switching simple and predictable. For a future game I'm thinking weapons will be objects you actual pick up (see my previous game, http://plexode.com/vorp, for an early non-combat example of tractor-beam controls) and I'd like to have a bunch of weapons littering the levels.

You're right, there does need to be a respawn-shield or blinking-unhittable mode. My young playtester has pointed this out to me many times, and I just haven't done it yet. Maybe tonight. I also like iOS Gridrunner which lets you ram enemies to kill them, briefly, when you respawn, to clean out an area; I think I'll try that.

Again, thanks for playing, and I'm really glad you liked it!

Share this post


Link to post
Share on other sites

Hm I can see how too fast digging can influence gameplay too much.

Btw is there a way to import a black&white bitmap image as a level? Could make some much cooler levels using paint.net or photoshop.

Share this post


Link to post
Share on other sites
8 hours ago, BdR said:

Hm I can see how too fast digging can influence gameplay too much.

Btw is there a way to import a black&white bitmap image as a level? Could make some much cooler levels using paint.net or photoshop.

Maybe I can just tweak places in the map that require digging to require less of it. Like, that final dig is meant to be a little suspenseful, and i wanted to give enemies time to harass you, but maybe it's too much digging there?

Heh, I can't even import my own exports yet. My JSON format is an overbuilt full-blown game-save format, with velocities and unexpired timeouts and everything, and walls are a hashmap where each key is an encoded cell X&Y, and each value is an array of bitfields.

Ok yeah, I could define an image-based format, black for empty space (I store the spaces, not the walls, because the walls extend infinitely) maybe with green for enemies, pink for player, and... some other color for the exit. It won't capture things I plan to add to later games, like the direction something is facing, but it's a start.

But first, you'd need a way to share levels you made. Today I export from my editor to json text, then paste that into a static file I serve from cave2d.com. I don't want to host other people's data. I guess could have a screen to let you provide a custom URL for your adventure json file. Should be safe, thanks to JSON.parse(). So that's the first step.

Share this post


Link to post
Share on other sites
7 hours ago, WombatTurkey said:

ery fun game, would love a tutorial on the how you did the shaders as projectiles! Haha, this game is fun as heck. Great work

Thanks, you made my day! :D

The projectiles all use the same static model, a cylinder, but the trick is to use two matrix transforms, one for one end of the cylinder, and one for the other end. So if you move the ends far apart, you get a pill. Then if you scale one of the end down, you get a teardrop.

Some of the explosions use the same two-matrix technique, but I use a tube - cylinder with open ends. So whenever you see a ring-shape (explosions mostly), that's a tube with a slightly different scaling factor for each end.

Each vertex has an attribute that tells the shader which matrix to use, "aVertexGroup", 

The shader is really short: https://github.com/aaronwhyte/cave2d/blob/master/public_html/game2/vertex-shader.txt

A "ModelStamp" is my class that knows the buffer values to prepare the shader to render a model: https://github.com/aaronwhyte/cave2d/blob/master/public_html/js/webgl/modelstamp.js

Then there's RigidModel.createTube() and RigidModel.createCylinder(). RigidModel is my class for building models in JS before sending them to GL to create a ModelStamp. This only happens when the game first loads - I don't make any new models after that. There are a bunch of other static methods for generating primitive shapes, and one RigidModel can be added to another to make a complex model. https://github.com/aaronwhyte/cave2d/blob/master/public_html/js/webgl/rigidmodel.js

and THEN there's the part about handling projectile bounces, but my hands are killing me right now (too much late-night coding!) so I'll just point to the code. It's all the "drawTrail" stuff in BulletSpirit: https://github.com/aaronwhyte/cave2d/blob/master/public_html/game2/spirits/bulletspirit.js with the aid of a poorly documented Trail datastructure: https://github.com/aaronwhyte/cave2d/blob/master/public_html/js/trail.js

 

Share this post


Link to post
Share on other sites
9 hours ago, aaryte said:

Thanks, you made my day! :D

The projectiles all use the same static model, a cylinder, but the trick is to use two matrix transforms, one for one end of the cylinder, and one for the other end. So if you move the ends far apart, you get a pill. Then if you scale one of the end down, you get a teardrop.

Some of the explosions use the same two-matrix technique, but I use a tube - cylinder with open ends. So whenever you see a ring-shape (explosions mostly), that's a tube with a slightly different scaling factor for each end.

Each vertex has an attribute that tells the shader which matrix to use, "aVertexGroup", 

The shader is really short: https://github.com/aaronwhyte/cave2d/blob/master/public_html/game2/vertex-shader.txt

A "ModelStamp" is my class that knows the buffer values to prepare the shader to render a model: https://github.com/aaronwhyte/cave2d/blob/master/public_html/js/webgl/modelstamp.js

Then there's RigidModel.createTube() and RigidModel.createCylinder(). RigidModel is my class for building models in JS before sending them to GL to create a ModelStamp. This only happens when the game first loads - I don't make any new models after that. There are a bunch of other static methods for generating primitive shapes, and one RigidModel can be added to another to make a complex model. https://github.com/aaronwhyte/cave2d/blob/master/public_html/js/webgl/rigidmodel.js

and THEN there's the part about handling projectile bounces, but my hands are killing me right now (too much late-night coding!) so I'll just point to the code. It's all the "drawTrail" stuff in BulletSpirit: https://github.com/aaronwhyte/cave2d/blob/master/public_html/game2/spirits/bulletspirit.js with the aid of a poorly documented Trail datastructure: https://github.com/aaronwhyte/cave2d/blob/master/public_html/js/trail.js

 

This is awesome. Yeah, I believe you could actually get something really big going with this game if you had some type of Minecraft type block building thing going on. The way we can manipulate blocks and whatnot. Think of a "2d Minecraft" if you will. 

I was snooping the chrome console and saw that vertex-shader too. I just, will never understand shaders for some reason. Never, ever. I got the Arctangent stuff down with projectiles (if that's the correct word, horrible at Math)... but that's it. I am using a basic fireball sprite sheet, but would love to actually use shaders  with projectiles. I could create really cool stuff, like Magic Missiles, beams, lazers, etc.

Thanks for that, I'll work on learning/doing shaders probably this week, so this will help a bit!

Share this post


Link to post
Share on other sites
3 hours ago, Anton Ianiuk said:

I like it!

Any plans to make it multiplayer?

Thank you!

Originally I wanted to make it support two players on the same device, and I was going to have more kinds of enemies, and power-ups.

But once game 2 started to feel like a whole game, I decided to call it complete, so I could focus on some new stuff. I'm saving major new features, like multiplayer, for game 3 or later. The only features I plan to add to game 2 are a respawn shield, and a better transition between levels.

Share this post


Link to post
Share on other sites
9 hours ago, aaryte said:

Thank you!

Originally I wanted to make it support two players on the same device, and I was going to have more kinds of enemies, and power-ups.

But once game 2 started to feel like a whole game, I decided to call it complete, so I could focus on some new stuff. I'm saving major new features, like multiplayer, for game 3 or later. The only features I plan to add to game 2 are a respawn shield, and a better transition between levels.

Trust me! @aaryte, please do the ability to place blocks wherever. This would be like 2d flat minecraft style thing, it would be sooo awesome and fun to build stuff. But then again, it would only be fun with other people I guess.

Share this post


Link to post
Share on other sites
9 hours ago, WombatTurkey said:

Trust me! @aaryte, please do the ability to place blocks wherever. This would be like 2d flat minecraft style thing, it would be sooo awesome and fun to build stuff. But then again, it would only be fun with other people I guess.

Have you tried the editor, http://cave2d.com/game2/edit ?

I think my next game will be more sandbox-y, not another shooter.

Share this post


Link to post
Share on other sites
On 6/10/2016 at 4:13 PM, BdR said:

Wow, that's a pretty cool game, really liked playing it. It also reminds me a bit of this really old dos game called Snipes :D

Couple of things though:

  1. The shoot and explosion animations are all really nice, but in contrast there is no exit animation. It could use a little fireworks or something like that when you reach the level exit.
  2. You can dig through the terrain by shooting, but this is a little slow. I think it should be a bit faster, so make the shots damage to the walls a little more.
  3. It could use a third weapon choice, maybe a slightly fast and slightly scatter shot, like in between the current two. If you want to go fancy you could add a mines/bombs weapon.
  4. There's no shield when you respawn, which is a little frustrating when you spawn in the middle of a group of enemies.

@BdR, I added a respawn shield, and made the enemies tend to wander away from your spawn point while you're dead. That makes it a lot easier to get back to safety after dying while surrounded.

Share this post


Link to post
Share on other sites
On 6/10/2016 at 4:13 PM, BdR said:

Wow, that's a pretty cool game, really liked playing it. It also reminds me a bit of this really old dos game called Snipes :D

Couple of things though:

  1. The shoot and explosion animations are all really nice, but in contrast there is no exit animation. It could use a little fireworks or something like that when you reach the level exit.
  2. You can dig through the terrain by shooting, but this is a little slow. I think it should be a bit faster, so make the shots damage to the walls a little more.
  3. It could use a third weapon choice, maybe a slightly fast and slightly scatter shot, like in between the current two. If you want to go fancy you could add a mines/bombs weapon.
  4. There's no shield when you respawn, which is a little frustrating when you spawn in the middle of a group of enemies.

OK, the level-exit effects are in (request #1), and I'm out!

Share this post


Link to post
Share on other sites

nice game. I liked how the ai worked, but I ended up just hiding away so I could kill them when they come to me. maybe a time limit would make sense, to force the player to engage actively? I was glad about the infinite lives, I probably would not have completed the game otherwise.

Share this post


Link to post
Share on other sites

Thanks! Yeah I agree it's easiest to play defensively, which isn't as much fun as dodging and weaving. I guess most shooters have enemy bullets which force you to evade, or fast tough enemies or explosives or something else to force you to abandon your position.

I think the more open levels, like the last two, are the most fun, because there are not many choke-points where you can fight off the whole horde. They can come from different directions, so you have to choose where to fire, and when to retreat.

It would be neat to make the enemies blow up surrounding walls, but also leave a new blob of wall right where they were. Then every death would result in a fork in the road, and the level would constantly shift. Oh dang I like that idea a lot. I really under-used the terrain-altering abilities of my engine in this game. Hm.

Game2 is meant to be the 2nd in a series of small games, like a playable dev journal. I hear that the key to making something awesome is to make lots of things, not one giant thing. And it's really refreshing to call something "done". So instead of continuing to improve it, I'll try to learn from comments and criticism and ideas, and reuse most of the code in the next game(s), with new design ideas.

Share this post


Link to post
Share on other sites

I couldn't resist adding craters in the terrain when the enemies explode, with a bit of debris in the center. I made the enemies a bit weaker too, since now you're firing into dirt more often, instead of firing into a static choke-point. So now enemies are much easier to dispatch with a single close shotgun blast, which is fun. I'm having a hard time abandoning game2! :mellow:

Share this post


Link to post
Share on other sites
13 hours ago, redapple1 said:

Very nice game made.I really appreciate the work done.

Thanks! It really was a ton of work, for such a simple game. I learned a lot, and wrote a pile of reusable code, so the next game should be easier.

Share this post


Link to post
Share on other sites

Really fun! I would love to find some new crazy weapons in there. This game would make all sorts of crazy exploding stuff so much fun.. DESTRUCTION!! 

Ah, and personally i would like another main char -the smiley looks stupid. But i hate Pacman's look too.. :P 

Share this post


Link to post
Share on other sites
6 hours ago, Tobiasz said:

Really fun! I would love to find some new crazy weapons in there. This game would make all sorts of crazy exploding stuff so much fun.. DESTRUCTION!! 

Ah, and personally i would like another main char -the smiley looks stupid. But i hate Pacman's look too.. :P 

Hah, thanks! Yeah, character design is something I definitely need to work on.

My next game probably won't be a shooter, but I'd like to do another combat one after that, with a lot more weapons and enemies. I'll call it "game4: game2 II: the wreckoning" or something.

Share this post


Link to post
Share on other sites
16 hours ago, arseniy said:

I would like to collab with you as artist.

What did you have in mind?

tbh, one of the joys of my personal programming projects is that I can work solo, with no meetings or integrations or anything, unlike work-for-pay.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.