Advertisement

Designing Movement On A Board Game

Started by March 30, 2006 02:10 AM
1 comment, last by Codman 18 years, 10 months ago
I'm developing a board game. Here's what the board looks like: http://brandontom.com/images/random/game-board.gif The 'X' represents a game piece. Pieces can move around the board in three directions: http://brandontom.com/images/random/game-board2.gif The directions are indicted by the red, green, and blue lines. What I'm trying to figure out the best way to design the movement. Basically this is what I was thinking (I said 'was' because it's a TERRIBLE idea): For each direction there are seven rows. I was going to create three classes that represent the three directions and then create objects that represent the rows. There would be 21 rows in all. Then I'd create a board space object. Each board space is associated with three rows. From there I'd populate the rows with board spaces and that's the general set up. How valid movement would be determined: From there all I'd have to do to figure out the movement was valid was to see if the two board spaces (the one being move to and the one being moved from) have a matching axis, then the move is valid. This tactic looks like it's going to suck. It's totally ineloquent. As you can imagine, there's a lot of duplicate code which is always a sign of disaster I need a new strategy and a new inspiration. Where am I going wrong here?
Brandon Tom, SCJPtomk002@hawaii.rr.com
Why don't you use a straight forward design:

a board which has just fields and has a function to determine if two fields are adjacent, which should be easy enough be determined by some way of circle function, as all fields you can move too lie on a circle around your field with a distance of 1 field...(if you have the centre point of each field as you draw it, that is it)...
Advertisement
See your table as a 2D matrix. You can set all cells in a 2D coordinate system (xOy). For every row you have to remember length and offset. Offset is used when first table cell does not overlay the first matrix cell for a certain row.

From there you only have basic moves over a chess table which is pretty simple to define.
-----------------------------How to create atmosphere? Bring in EMOTIONS!

This topic is closed to new replies.

Advertisement