PDA

View Full Version : TBAI - Pathfinding and waypoint handling



Michael Hartlef
22-10-2009, 23:28
Hi folks,

here is the first public version of my new TBAI module. This module supports 2D and 3D pathfinding in a grid of connected nodes and also predefined waypoint managment.

In the attached zip file you will find the module itself, a help file, a sample script that will show off waypoint handling and a modifed version of the TBGL module, which you will need also. Of course, I will write more samples.

If you have suggestions, then please let me know.

Cheers
Michael

Michael Hartlef
22-10-2009, 23:30
The first sample is about waypoints. The scripts starts with a short path allready defined, but when you press N, you can create a new path. After that press R to let the path marker run on your new created path.

kryton9
23-10-2009, 04:02
Mike what a wonderful surprise. Thanks.

After you click N, left mouse click to add the first start node and subsequent nodes-- till the end node, which is when you press R.

So Press N
First left mouse click is Start Node
left click additional nodes
The last node will be the end node when you press R
and then it will play the object moving on the new path.

Again, thanks Mike another wonderful addition to tbgl!

Petr Schreiber
23-10-2009, 07:55
Great job man! :occasion:,

very pleasant surprise. Complete module, help file and sample ... what could I ask more?
Well, another sample :)

Excellent!


Petr

Michael Hartlef
23-10-2009, 11:53
Thanks guys. I will create more samples in the next days.

ErosOlmi
23-10-2009, 19:42
wow, thanks a lot for the BIG surprise ! :eusadance:
I'm at work at the moment but as soon as I will go home I will run it.

ErosOlmi
23-10-2009, 22:07
Well,

what is impressive is that in just 230 lines of code you have created a so sophisticated application.
An easy to understand module well documented and seems easy to be used (if I was able to understand it it is really simple :D ).

A question:
is is possible to create a path in which when the marker reach the last point it moves to the first point instead of returning on his path?
Like a circle path I mean.

Thanks thanks thanks for this present Michael.
Eros

Michael Hartlef
23-10-2009, 23:36
Thanks Eros! Yes, when you create the Marker, there is the mode parameter which you can set to STOP, LOOP, or BOUNCE. In my script it is set to BOUNCE. Set it to LOOP and it will do just that.




n = TBAI_MarkerCreate ( pathID [, direction , mode ] )

Petr Schreiber
24-10-2009, 09:28
Mike,

may I have little suggestion?
Would it be possible to introduce equates like %TBAI_FORWARD, %TBAI_BACKWARD, %TBAI_STOP, %TBAI_LOOP, %TBAI_BOUNCE?

It is little detail which makes code slightly more readable.


Thanks!

Michael Hartlef
24-10-2009, 10:29
Sure, will do that.

Lionheart008
24-10-2009, 14:49
hi michael. I can also only say, superb! I have tried this little tbai path game script some minutes before with thinbasic 1.7.9.0 release and it works very fine ! thank you for this good script, it will take a big step in game development for the future here, I am sure :)

best regards, frank

Michael Hartlef
24-10-2009, 16:00
I am glad you like it. :)

ErosOlmi
25-10-2009, 09:25
Michael,

let me know if you would like TBAI module (help file and sample script) be distributed with thinBasic setup.
I will be happy to include them.

Ciao
Eros

Michael Hartlef
25-10-2009, 11:40
If you think it is worth it, then I go ahead. :) Please make some space in the SVN, so I can upload the sources there.

ErosOlmi
25-10-2009, 11:45
Great.

ErosOlmi
25-10-2009, 12:24
Created SVN project folder for TBAI

Ciao
Eros

PS: Like for most of the other SVN project it is private to the usual group.
Up to you if open or not to the public (in read only for example).

Michael Hartlef
25-10-2009, 14:34
Ok, uploaded to SVN.