Daniel Petersen's Blog

Developing two videogames -- 9001, an addictively fast paced arcade game, and It Usually Ends In Nuclear War, a strategy game which is something of a mix between Civilization and Stellaris.


Sins of a Hex Empire

Posted on 2013-10-09

I spent the past few days working on an old project that I could never quite get working correctly. It’s a clone of the game Hex Empire which I’m affectionately calling Sins of a Hex Empire. The name is a play on the game Sins of a Solar Empire, which is probably one of the worst names ever, but I think it’s endearing. Anyway, the old version I attempted to make was in C++ with SDL. I’ve been spending the past few weeks studying up on web development stuff, which has been interesting, but I wanted to go back and finish some of my unfinished projects before I go to school. Working on this served to give me a nice sense of progress considering it was something that I was previously unable to get working correctly.

The first thing I did was port it over from SDL 1.2 to SFML. I did this because I’m a lot more familiar with SFML, and the version of SDL it was using was dated, so I wanted to either port it to something else or work on updating it to the latest version of SDL. It was really just a question of porting to SDL 2.0 or SFML, which was a no brainer for me.

I ended up drastically changing the code structure, rewrote a lot of old functions since some of my old code was terrible, fixed a bug with the pathfinding which took forever to figure out, and added in an AI. The AI isn’t that great, but it only has a few hours of work on it, and I don’t think I have enough time to play around with it and improve it some more. It’s managed to beat me a few times so I figure that it’s good enough for a base line level. If you want a harder challenge you can artificially handicap yourself by picking a terrible starting position.

I present Sins of a Hex Empire:

Github Repository

  • Turn based strategy game.
  • Your goal is to defeat three opposing AI and conquer the entire map.
  • The black dots scattered across the map are cities. If you own a city, it generates one army every turn.
  • The light blue hexes in the screenshot are water tiles. You cannot move on them.
  • The green hexes in the screenshot are land tiles not owned by any nation.
  • The red, yellow, dark blue, and purple tiles are land tiles owned by each respective nation.
  • Capitals (the stars) generate two armies per turn. If you capture a capital, that enemy will be eliminated.
  • Your units have two values -- armies and experience. Armies are the thin black crosses, experience is the black outline around those crosses.
  • A unit gains experience whenever it expands your nations borders.
  • You have a limited number of moves per turn.
  • Pressing enter moves to the next turn.
  • Pressing spacebar at any time spawns a new map.

Copyright © - Daniel J. Petersen