It has been some time since we have defined the basic concepts and architecture of our game. I’ve setup a central Git repository for pushing our code, CK has done the initial modeling of our game’s entities, Fukui has come up with a really cool joystick control for our game (similar to Unreal’s Epic Citadel) and I have been working with the code for our tracks and it’s pieces.
As I pointed out on my previous post, for portability reasons, the core of our game is been written in C++. Our choice of language has proven to be a very fortunate one as C++ provides a really nice way to express our game mechanics and at the same time have maximum control for any eventual optimization.
Our track is basically a very simple doubly-linked list of track pieces. A track piece is represented by the TrackPiece abstract base class and each concrete track piece is either a LinePiece, a CurvePiece or a DiagonalPiece.
All track pieces have an orientation (0, 90, 180 or 270 degrees), a position in the track grid, a size and for validation purposes they also store their entry and exit edges. Because a track piece is also a node on a doubly-linked list they also store a pointer to the next and previous pieces.
An entry or exit edge is basically the edge of the piece that connects to another piece and since our pieces can have different sizes we had to come up with a way to map this connecting edges.
A simple way to map the connecting edges of the pieces was to divide the pieces on quadrants of the same size and numerate each side of the quadrants. So a connecting edge is mapped by a structure made of a quadrant and a side. The picture to the right demonstrates this mapping mechanism.
For testing purposes I have created a hardcoded track so we can test drawing it to the screen.
Where de we go from here?
- I’ll be joining Fukui on the device dependent area for finally creating the functions to draw our tracks to the screen.
- CK will provide us with the curve functions for each track piece.
- We’ll also create the functions to draw the players, control and animate them as they slide through the track.
It might be a little bit early to write this here but I really hope to have some screencaps of the game to post here.
Until next time!