SA-MP Forums Archive
NPC Artificial Intelligence - Shortest path algorithm - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP (https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: Screenshots and Videos (https://sampforum.blast.hk/forumdisplay.php?fid=21)
+--- Thread: NPC Artificial Intelligence - Shortest path algorithm (/showthread.php?tid=203747)



NPC Artificial Intelligence - Shortest path algorithm - Harry_Gaill - 27.12.2010

Hello there,
Here is a piece of insight to a project on which I have been working on lately. It is based off Dijkstra's algorithm and the idea behind this was to make a bot able to move in a realistic way, not just going straight lines.
I started working on this way back, when "Alex009" had released the NPC plugin. I failed the first time. I haven't given up though, I just haven't had the time to finish this one, but now I present the outcome.

The coordination, especially in turns is pretty rough. With a better level of detail (more nodes) you can achieve greater precision that in turn will look way smoother than this. Plus, a few minor optimizations are also required, but that's really nothing compared to what I have so far.

The set up:
YouTube


In use:
YouTube


EDIT:

The result, a crowded partyy:






AW: NPC Artificial Intelligence - Shortest path algorithm - Trooper[Y] - 27.12.2010

Nice Idea, indeed,
but this aint an AI...


Re: NPC Artificial Intelligence - Shortest path algorithm - Harry_Gaill - 27.12.2010

I have to draw you people somehow xd
But anyway, it's a wannabe AI then, named the thread the same as the project went by when started. Now when I re-continued I didn't really hesitate how to call it


Re: NPC Artificial Intelligence - Shortest path algorithm - lilswizy - 27.12.2010

Nice and i hope it will be more smooth on turns , etc.


Re: NPC Artificial Intelligence - Shortest path algorithm - rbN. - 28.12.2010

RELEASE IT D

(lol xD)


Re: NPC Artificial Intelligence - Shortest path algorithm - Harry_Gaill - 28.12.2010

Quote:
Originally Posted by lilswizy
View Post
Nice and i hope it will be more smooth on turns , etc.
I'll try to come up with an alternative way that gently chops off the corners and makes the bot walk on a curve shaped path when entering turns.

Until then, I will create and use a more detailed web/node map to make turns look better.


Re: NPC Artificial Intelligence - Shortest path algorithm - Hiddos - 28.12.2010

Whoa epic, nice script man


Re: NPC Artificial Intelligence - Shortest path algorithm - RyDeR` - 28.12.2010

Nice. I have a GPS System using that algorithm (dijkstra's) which works perfect.

Taking nodes is annoying so I retrieved all nodes from San Andreas in paths folder. But I don't understand the linking ID. Actually the ID which links a node to another like you did.
Do you have any idea?


Re: NPC Artificial Intelligence - Shortest path algorithm - Rac3r - 28.12.2010

Very interesting way of controlling the bots, good luck on perfecting it.


Re: NPC Artificial Intelligence - Shortest path algorithm - GaGlets(R) - 28.12.2010

Omg that algoritm (dijkstra) so haaardd. this would be perfect to make driving npc - taxis etc.. Keep up with good job.