Page 4 of 5
Posted: Thu Aug 14, 2008 11:45 pm
by Heathen
Sorry guys, forgot to update the example. My brain wasn't working this morning
Anyhow, it's been updated.
PS: I want to rewrite the example, it's quite sloppy right now.
Posted: Thu Aug 14, 2008 11:50 pm
by untune
Heathen wrote:Sorry guys, forgot to update the example. My brain wasn't working this morning
Anyhow, it's been updated.
PS: I want to rewrite the example, it's quite sloppy right now.
Runs fine now, great work

Posted: Fri Aug 15, 2008 3:03 pm
by Rook Zimbabwe
Thats it! Nice!!!

Posted: Sat Aug 16, 2008 12:26 am
by superadnim
Question: why did you use .c (character) instead of .b for the speed field on the player structure? you also seem to use .c for a lot of things, know that if I compile as unicode those characters will be 2 bytes long and not 1 byte as .b is. I know they're unsigned but what's wrong with using .b?

If it's due to the debugging "issue" then do & $FF and it should debug just fine, shouldn't it?.
Aside from that I loved the updated code - I just wanted to point that out though
Code: Select all
Macro DebugB(_var_) : Debug _var_ & $FF : EndMacro
Define.b var = 231
Debug var
DebugB(var)
Oh, another question: is it faster or slower than before?. I remember you were using PB arrays before the dynamic code, any possibility of a benchmark?

Posted: Sat Aug 16, 2008 9:49 pm
by Heathen
There isn't too much of a speed difference in the newest version, if anything, it will be slightly faster because of some small optimizations I made, this was mostly a bug fix update. I'll remove most of the chars, I don't remember why I used them, besides the priority array which I wanted to be from 0-255.
Posted: Sat Aug 30, 2008 11:31 pm
by Heathen
Small update: Replaced chars with bytes.
Posted: Wed Oct 01, 2008 3:11 pm
by zxtunes.com
Too hard Example. Only for advanced porgramers.

Posted: Wed Oct 01, 2008 5:34 pm
by Inner
how would this work in 3D?
Posted: Sun Oct 05, 2008 1:33 am
by Heathen
zxtunes.com wrote:Too hard Example. Only for advanced porgramers.

Yes, the example is pretty sloppy and a bit bloated. The engine itself is pretty straightforward though. I may write a more simple example.
inner wrote:
how would this work in 3D?
This engine is 2d only.
Posted: Sun Oct 05, 2008 4:39 am
by Inner
Heathen wrote:
inner wrote:
how would this work in 3D?
This engine is 2d only.
It could work in 3d you'd just lose your Z axis, which you could fake by having the object detect ground level on the Z axis, or am I over reaching here?
Posted: Sun Oct 05, 2008 8:24 am
by Heathen
Inner wrote:Heathen wrote:
inner wrote:
how would this work in 3D?
This engine is 2d only.
It could work in 3d you'd just lose your Z axis, which you could fake by having the object detect ground level on the Z axis, or am I over reaching here?
Yes of course, you can technically use it in any environment, I meant that there's no support for the Z axis. Although, adding the third axis in the form of 2d 'layers' or 'floors' should be fairly trivial. I'll probably end up adding that in the future since the game I've been making with this will need it eventually.
Posted: Fri Oct 10, 2008 9:25 pm
by Rook Zimbabwe
Great Job! I think this is very useful!:D
Re: Dynamic A* Pathfinding 3.2
Posted: Fri Oct 19, 2012 12:58 am
by AndyLy
Also decided to try this method, but in the example of a lot of unnecessary.
Wrote a simple example, for myself, to see how it works. Maybe someone will need it.
Code: Select all
InitSprite()
XIncludeFile "pathfinding.pbi"
#tilesize = 20: #width = 35: #height = 30
Global Dim blocked.c(#width-1,#height-1): For i=1 To 200: blocked(Random(#width-1),Random(#height-1))=1: Next
pathfind.pathfinding_structure
pathfind\Width = #width: pathfind\height = #height: pathfind\blocked = @blocked()
mnstrX=0: mnstrY=0: blocked(mnstrX,mnstrY)=0
plrX=20: plrY=15: blocked(plrX,plrY)=0
path=get_path(mnstrX,mnstrY,plrX,plrY,pathfind): pathsize = path_get_size(path)
OpenWindow(0,0,0,640,480,"Example",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
OpenWindowedScreen(WindowID(0),0,0,WindowWidth(0),WindowHeight(0),0,0,0)
Repeat: StartDrawing(ScreenOutput()): DrawingMode(4)
For i=0 To #height-1: For j=0 To #width-1: If blocked(j,i)=1: col=#White: Else: col=#Gray: EndIf
Box(j*#tilesize,i*#tilesize,#tilesize,#tilesize,col): Next: Next
For i=0 To pathsize-1: Box(path_get_x(path,i)*#tilesize,path_get_y(path,i)*#tilesize,#tilesize,#tilesize,#Red): Next
Box(mnstrX*#tilesize,mnstrY*#tilesize,#tilesize,#tilesize,#Yellow): Box(plrX*#tilesize,plrY*#tilesize,#tilesize,#tilesize,#Green)
StopDrawing()
FlipBuffers()
event = WaitWindowEvent(1)
Until event = #PB_Event_CloseWindow
Re: Dynamic A* Pathfinding 3.2
Posted: Wed Oct 24, 2012 10:59 pm
by Fig
Hi,
Could you explain what you mean by "dynamic" ?
thx
Re: Dynamic A* Pathfinding 3.2
Posted: Thu Nov 29, 2012 6:27 pm
by Fig
Is anybody can answer my question please ?
Does your dynamic pathfinding means you use a reservation table for cooperative pathfinding of multi-agents to prevent collisions ?