Sunday, July 22, 2012

Enemies, Vines and Lava! Oh My!

Whoa (apparently that's how it's spelt, I always thought it was woah) guys, I have a massive update for all of you. Here we go. First of all, why haven't there been any posts for a while? Well, that's easy, I've busy working on my game and writing game design stuff. Yup, thanks to my article on 2D cameras and how much you guys liked it, I've been asked to work with the fine folks over at the tutsplus website on their new website GamedevTuts+, which is launching in august. So from now on, you'll be able to find things I've written very much in the same vein as the other articles I've written on game design over at that website (which I'll link too as soon as it goes live). It's been a really awesome experience and it's been really interesting work so far (I mean I just started), so I'm hoping this gig keeps on going for a while. Also, the website looks like it's gonna be awesome.

Now about my game, I've made some pretty sweet progress, I've added enemies, lava and vines. Now the enemies I have were pictured in the last post, and they're pretty much just goombas, running back and forth because that's just how smart they are. The thing is, you can't kill them with your gun, in fact you can't kill anything with your gun, so you have to squish them with blocks to get them out of your way. Also, they kill you instantly if you touch them (right now).

There he is again

Next, the vines are pretty cool, they're essentially a foreground block, that only enemies and the player can pass through, as in they act like solid blocks for  any moving blocks. Their purpose is to act as a sort of safe haven for enemies where they can't be squished by falling blocks. The player can shoot the vines though, and after a couple of hits they break allowing the enemies to then be squished.

It's a little hard to see the enemy behind there,
 but they are very obvious in motion
There's also the lava, which instantly kills any player or enemy it touches and burns vines, rendering them charred, which makes them break with only one shot. Also, any downward-falling block that comes into contact with lava floats on it's surface for a few seconds before melting, the idea is that the player can create temporary bridges to cross the lava. Finally, and this is where I spent the vast majority of my time, the lava flows. It flows in a sort of sticky manner, getting jammed up on the ground and on other pieces of lava, but this was intentional. When it acted too liquidy it often blanketed an entire area and it was impossible for the player to pass. The lava flows using basic cellular automata, mostly because I didn't want to have to bother with the lava tiles having knowledge of anything that wasn't directly beside them. 

Here's the stagnant lava

And here's the flowing lava

The flow algorithm isn't really complicated, but it took a lot of time to iterate to get it to where I wanted it to be, because I really didn't want it to just act like water. In fact, it now acts more like you'd expect sand would in a game (and the algorithm is pretty similar to what you find in those falling sand style games). The biggest thing though, was getting the game to run without, as I still don't know how big levels are going to be, there is the possibility of there being lots and lots of flowing lava tiles in one level. I fixed this mostly by thinning down the comparative checks in the algorithm, but also by putting a system in place to check different bodies of lava and check how far they went off screen. If there was any lava tile that was not part of an active on-screen pool, they would be ignored during checks. I also slowed down the flow of lava and only let the lava check for collisions at specific intervals rather than every tick of the update loop. 

Obviously, any coders out there know that speed wouldn't have been a big problem if I had simply kept some sort of byte array to check whether tiles had lava, because "collision" in this case would have been very simple and extremely efficient. Unfortunately, with the way Flashpunk works, it was just easier for me to do things this way, keeping each lava tile as something Flashpunk call an "entity". It's not efficient at all, but it's what I chose to do and it works perfectly.

Another thing worth noting is that I completely re-coded the level editor, so it's now really easy to add new objects to the palette, all I need to do is write the class name of the new object in a string I have saved in the level editor class and it works perfectly. This definitely saved me a lot of time.

Finally, I'm sure you can all tell the graphics were significantly improved. It's still all placeholder stuff, but I was getting tired of looking at metroid tiles and I needed some sort of graphical cohesion to tie all the elements I was making together.

Unfortunately, here comes the bad news, I'm really not at all interested in this game. I initially started all of this because I had lots of ideas in my head but none of them reached whatever high design standard I was arbitrarily holding myself too. I decided then to start making a simple modular 2D engine in Flashpunk so that I wouldn't waste my time. Well, I sort of hooked on to an idea while making this, but the more I think about it, I'm just not at all excited by it. Technically, this isn't anything very interesting or difficult, and conceptually I see nothing special about what I've started making so far. As someone interested in design it's missing that "hook" or any kind of cohesive vision at all, and as a gamer the small amount of direction I have in my head just looks like it's going to make a boring final product. Basically the game looks lame. It took me a while to notice this because I've been very busy, as I'm moving to Montreal in a month (transferring to McGill) and it's been time consuming trying to find a place and get all my transfer credits approved by the various faculties.

Anyway, what I'm going to do now is start thinking again, what I've coded is absolutely in no way useless, in fact I could do pretty much anything 2D with a grid-based map while barely throwing out any code at all. Hopefully next time I post I'll have something cool for all of you to look forward too.

P.S: I'm going to try and post more frequently to avoid wall-o'-texts like this one.

1 comment:

  1. Cool! Really cool! Hope you do well with these ideas! (Also, first comment!) :)

    ReplyDelete