A checkers or other similar "board" game

Game Editor comments and discussion.

A checkers or other similar "board" game

Postby Toasterman » Thu Jul 22, 2010 4:35 am

I have been wanting to make a basic board game that operates on a grid -like chess or checkers- for a while now, but am unsure as to how to set up the grid.
More specifically, how the actors would check if a potential space is occupied. I'm not worried about the AI just yet -I can make that later- but rather the basic foundations that would allow a peice to move around the board while not moving onto other peices.

I have a basic knowlage of other object-oriented languages (like adobe flash's actionscript) but I'm reletively new to Game Editor
Any help would be greatly appreciated as well as links to other tuturials etc.

(my crummy dial up may prevent any prompt updates on my part)
"If there are no stupid questions, what kind of questions do stupid people ask? Do they get smart just in time to ask a question? -Scott Adams

Hey! I've got okayish internet now! Now I can try all those cool demos I've seen!
User avatar
Toasterman
 
Posts: 75
Joined: Thu Jul 22, 2010 4:22 am
Location: Drowning in Dial-Up Ocean
Score: 7 Give a positive score

Re: A checkers or other similar "board" game

Postby jimmynewguy » Thu Jul 22, 2010 4:45 am

Hello, and welcome!

Here is a checkers demo made by Makslane: viewtopic.php?f=6&t=5188&p=34711&hilit=checkers#p34711

This should get the basic and advance concepts out of the way, as long as you understand :lol: If you need any help, just ask around. There's plenty of smart coders around these parts!
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: A checkers or other similar "board" game

Postby DST » Thu Jul 22, 2010 4:53 am

Create an integer array, you can use the variables tab or create one in global script; make it 64 in length.

int board[64];

At any time, you can use a timer or Actor*loop to enter each actor's coordinates into the array. You should make the game so the 0 coordinate (Game Center) is the upper left corner of the board, to make things easier. If your squares are, say , 50x50 pixels each:

int s1=round(x/50); //how many squares from 0
int s2=round(y/50);
int mycell=s1+(s2*8); //xsquare (horizontal) + 8 for every vertical row. This is the core of 1d arrays to make 2d boards.
board[mycell]=1; //show that square is occupied.

A pawn can then easily search the array for (mycell+8) to see if it can move forward, and (mycell+9) & (mycell+7) to see if it can capture.

Eventually you will want to make it a 2d array, (int squares[64][5]) as the 2nd slots would be used to store all the information about a square when you do construct the AI:

0: is this square occupied (can i move here)
1: what color is on it (can i capture here)
2: What can i put in danger by moving here (is this an advantageous square)
3: how many other opposite pieces can capture this (is this a dangerous square)
4: if opposite side piece, is it already in danger (do i need to capture here)
5: will i protect more of my pieces now or if i move to this square (is this an advantageous square)

From this point of view, AI is relatively simple, as you search the array for each piece, ask those 6 questions about every possible move that piece has, and find the piece/square combo with the highest number of positive answers.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: A checkers or other similar "board" game

Postby Hblade » Thu Jul 22, 2010 8:29 am

Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: A checkers or other similar "board" game

Postby Toasterman » Thu Jul 22, 2010 3:40 pm

Thanks for the help! :D

Finally the answer to a nagging problem that has bothered me for some time! :D
"If there are no stupid questions, what kind of questions do stupid people ask? Do they get smart just in time to ask a question? -Scott Adams

Hey! I've got okayish internet now! Now I can try all those cool demos I've seen!
User avatar
Toasterman
 
Posts: 75
Joined: Thu Jul 22, 2010 4:22 am
Location: Drowning in Dial-Up Ocean
Score: 7 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest