Page 1 of 1

Move range searching

Posted: Sun Feb 14, 2010 11:33 am
by Vandal
I am thinking how to search the range a character can move now. I made a sample program, so I expose.
Look at pictures. "S" is a start point, brown squares are walls and cyan ones are floors, and each number signifies move power left for shift -- the search process stops when the move power is exhausted. Green ones are the woods, and two move powers are used there. Pink is a route.
Those pictures were drawn by Irrlicht.

Binary
http://www.mediafire.com/download.php?jxyzjtyttkh

Image
Image
Image

Posted: Sun Feb 14, 2010 12:38 pm
by hybrid
Do you have any code, or at least some description about how you create the levels/search results?
This isn't really a project, so I'll move it to code snippets - you just have to add the code therefore.

Posted: Sun Feb 14, 2010 2:01 pm
by trivtn
I've use bitmap file as the Map of finding. An average value as the searching value ( <64 is no moving into).

A*

Posted: Tue Feb 16, 2010 10:15 am
by Vandal
I tried searching move range by "A*", and succeeded. This is a very simple program for testing, and I must coordinate it for common game usage. Needless to say, this program is necessary to characters' moving of various games.

Image
Image
Image

Posted: Tue Feb 16, 2010 10:35 am
by Virion
i'm not a tech guy here but normally if let say I am S and I'm going after F, wouldn't I go straight to him rather than walking along the sideway? Since there isn't any obstacle in the middle. just my 2 cents though.

Image

Posted: Tue Feb 16, 2010 10:44 am
by ErUs
Virion wrote:i'm not a tech guy here but normally if let say I am S and I'm going after F, wouldn't I go straight to him rather than walking along the sideway? Since there isn't any obstacle in the middle. just my 2 cents though.
Same distance, but like you say; i think most games will try to zig-zag.
This could be done by keeping a record of last move direction, then if you have an equal cost of moving in 2 directions try not to move in the same one as the last time.

Posted: Tue Feb 16, 2010 10:50 am
by Acki
Virion wrote:i'm not a tech guy here but normally if let say I am S and I'm going after F, wouldn't I go straight to him rather than walking along the sideway? Since there isn't any obstacle in the middle. just my 2 cents though.
no, if you look at this picture:
Image
you'll see that each square has a moving range value...
and if you count the values you'll see the (long) path has a lesser value than the streight path... ;)
(at least this how I understand this :lol: )

Posted: Tue Feb 16, 2010 2:35 pm
by hybrid
No, that version was probably the completely clear version. But as ErUs said, both ways are the same distance (as we're not in euklidian space anymore) and hence are equally good. So it depends on side conditions or the search order which path is found.

Posted: Tue Feb 16, 2010 5:16 pm
by Ulf
He's talking about weighted graphs. Each node has it's own weight.

But the example he gave, both paths add up to 6

Posted: Tue Feb 16, 2010 8:38 pm
by Acki
Ulf wrote:Each node has it's own weight.
..., that's what I meant with "moving range value" !!! :lol:

Posted: Wed Feb 17, 2010 10:10 am
by Vandal
Virion, your point that it seems more natural that a character trads zigazag is correct, but zigzag will increase useless actions --waste time for turn-- in the project I am imaging. I let a man walk as straight as possible.
The first, second, and third pictures are not A*. They are calculated only by a move value each square has without A*. All a* programs have window-titles "A*". :wink:

Posted: Fri Feb 19, 2010 10:00 am
by Vandal
This is a sample that I extended my A* program to 3D. It is so easy to apply a complete program on Irrlicht to 3D.

Demo
http://www.mediafire.com/download.php?mzzojwgkuo2

Image[/url]

Posted: Fri Feb 19, 2010 10:21 am
by Virion
Vandal wrote:This is a sample that I extended my A* program to 3D. It is so easy to apply a complete program on Irrlicht to 3D.

Image
looks good! hope to see a 3d model running on the path soon!