Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: RoliX on Tue 01/03/2011 15:05:19

Title: Help in "Klotski" puzzle minigame
Post by: RoliX on Tue 01/03/2011 15:05:19
Hello everybody,

I would like to implement one of my favourite puzzle into my game, as a lockpicking-minigame.
I don't know what is the common name of this puzzle, I think "Klotski". But you can try the game here: http://silverlightgames.org/game/klotski/play/

I'm sure everybody have seen a puzzle like this. Last time I met this puzzle in the Broken Sword: Director's Cut, and it was really amazing!

First of all, is it possible to make a minigame like this in AGS? If so, I need your help. I searched a lot in the forum, but didn't find anybody who did similar things.

I'm not so good in advanced functions of AGS, so I don't even know how to start it  :-\

I hope somebody can help :)
Title: Re: Help in "Klotski" puzzle minigame
Post by: Khris on Tue 01/03/2011 15:37:09
Yes, definitely possible.

The problem I see is that you don't even know how to start. Although the game isn't particularly complex, one can't explain how to do this in a few lines; I can give you a general idea about what has to be done though.

You need to store a) the borders of the playing area, b) the positions and dimensions of the blocks.
Then you have to implement moving a piece, updating the graphic representation and checking if the puzzle has been solved.

While I'm sure others would suggest to use objects for the blocks and walkable areas or regions for the borders, I'm not really comfortable doing this and would go straight for storing everything in arrays of structs.

Since we operate with a grid here, storing the data of each cell is relatively simple. Provided the game area is 10x10, a simple bool border[100]; array suffices to store border data.
Before moving a single square piece at x;y to the left, the border check that has to be done is as easy as   if (!border[y*width+x-1]) ...

Long story short, if all that sounded like Chinese, learn how to program first or get somebody else to code the minigame for you.
Title: Re: Help in "Klotski" puzzle minigame
Post by: RoliX on Tue 01/03/2011 16:36:12
Thanks for the reply!

Honestly, your opinion sounds like half-Chineese for me :/ I'm still trying to understand at all, but I'm sure I can't do it alone... :(

I would be very grateful if somebody could make the "engine" of this minigame. Then I could personalise it to fit into my game. Probably others could find this script(or module) useful too :)

I know time is valuable for everybody, so I don't even dream somebody will make this minigame in a few days.