Skip navigation

Monthly Archives: April 2011

Last week, I left off with a sprite on on hex tilemap. I didn’t feel this really entailed “The player starts in the center of hex field“. There was no actual concept of a player or any other sort of entity in the code. Well, this week I have accomplished just that and this task is done. I’ve decided on a three-part model of any given agent in the game.

  1. The entity: A collection of transient and intrinsic properties that contain the data of an agent.
  2. The controller: The brains of the agent. A player controller interprets input from the player to control his agent. A controller issues high-level orders, like move-there and shoot-that, to the agent.
  3. The actor: Takes orders from the controller and translates them to alter the data in the entity, like position, facing, animation, and whatever else it takes.

This structure gives a strict rules in who owns/modifies what. The entity only contains data and no logic. The controller only reads data and issues orders (temporal data only) and contains minimal state. The actor modifies data and only contains only enough logic to carry those orders out. It does no real decision making. The arrangement is fairly object-oriented, but if I wanted to do a data-oriented design, I think this could swing it later.

Next up is “The player can move to adjacent tiles“. This should be pretty simple and is rated a one-point task. Seeing I have a controller and actor for the player, it’s just a matter of getting input from the player and making and interpreting those orders. I’m also going to take a crack at “The player can see that different tiles have different aether densities“. It’s already mostly much done because I have a tilemap being displayed. This task will just be a matter of iterating through the tiles and building an array of tile info. It is also just a one-point task.

This week I did not make a lot of progress. I probably only got 3-4 hours in and most of that was spent struggling with Xcode. Somehow, the project got corrupt? My Hello World compiled and ran last week and this week I try to get a simple tile map running, and the program would never run. It would compile, but whenever it tried to send it to the iPad simulator, it would sort of hang. This is apparently a known issue in the Apple dev forums, but no solution presented worked for me. So, I updated the Cocos2D branch, installed their templates, and made a new project based on one of them. It works now.

I also made a hex tile map and I can load the game with it showing. There isn’t a concept of a “player” yet; no representation on the screen or in the code, so I can’t say the next task is complete. That’s going to be next week. I’m also going to push “The player has a homebase” back to a later sprint. It’s not an intergral part of the gameplay loop to have one, so I’ll focus on that later. That means the next task up to bat will be “The player can move to adjacent tiles“.