Sunday, July 22, 2012

Enemies, Vines and Lava! Oh My!

3 comments
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.

Tuesday, July 3, 2012

Stay Awhile and Listen

0 comments
Wow. Reddit rocks. I posted a link to my blog on the gamedev subreddit of reddit.com and went from 50 to nearly 3000 page hits in one day.  Not only that, they haven't just been reading my posts, they've been commenting too and have spurred some really interesting discussion over on the reddit thread.  I've also been getting around 40 views a day ever since,  and I haven't even written anything new! Well, here is something new, though it's probably not what you were expecting.

Since I have readers now, or at the very least people who stumble into to this blog on their way to greener internet pastures, I figured I'd let you guys and girls know how I'm planning on updating this blog. What I mean rather, is when I'm going to update this blog. I find blogs typically update on a weekly basis, but I don't think that's for me. I wan't this blog to be interesting and stimulating, and let's face it, interesting thoughts, or gamedev milestones worth talking about, don't happen like clockwork every week. Sometimes updates will come more frequently, and other times less frequently. What I'm saying is, I don't want to write something unless it's something of substance, something I believe is of some kind of value to people. I like making and talking about video games, that's not unique, but hopefully my perspective and thoughts can be, and that is what this blog is about, not a weekly view into my gamedev life (unless that's what you want it to be, in which case, let me know).

So, it's worth mentioning that this post is breaking that golden rule, but I have a good reason for that, I promise. I just got a lot of people to look at my blog in one burst, and looking at the page visit statistics Blogger is giving me, people are either coming back to see if there is something new, or people really like reading the seventh page of r/gamedev. This post is just to let the people from that first scenario know that this blog isn't dead and I will be posting on a frequent, yet irregular, basis. The easiest thing to do is probably to follow me by e-mail using the widget to the right of this post. Don't worry, I don't get to see what your e-mail is so I couldn't send you creepy unwanted love letters even if I wanted to.

I was initially going to post about what I got done this week, but I have now (clearly) decided against it for all of the reasons I mentioned above. Well, that's a lie, I will show you the most incredibly awesome thing you have ever seen. Seriously.


Okay, maybe it's not that awesome. Maybe it looks a lot like that red Angry Bird (does it have a name?). But the important thing is that I drew it and it doesn't look like something that came from the bowels of hell designed to torment people who actually know how to draw. I think it looks decent, and the little jumping animation looks nice in action. Even though it's just a pretty placeholder for now, I like it.

Well, that's it for this post, hopefully I cleared up some things for people wondering why there was nothing new to read. Thanks for reading, and keep coming back it's going to be awesome.