(Another) New Beginning

December 25, 2007 § Leave a comment

I’ve settled on a project now, that is slightly more fun than Asteroids (although that’s actually turned out to be a much more fun project than I originally anticipated!). Asteroids is on the “when-I’m-bored” pile now, and I might release the source to it a bit later. So, what’s this new project? Well, I had a lot of designers giving some great ideas forward, but something that caught my eye was a project called “Overload”, designed by Daniel. We’re essentially going to be working on a computer version of a standard table-top mini game, but it will have (hopefully) a fair bit more game-play when we’re complete.

One of the major reasons this grabbed me so much is because, somewhat ironically, I’ve never actually played a table top mini-game! However, me and Daniel played a pen & paper version over MSN – both printing out a grid and making counters, and communicating dice rolls over MSN.

As with usual tabletop games, you place your units (we have squads of units that move together) and then take turns moving units, or co-ordinating attacks. But we also have some nice twists in the game – weapons can blow up in your hands from excessive use, we have extra “phases” in each round – such as hacking computers, setting up artillery, calling in air strikes, which all sound cool to me! Stuff like this might be normal in tabletop games, but I like the idea of it, and it seems novel.

Now, on to some technical details. Daniel has said from the start that this should be a hexagonal-tile game and this sounds good to me. I’ve not done a hexagonal game before, so it will be a fresh challenge. I spent a bit of time doing some research on them – and more first naive implementation was, well… awful. But like they say: code one to throw away! So I found some great resources after a brief spell of Googling and turned up Amit’s Game Programming Information, a site I regarded well for A* information, but also happens to have a great lot of information on hexagon based games.

hex-fixed.png

A visualization of the co-ordinate system Overload uses.

That’s the co-ordinate system I’ve decided on. It seems a natural system, and works well with standard formulas such as tile-to-tile distance, with these co-ordinates. To store this in the world I’m using a 2D jagged array, rather than a multidimensional array due to the performance implications. I know, it’s premature optimization, but a jagged array is really no harder than a multidimensional array, so it seems worth it. As for the array mapping, here’s what the above map looks like in memory:

Overload map array representation

The same map, but now visualized as it is stored in arrays.

Quite simple really, and mapping between array co-ordinates and to hexagonal co-ordinates is relatively simple (although did cause some scribbling on paper 🙂

ToHex(x, y) = { -ceil(x / 2.0) - y, floor(x / 2) - y }
ToArray(x, y) = { y - x, floor( (x - y) / 2.0 ) }

Also, I think the array representation looks quite similar to actual in-game look, so I’m using bitmaps to represent the maps at the moment, with different coloured pixels representing different tile types. No point inventing a file format just yet 🙂 I have got this rendering as well, which I’m quite happy about, because at least this means something is working! The rendering is a 2D-in-3D system, currently with a Direct3D9 implementation, but I’ve abstracted it out to work with hopefully any renderer.

First screenshot of Overload!

Our first screenshot, woohoo!

Edit: 28/12/2007 – Fixed typo on the hexagon coordinates diagram, thanks Zao!

Advertisements

Tagged: ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

What’s this?

You are currently reading (Another) New Beginning at Cycles.

meta

%d bloggers like this: