Friday, March 13, 2009

How Mutch You Pay Scooter Insurance

still exist too! Habemus

After a long and heavy holapercy semester in which it was abandoned, has returned to life.
I set set something holapercy-by smaller than sea-every day. So I have a little list with features and things I have to keep adding or fixing.
The first thing I started doing was re-structured in almost everything, it was disgusting and messy (it still is, but to a lesser extent).

The idea, for he who knows not, is to transform holapercy in some kind of adventure game and is relatively simple creation.
I have already done basic things like loading scenes, which are defined in an xml, simple movement of the character and world power lifting. One of the things that interests me is the subject of pathfinding , which still does not study at all.
First I was missing something: to define in which areas of the scene the actors (characters, whether NPCs or the player himself) can move. Looking

AGS, that's what they do "paint" the area where you want to let the characters walk. From this I decided to implement my solution.
A scene consists of 2 layers (probably end up being more to add new features), the first scene itself and then an image with the areas "walkable" painted in blue.



(The fourth was drawn by the old and disgustingly painted by my one afternoon that I had nothing better to do)



As was until now, you could click on either side of the room and the character moved up there, no matter how off the roof or end up on the bed. Combined


:


Then imagine the paint layer as a grid consisting of 16x16 cells, with values \u200b\u200bof 0 (cell on which you can not walk) and 1 (for access). As the window size 640x480 this can be seen as an array of 40x30 (640/16 = 40 480/16 = 30).
cell by cell is scanned to see if there are at most 1 pixel blue and if any, that position is marked as accessible to the characters. That's why the painting is not necessary paint too close to objects like a bed or desk, because with only 1 pixel and could be filled with a cell that is over the object.

Within the game you can press F3 to see the grid and the area over which to walk.



The next step will be to implement an algorithm A * for character movement, using as a navigation map created from the grid layer "painted" scenes.