Engine Status: Ready to rip.

Published March 18, 2010
Advertisement
The last week or so has been quite productive. I'm not sure what sorts of details to launch into though. For me this is the umpteenth time writing a 2D game engine for my stuff, so the last month or so of development has been little more than 'wax on, wax off'; a sort of unconscious progression of code that I've written many times before.

New since my last entry is font rendering, a particle engine, playing audio, and support for drawing the game in both portrait and landscape orientations.



(Listen, you're way better off not asking just who 'Ken' is.)

This was chiefly made by porting my old text rendering code from Skirmish Online. Since that doesn't explain much, let me be a mite more specific. AngelCode produced a Bitmap Font Generator that produces, given various input parameters, a bitmap containing the desired character set, alongside a text file with the metrics of the various characters in the bitmap. The bitmap is loaded in as a texture on the iPhone, and the text file is parsed for the locations/dimensions/etc of each character. When text is to be drawn, a 2D quad is drawn for each letter of the string, using the texture coordinates from the font bitmap that correspond with the character that should appear. If memory serves, I believe I followed this NeHe tutorial on the subject way way back in the day.



(Particles and proper display in portrait and landscape.)

Using the accelerometer, it's a simple matter to determine whether the device is being held in portrait or landscape. The only real 'trick', since the SDL port has no notion of drawing in 'portrait' or 'landscape' is to execute a 2D transformation -- a rotation about the origin followed by a translation -- on the projection matrix whenever you wish to make the game appear to be in a different viewing angle.

The particle engine isn't all that fancy either, despite never failing to produce visually stimulating results. Spawned 'batches' of particles are all stored in a single array to minimize the number of OpenGL ES calls, not to mention they all share the same GL state data (colour, size, texture). I'm using point sprites for the rendering itself, which is thankfully supported natively on the iPhone hardware. I have no idea if the older devices support it though, so it's somewhat likely that I will need to implement a fallback implementation eventually.

Audio is harder to capture screenshots of, so you'll have to trust me that it is in fact present. It's a mite hacked together. And by that, I mean I more or less nabbed the audio example that was included with SDL and wrapped it up in my engine somewhat cleanly. There are a few other feasible options out there such as Finch or fiddling with SDL_Mixer or even getting dirty with raw OpenAL, but I'm more or less fine with the limitation of using simple WAV files for my sound effect needs. I will need to get around to figuring out how to leverage the hardware audio playback when it comes to playing game music though. Thank goodness there is a vast abundance of examples available. [smile]


Anyhow, that's the scoop. All of the major items on my wish list for a 2D engine are now satisfied, and it's finally time to sit down and write, say, a game. [grin]
0 likes 5 comments

Comments

Knarkles
Sounds good! I'm still disappointed you're not going to make Skirmish for the iPhone though. [grin]
March 19, 2010 12:34 AM
BDePesa
I'm going through pretty much the exact same process at the moment.

I just purchased my MacBook Pro last Thursday and I've been getting up to speed with Objective-C as I haven't done any real programming in almost 2 years. After I feel comfortable with that I figure I'll throw down the $99 for the developer program.

It's nice to see someone that I've been following for a few years jump into the scene along with me! Hopefully it'll keep my motivation up.

Good luck!
March 22, 2010 10:32 PM
HopeDagger
Quote:Original post by BDePesa
I'm going through pretty much the exact same process at the moment.

I just purchased my MacBook Pro last Thursday and I've been getting up to speed with Objective-C as I haven't done any real programming in almost 2 years. After I feel comfortable with that I figure I'll throw down the $99 for the developer program.


Good for you. It's tough to get back in the swing of things after a dry spell, but I think you chose a really interesting area to cast your lot with. Have you done any embedded game development before?

Quote:It's nice to see someone that I've been following for a few years jump into the scene along with me! Hopefully it'll keep my motivation up.


As ever, I'd be honoured to be able to be a source of motivation for my game developing bretheren out there. [grin] Do you keep a development journal anywhere that I might peer at as well? It would be very interesting indeed to be able to follow your progress as well!

Quote:Good luck!


Thanks -- and you!
March 24, 2010 07:10 PM
HopeDagger
Quote:Sounds good! I'm still disappointed you're not going to make Skirmish for the iPhone though.


Thanks Jussi. As for Skirmish, well, I'm just plain not that masochistic. [grin]
March 24, 2010 07:17 PM
BDePesa
Quote:Original post by HopeDagger

Good for you. It's tough to get back in the swing of things after a dry spell, but I think you chose a really interesting area to cast your lot with. Have you done any embedded game development before?


I've done homebrew work on both the PSP and the GBA. Nothing spectacular, just a few small games.

Quote:As ever, I'd be honoured to be able to be a source of motivation for my game developing bretheren out there. [grin] Do you keep a development journal anywhere that I might peer at as well? It would be very interesting indeed to be able to follow your progress as well!


I'll have a journal here at some point in the near future when I have something worth posting. I'll be sure to let you know when it's up.

March 24, 2010 09:12 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement