hexatron; a roguelike-like super stardust?

For the SA GameDev compo, which its theme is BALLS, seemed a little bit abstract. Right before the theme was announced, I was playing AirMech for a little while. For those that are not familiar, the game is pretty similar to Herzog Zwei, with some DOTA elements like creeps added into the mix. I wanted to take Herzog Zwei and combine it with Galcon Fusion, where you could jump from planet to planet with a fleet of buddies and start some shit. Made me think about Dynasty Warriors, while for all intents of purposes in love with its idea, usually just shut off within the first minute. Having something of a galactic map, showing what fronts you’re working with and swooping in on planets that are getting very contentious with your almighty supership has been really fun to think about. Unfortunately, it probably wouldn’t have been possible to do, given that I only have July to make it. I’ve never really worked on any kind of AI past state machines and wouldn’t know how to tell a computer to think strategically as I’m pretty awful at that myself.

I went to think about other games that have planets, namely Super Stardust. I’ve bought a Vita at launch as I’m a little too addicted and excited about powerful handheld game consoles, but also for Sony’s exciting Playstation Suite (now Playstation Mobile) initiative. Unfortunately Playstation Mobile hasn’t lived up to my expectations (which was something like Microsoft’s Indie Games), but that is a post for another time. One of the first games I got for the Vita was Super Stardust Delta, which was my first Super Stardust game. Needless to say, it’s a pretty dang good game.

I’ve figured, I could probably pull off making Super Stardust pretty easily. Probably need to try to make a very basic clone of it in Unity to confirm my suspicions, since there are often unforeseen circumstances. Given that, it wouldn’t be good enough to just rip it off. I’ve seen a post in the compo thread that was providing tips on what kind of game idea you should make based on goon tastes; one of them suggested that goons love Metroidvanias. Thing is, I do too! So I’ve figured… some Super Stardust-like game, with the planet’s surface covered with interconnected rooms that you would fly through. Another thing I would like to sprinkle over are some RPG elements, like leveling up your health meter and having some sort of skill tree for each weapon type, though details of such I would try and worry about later. So here I got a game that’s like Super Stardust with some RPG elements, having the player explore rooms on top a surface of a planet, moving from one area to another to eventually get to some final boss (sounds a little like a top-down Descent). How many levels could I possibly make in a month, though? One? Two? If anything, I’d like to give it some unique gameplay at every game the player starts.

So, I’ve figured I’d make it a roguelike. At least in the sense of level design, if not various RPG stuff like loot drops. Here comes the more technical bits; I needed to think about some base unit structure that I can extend out from the planet. So, I’m looking for some sort of sphere made up of the same polygons, of roughly the same size. The polygon used to make the sphere, I’d use to create rooms and levels with. My first idea was triangles, since all meshes are made up of triangles, in one way or another! I couldn’t use the bread and butter sphere mesh, though. You know, the one made up of horizontal and vertical slices, making longitude and latitude lines?

Sphere made up in longitude and latitude slices

Imagine every square polygon made up of two triangles from the above picture. I could try to generate random structures and rooms, based on the triangles on the surface, but not every triangle would be of the same size or shape. I would have to add even more rules to my level generation based on how close to the poles the rooms would be; even then, rooms will tend to look skewed compared to rooms around the equator. I needed the triangles to be of roughly uniform size and shape. So I decided to look into an Ico Sphere.

A 20-sided polyhedron, or the 20-sided die for you DnD nerds

The basic concept of an ico sphere is based on the icosahedron; a 20-sided polyhedron that many would recognize as your favorite 20-sided die. The steps involved to make this more of a sphere is to subdivided each of the 20 triangles to some desired amount of polygons, then from the center of the polyhedron, project through each vertex of the subdivided mesh of some uniform length; this is meant to be an act of projecting each vertex at the surface of some perfect imaginary sphere that surrounds this shape. What would result is this:

A sphere based on a subdivided icosahedron

This method of making spheres usually yields better results than the longitude and latitude sphere above with fewer polygons (though it is usually called a UV Sphere for a reason!). Not what I’m interested in, though. From here, you can see it creates much more uniform triangles in size and shape, but not completely. There are some groups of triangles that look to be pinching in within each other; these triangles are the ones closest to the corners of the original subdivided triangle. When projecting lines through these, they are much closer together once on the sphere, than the subdivided triangles that are closer to the center of the original triangle face. Still, a much better starting point than the above UV Sphere.

After I’ve been looking in this for a while, I’ve begun to doubt the viability of using triangles as a building block for level generation. Given enough time and work, I’m pretty it’d be possible to create amazing looking level designs with some few parameters. Problem is, I don’t have enough time to experiment and try to create great randomized rooms, especially since I’ve never dealt with any form of procedural generation before. I’ve begun to notice a certain polygon in the above mess of triangles, though. Hexagons! That’d be a pretty neat build unit for level generation. Awesome thing is, before I even begun to research and experiment with this, I’ve found an great demo of the exact thing I’m looking for; HexPlanet!

My prayers have been answered!

The mesh it generates is still an icosphere, but I’ve been able to take the code and create a sphere completely made up of triangulated-hexagons (with the odd 12 pentagons) within the same demo:

With this, I can generate rooms based on hexagons, connected to other rooms and so forth with an easy enough to develop algorithm (I’ll get more into level generation in my next few posts). I know I’ve talked quite a bit about this aspect but for me I feel this is the glue that would hold the game together. I’m hoping that it’ll be fun enough for people to want to play new games over and over again.

As a bonus, here is a terrible concept sketch I’ve made on how the game would “play”:

The center mess of triangles would be the player, flying around these rooms (remember, the movement is not based on the hexes, they are only used for level generation), playing like some dual stick shooter like Geometry Wars/Super Stardust with some RPG elements. There are, of course, some more minute details to go over and additional gameplay elements, but that’ll be a post for another time! This one is long enough as it is.

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=""> <s> <strike> <strong>