# Designing Movement On A Board Game

This topic is 4677 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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?

##### Share on other sites
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)...

##### Share on other sites
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.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 13
• 9
• 9
• 15
• 14
• ### Forum Statistics

• Total Topics
634070
• Total Posts
3015335
×