New Initiative… Gaming!!

So, time for a little personal story…

I have always loved coding up games, ever since I was very little. And as it usually happens with hobbies, I started coding many, and finished none (not even close).

But I did try my luck many times. I started when I was 10, trying to write a “conversational” graphical adventure (think Leisure Suit Larry, where you type your commands). Yeah, that was going to happn.
Those were the days of BASICA, where you had to number your lines manually, you didn’t have subroutines (but you did have GOSUB/RETURN, which is basically a GOTO with a stack), and you couldn’t have decent variable names. Actually, for that last one, you could, I just didn’t know that, so all my variables were called a, b, c, until I ran out of them, and started being aa, ab. I had a little manual dictionary to know what they were, obviously. (Hey! I was 10!)
I did get it to actually draw backgrounds and the character on screen which, judging by what I remember about that code, was actually quite feat…

Around 15 I learned what an “engine” was, what sprites were, a few algorithms, and how things were actually done, to some extent. These were my Visual Basic days, when the standard response I got from people was “you want to make games? Learn C++”. And of course, my stubborn reaction was “oh yeah? I’ll show ya!”. I not only managed to make fast enough game engines with Visual Basic (thanks mainly to DirectX, I’ll admit, but hey! It worked!), but also most or all of the things you “can’t do with VB”, like calling the weird APIs in Windows that send you back a pointer to a Unicode string that is actually more pointers to lists of pointers. All printer APIs were like that. Oh, the joy. I also managed to do multi-threading in VB, which was “the big no-no”. So screw that, you can make games, and anything, in VB, thank you very much.

During that phase, I had the beginning of the screen part of a graphical adventure game engine (think Monkey Island), including drawing sprites, with proper z-ordering, and pathfinding when you clicked around. Not a lot, because I quickly got bored, and seriously addicted to Rollercoaster Tycoon, and I moved to my more fun idea, Isometric Game Engines!
So, I made this cute little thing (with graphics stolen from RCT) where it’d actually draw a map on screen, and you could walk around, bump against walls, and I even added some cool “lighting” effects that made it look pretty. Of course, as usual, this is where I got stuck, having part of an engine (what I thought was the hard part) but no real game ideas and that’s where it stayed. But it was a great learning experience, Isometric is complicated in a great number of ways, performance was tough to crack, and I learned a huge number of things.

And then games basically became 3D, completely different arena, where you can’t really make your own engine (and be competitive at least), and where the whole thing revolves around “better graphics” and it just completely lost its appeal to me. That, and work, and stuff, I completely forgot about making games.

And now, something magical has happened. We have handheld devices that are so unbelievable powerful, that they are exactly as fast as computers were 15 years ago. At the same time, the browsers are now competing over who can execute Javascript the fastest, so we have this fantastic language, my favorite by far, that is as fast as VB5 was 15 years ago, but it runs in your pocket!
What this means, in practical terms, is that the most cutting edge games went from looking like this:



to looking like this:



And I can definitely code that!
In my favorite language of all time!
And it’ll run everywhere!

Whoa!
So I’m a bit late, I admit, I should’ve started on this 2 years ago, or 1, maybe… When did <canvas> show up, again?
But I want back!

And of course, Angry Birds is not just the coding; anyone can code that, there is waaaay more to making a game than the parts that I can do myself, so I’ll need partners (or employers), with ideas, and graphical abilities, and all that. And the sad truth is that, just because I liked doing this 15 years ago doesn’t really mean I’m any good nowadays, so I need to learn, and I also need some kind of experience to be believable. And since, as usual, I’m not big on the “game ideas” side, I decided to make a re-take on an old project…



This is what my Iso Engine looked like, more or less… Most of the code has been lost to a tragic hard disk incident a long time ago, but I still have some of the sprites sheets I made back then, a lot of my notes, the maps I had made (in a binary format that is now unreadable, so I’ll have to rely on old screenshots and memory), so I have something to start from.



But there are also a number of other good reasons:

First of all, I already know what I have to do in many ways. I remember or have notes with the math, I know where I want to get to, and I remember this project vividly, so that’s a useful head start.

Also, and mainly, Isometric is one of the hardest of the things you can do in 2D.

  • Drawing to the screen needs way more math than any other visualization type I can think of: which tiles to draw, where to place them, how you move the character, how to know what it is that the mouse pointer is hovering on, etc.
  • It also requires considerably more drawing to the screen. About twice as many blits to fill up the screen compared to a top-view or side-view game. And the drawing is more complicated for the layers to work right (closer tiles occlude farther ones).
  • For the same reason, maps need to be bigger, take up more memory and more CPU to process them.

Basically, if I can make this work, and work fast, I know I can take on any other 2D game and it’ll be simpler than this (at least from the graphical performance point of view).

Since this is mostly a confidence building exercise, both in myself and in others that I may want to work with, and a learning proces of how to make things fast in Javascript/HTML5, it felt like the best choice.

Plus, it’s the most fun I’ve done, by far! Mostly because it’s complicated.

So, i’m porting my old game engine, and this first series of posts will be a bit “stream of consciousness”, as I try to think of the different things that’ll be different between VB5/DirectX and HTML5.
I’m thinking on what kind of memory and performance problems I’ll have, and doing a bit of experimentation.
After that, I guess it’ll just be a report on the porting, and then i’ll start adding new stuff to the little engine, I guess!

I’m intentionally not reading any resources directly related to doing an isometric game engine for HTML5. I did a lot of reading on iso games back then, and now I’m trying to discover things when it comes to implementing games in HTML5 in particular. This is very un-professional, and would be a really bad idea if I were actually trying to ship a game quickly. But I’m doing this to learn, so I plan on reading up on these things *after* i’m done with my port and my own ideas. I also want to see how far I can go by myself.

Oh, and a note on browsers…
For desktop, I’m going to be testing on Chrome and Firefox latest. If I were on a Mac, I’d test Safari too. Not sure how reliable it would be to extrapolate Safari/Windows results to Safari/Mac, so I won’t. I’d also test IE if they supported canvas (for non-canvas stuff, I will, and when IE 10 comes out, I also will). I won’t test Opera or the other browsers because I consider them, sadly, irrelevant. I know this makes me a bad human being, but that’s life.
For mobile, I’ll test iPhone 4 (with iOS 5), and Android 2.3.3, on an HTC Desire S. I’d love to test on more, but these are the ones I have at home.

In the meantime, hope my experiments and posts help someone!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">