Monday, January 11, 2010

A programming project idea

One idea I have had bouncing around my head for a while is to make an generalized engine for a turn-based strategy game. I’m thinking something along the lines of Xconq, but done right.

I’ve blogged about Xconq before; Xconq is a game that had a lot of potential that was never realized.

To be fair to Stan Shebs, when he started the Xconq project in the 1980s, he did not have a lot of tools available today for making video games.

To wit, if this idea in my head every become reality, I’ll use two libraries Stan did not have:
  • SDL for handling graphics, and for abstracting the OS away from the application (SDL runs on Linux, Windows, and Mac OS X)
  • Lua for handling the scripting; the best embeddable scripting language Stan had was a Lisp dialect, which, while elegant, is hard for end-users to learn
In addition, while the goal will be something that can easily make just about any turn-based game out there, I will focus on only one turn-based game.

My plan is to have a C-language layer between SDL and LUA; this layer will handle the nuts and bolts of the game (drawing the tiles, pathfinding, drawing the units, making the GUI), and have LUA control all of the rules of the game. To keep things simple, the engine will only allow hex tiles, and allow only either a flat map (border around the edges), or what I call a “sphereoid” map: Flat map, wraps like a cylinder left-right; going north of the North pole puts you at another square on the north pole, ditto with south pole; this is topologically equivalent to a sphere. The engine, if ever made, will assume units move to one adjacent hex per movement point (teleports, a.k.a. the “Silver Mage” in Wesnoth, will come later), and different hex types will have a weight (for the pathfinder), movement cost (different from weight for tiles that damage units), and visibility (for determining shroud updates and fog of war).

Movement will be Wesnoth style; click on a unit once to see where it can move; click on a square to move the unit there; right click after left-click to cancel the movement; right click on a unit will pop up a menubar defined by the LUA script. With the exception of things like "Save Game", "Load game", other menubar items will be determined and processed by the LUA script.

Anyway, this is just a “blue sky” idea right now. Back on Earth, it’s time to give Deadwood real recursion. Speaking of which, Deadwood is now used by CERN laboratories. You know, the guys who invented the World Wide Web (which was just a side-project to help people share research) when not doing real research.