Author Topic: [Resource] A* Implementation (Pathfinding)  (Read 20613 times)

Added delayed searches.

This lets you search for a path in the background without freezing the game during it.
See this section of the documentation for further details:

http://github.com/portify/ts-pathing#delayed-searches


Nobody? :panda:
With the delay search, can we use more than 128 nodes?

With the delay search, can we use more than 128 nodes?

You can do that with the normal version too. Using the delayed search prevents lagging the game for large processes though.

You can do that with the normal version too. Using the delayed search prevents lagging the game for large processes though.
Is there a way to remove a neighbor without changing the neighbor count of each of the neighbors?
like, when you delete an object, the neighbors of that object remove it/dont use it automatically

Is there a way to remove a neighbor without changing the neighbor count of each of the neighbors?
like, when you delete an object, the neighbors of that object remove it/dont use it automatically

I'll post some basic list removal code when I get up. I'm on my phone at the moment.

I'll post some basic list removal code when I get up. I'm on my phone at the moment.

Got a bit distracted. Anyway, here:

Code: [Select]
// remove neighbor object %target

for ( %i = 0 ; %i < %obj.neighbors ; %i++ )
{
    if ( %found )
    {
        %obj.neighbor[ %i ] = %obj.neighbor[ %i + 1 ];
    }
    else if ( %obj.neighbor[ %i ] == %target )
    {
        %found = true;
        %i--;

        continue;
    }
}

if ( %found )
{
    %obj.neighbors--;
    %obj.neighbor[ %obj.neighbors ] = "";
}

Code: [Select]
// remove neighbor index %index

for ( %i = %index ; %i < %obj.neighbors ; %i++ )
{
    %obj.neighbor[ %i ] = %obj.neighbor[ %i + 1 ];
}

%obj.neighbors--;
%obj.neighbor[ %obj.neighbors ] = "";

Now make an implementation that doesn't use nodes ;))

Added delayed searches.

This lets you search for a path in the background without freezing the game during it.
See this section of the documentation for further details:

http://github.com/portify/ts-pathing#delayed-searches
Oh, I didn't realize you added something new. That's pretty cool.

I've created a sort of simple script that lets you easily make the default holebots follow a path.

It's this simple:

%bot.findPath( %a, %b );

Or alternatively:

%bot.followPath( "8374 4758 2342 6856 4943" );

AIPlayer::findPath will return true or false depending on whether it successfully found a path or not.

Current issues:

  • Nodes must have a ::getPosition method.
  • No equivalent of AIPlayer::findPath for delayed searches.

Full code.

By the way, the holebot path following has reactive path following.
See the pathing section of http://www.valvesoftware.com/publications/2009/ai_systems_of_l4d_mike_booth.pdf for further details.
It doesn't have dynamic obstacle avoidance yet, although it's planned (which is why it only checks for $TypeMasks::FxBrickObjectType).

By the way, the holebot path following has reactive path following.
See the pathing section of http://www.valvesoftware.com/publications/2009/ai_systems_of_l4d_mike_booth.pdf for further details.
It doesn't have dynamic obstacle avoidance yet, although it's planned (which is why it only checks for $TypeMasks::FxBrickObjectType).
Oh, fancy!

Oh, fancy!

Basically, when it follows a path, it does it like this:



I'm making a node editor tool to help people set up node networks.