I recently got a question from a friend about the basics of how I do game development (how am I doing 3D, how does my engine work, tc.), so that seemed as good a reason as any to get back on it with my blog (this blog has been inactive for I think a month or more!)
@p
So it begins! A four part tour of how I do game development...
The way I tend to structure my games (and this is ever-changing) is as a separation between world, which is like a simulation or sandbox, and play, which describes the gameplay flow and any control issues (e.g., when the player dies, go to a gameover screen, show whatever map the player is on, etc.)
@p
The world class is the interesting part to conceptualize. First, Texas' world is split into areas of 50x50 blocks, and at any time up to 5 areas are loaded into memory. Only one area is "current", so the other 4 are just essentially a cache to reduce loading times if you go back and forth between a few screens.
Each area has on it a few types of things: first, there is terrain, which is a "smooth" looking mesh (but still on a 50x50 grid).
@p
Terrain is made up of several layers and the engine optimizes these. Rather than have one single terran layer, I used multiple in order to produce "seams" between layer types, e.g., the geometric boundary between rock and grass in this picture:
Next are blockgrids, used for houses, walls, castles, and certain features (e.g., the outside portion of wells).
@p
Blockgrids are basically made up of textured blocks; they are sharp-edged and textured, vs. the smooth-edged and non-textured terrain-- a nice contrast.
@p
Notably, the blocks are only half as tall as they are wide, which allows for stairs and other interesting effects, such as the top row of white blocks here:
After that comes objects. These are generally "static" things, such as rocks, trees, grass, and the like.
@p
Each object has many, many properties such as shadow darkness, a flag and footprint for if they are solid (e.g., trees have a 1x1 footprint, are 8 blocks tall, and are solid), as well as methods to handle clicks and other interactions.
@p
This makes it generally easy to define new types of objects, which is very important-- Texas has perhaps around 500 different types of objects (and counting!)
Stay tuned, because the next three parts are already written! Next I'll talk a bit about enemies and NPCs and how they get put into Texas.
2010-05-27