help with engine

Talk about making games.

help with engine

Postby EasyViber » Sat Dec 16, 2006 12:05 pm

ok, I wanted to create game similar to one game that I used to play 15 years ago. It's a logical/puzzle game for 2 players. The goal is to dominate all fields and color them in your color.

Image
You start with empty grid and you have to click on a square to color it with your color. Then it's 2nd players turn to do same.

Image
If you click again on field you already colored you increase it's value by 1.
Fields have their maximum values. Squares in corners have 2, by the edge 3, and in the middle of grid 4.

Image
If you click on a square that already has it's maximum value - it "explodes" adding one point to neighbor squares (like on picture after clicking on square with 4 dots). If there are more squares with maximum value, you can create nice chain reactions.

Image
And here's end of the game, after one big chain reaction.

AND NOW....... QUESTIONS:

a) I know I'll have to use 2D array for saving values of squares. How do they work in Game Editor?
b) How to "connect" clicking on grid of actors so it adds value to array with values?
c) Is it possible to create a network game in GE?
d) Any idea's how to create good computer player AI?

that's enough for start. :lol: thnx
EasyViber
 
Posts: 21
Joined: Fri Feb 24, 2006 4:43 pm
Location: Zagreb, Croatia
Score: 0 Give a positive score

Postby makslane » Sun Dec 17, 2006 2:00 am

You can use something like this:

In a Mouse Button Down event, put:

Code: Select all
if(value < 4) //value is an Integer, Actor variable
{
  value++;
  animpos = value-1;
}
else
{
    //Explode
 
    //Left
    SendActivationEvent( getactor(parent.x + x - width, parent.y + y)->clonename );
 
    //Right
    SendActivationEvent( getactor(parent.x + x + width, parent.y + y)->clonename );
 
    //Top
    SendActivationEvent( getactor(parent.x + x, parent.y + y - height)->clonename );
 
    //Bottom
    SendActivationEvent( getactor(parent.x + x, parent.y + y + height)->clonename );
 
    //Left Top
    SendActivationEvent( getactor(parent.x + x - width, parent.y + y - height)->clonename );
 
    //Right Top
    SendActivationEvent( getactor(parent.x + x + width, parent.y + y - height)->clonename );
 
    //Left Bottom
    SendActivationEvent( getactor(parent.x + x - width, parent.y + y + height)->clonename );
 
    //Right Bottom
    SendActivationEvent( getactor(parent.x + x + width, parent.y + y + height)->clonename );
}


And, in an Activation Event, put:

Code: Select all
if(value < 4)
{
  value++;
  animpos = value-1;
}
else
{
    //Explode
    //Test the value before send the activation event to avoid loops
    Actor *to;
 
    //Left
    to = getactor(parent.x + x - width, parent.y + y);
    if(to->value < 4) SendActivationEvent( to->clonename );
 
    //Right
    to = getactor(parent.x + x + width, parent.y + y);
    if(to->value < 4) SendActivationEvent( to->clonename );
 
    //Top
    to = getactor(parent.x + x, parent.y + y - height);
    if(to->value < 4) SendActivationEvent( to->clonename );
 
    //Bottom
    to = getactor(parent.x + x, parent.y + y + height);
    if(to->value < 4) SendActivationEvent( to->clonename );
 
    //Left Top
    to = getactor(parent.x + x - width, parent.y + y - height);
    if(to->value < 4) SendActivationEvent( to->clonename );
 
    //Right Top
    to = getactor(parent.x + x + width, parent.y + y - height);
    if(to->value < 4) SendActivationEvent( to->clonename );
 
    //Left Bottom
    to = getactor(parent.x + x - width, parent.y + y + height);
    if(to->value < 4) SendActivationEvent( to->clonename );
 
    //Right Bottom
    to = getactor(parent.x + x + width, parent.y + y + height);
    if(to->value < 4) SendActivationEvent( to->clonename );
}


Look the example here:
http://game-editor.com/examples/puzzle.zip
Last edited by makslane on Sun Dec 17, 2006 12:43 pm, edited 1 time in total.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

wow

Postby EasyViber » Sun Dec 17, 2006 11:38 am

Wow, that was fast. That's why I like GE and this forum (and yeah, makslane is the greatest...blah blah) :wink:

Link you've posted is not working, but I've found the right one:
http://game-editor.com/examples/puzzle.zip

Then, example was made with last version of GE, and my GE Pro was older version so I had to download new demo version... :D

You gave me some great working material. I've modified it a bit (explosions go only in 4 directions - up, down, left, right - and after explosions value is again set to 1)

Now i'll try to make red squares and to make edge squares explode on 3, and corner squares on 2.

thnx a lot!
EasyViber
 
Posts: 21
Joined: Fri Feb 24, 2006 4:43 pm
Location: Zagreb, Croatia
Score: 0 Give a positive score

Postby EasyViber » Sun Dec 17, 2006 12:32 pm

and yeah, chain explosions work only 2 squares from the place you click, I need to find a way so it explodes as long as there are squares with value bigger than 4, all over the board. OK... it's work in progress :)
EasyViber
 
Posts: 21
Joined: Fri Feb 24, 2006 4:43 pm
Location: Zagreb, Croatia
Score: 0 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest