OMG (to coin a popular acronym), there’s only a few days to go before the end of the Ludum Dare October Challenge! And as per usual I got insanely distracted by new things to add to Spacemines, one of which was Robot workers and the impeding Robot rebellion that would ensue should you have too many of them on your little asteroid.
I’d like to say that the key to figuring it out came from working it out on paper first! I’d usually open up a text file and start coding and hammering the sh*t out of the code until it worked, or at least gave the impression of working. I can’t tell you how nice it was to work it out on paper and then code it up, still took a while, but it was definitely worth doing in the long run, since I was more aware of where to start!Well, I stumbled upon an interesting little article. I took the main idea of moving through an array (representing the world tilemap) in ever increasing circles as a starting point for generating the asteroids in Spacemines. There was a slight issue however, how the hell do you move in a circle through an array which is essentially a square (or rectangle), sounds like a dark art!What was I saying?
So then, back to my point! I want to produce a randomly generated asteroid that has some structure to it, and is not totally square and boring. Here’s a pic of what I would like to achieve:
The features I would like to draw your attention to are 1.) the general shape, and 2.) the fact that there are some areas of the map which are inaccessible. Based on the aforementioned article, and having missed a few steps out of the process, this is what I ended up with:
Looks good enough for my purposes to be honest, although I’m aware I could delve in to Perlin noise for a better job, but it seems a bit heavy handed for what I want.
How’s it going?
So now Spacemines has a universe (or asteroid belt) with a number of randomly generated maps to visit and mine the hell out of.
Clicking on a red square takes you to an asteroid, and the currently selected asteroid is marked in yellow.
The next step is to allow the user to dispatch their transporter to each one for colonisation should they discover them on their radar or probe (haven’t decided how a player discovers a new asteroid yet).
The good thing about these maps is that it suddenly adds a new dimension to the game, you are restricted by space but also how you arrange your buildings within that space. Big buildings need to be place carefully otherwise on some maps you just don’t have the room to place these 2×2 monoliths and they can be pretty important i.e. factories, research facility, HQ!!
The image below shows another potential candidate for colonising, once you’ve got the funds and dispatched your transporter across.
Spacemines is pretty much there but due to a bit of feature creep and work on not-so-necessary aspects of the game it won’t be a fully fledged A* title as I had imagined it. However, you will be able to play it as I iterate over it in the next week or so (please forgive any bugs or crap game play at this point). An early release will hopefully encourage some feedback so I can really polish it off.
Thanks for reading… next time we will be delving in to the Isometric world!