1. A* Pathfinding Module

If you would like to know what the A* algorithm is and does.
http://en.wikipedia.org/wiki/A%2A

This is a module for developers, it allows them to use the A* pathfinding algorithm easily. Using a waypoint like system.
This will always find the shortest path along those waypoints.

Features:
[list][*]Waypoint Editor.[/list]
Module function list:
[list][*]astar.CreateSolver[/list]
Object function list.
[/list]
Block functions:
Block functions are a way to tell the pathfinder whether or not you can travel from a -> b.

Default functions:
[list][*]astar.BLOCKFUNC_TRACE_WORLD[*]astar.BLOCKFUNC_TRACE_ALL[/list]
Example block function:
```BLOCKFUNC_TRACE_WORLD =	function( a, b )

local trace = {
start = a.position,
endpos = b.position,

};
local tr = util.TraceLine( trace );

return tr.Hit;

end```

AddLink will return false if the two nodes in question are already linked in some fashion. Everything was moved into the Solver class. That means you will now do

`mysolver:FindPath( [node/pos], [node/pos], [optional block function] );`
Useful x 1 (list)

2. Ooooh, fancy. Could prove to be useful

3. And here comes the Lua AI.
Dumb x 1 Agree x 1 (list)

4. How interesting - time for some SNPC

5. Wicked.
Will be used.

6. I wonder, is it possible using something similar to the dodgeball or something, if you can make a bouncy ball just randomly choose a number/waypoint, then it will head to it going from point to point to get here, then once it reaches it it will choose another random one and just randomly roam the map...hmmm.

7. Oh fucking yes! YES!

8. Now we need an easy targeting system.

9. Now lua make AI for NPC? Cool!

11. A* is a nifty path-finding algorithm. It won't help you create AI, only to help the AI find their way along pre-determined paths. If you'd like to know more about A*, check here.

By the way Jinto, I'm not sure many of the lua developers here know what A* is or what it means. I wouldn't know myself if I didn't have such a fascination with all things AI. :)

12. ...So..if I understand this right this lets you, or will let you make new or better ai paths in the maps? *shrugs* or make paths within the map so they can get around the contraptions you make, or run along them? *shrugs* I'm mixed up.

13. Nice work Jinto!

14. I'll just explain this...
Imagine a bunch of points scattered around the map.
Now, between those points are paths, or lines (If there's nothing between those two points ofcourse).
You're going to set up those points yourself.

Now imagine a Z-formed corridor. This corridor is filled with points.
There's an NPC at the start of the corridor that have to reach the other end by going from point to point.
Ofcourse it'll have to choose the shortest path through those points,
'cause we can't have it make a random zig-zag through the corridor.
This program takes those points and calculates the shortest possible path.
That's useful if you want an NPC to, for example, find it's way through a maze or another set of obstacles.

15. Very nice work! A* isn't too easy to implement at all...

16. Wow, awesome, it truly is. I'm gonna test that right now!

17. That algorithm is used in Unreal Tournament games for the bots I believe. Should be quite useful for RTS games too.

18. I can't fucking beleve one of my ideas was actually used!

19. Awesome stuff, You said "nodes" alot, and I understand that striders move with nodes you can create in the hammer, so does this script allow striders to move on the npc_go command?

20. FreeWilly posted:
Awesome stuff, You said "nodes" alot, and I understand that striders move with nodes you can create in the hammer, so does this script allow striders to move on the npc_go command?
No. Not even close.

A node is a place.

It won't make striders work. Those use path_corner entities.

This uses Lua nodes.

21. Nodes or points.
Really just a vector.

22. You are awesome. I am so going to use this, eventually. I like the idea of a roaming bouncy ball... I also have ideas in mind for assisting simple Strider, Gunship, and Apache AI (as well as other ground enemies).

23. Oh sorry because I was looking at a strider in the hammer and it had air nodes for the path.

24. Okay, cool, so I can make mah own paths now it seems >.> or if someone can make a simple to install mod so I can then yay

25. It's a shame that I don't have an exact use for this yet, because this is pretty cool looking.

26. This could be used to make new NPC's that walk around, or a turret that hovers around, etc. It's pretty damn amazing.

27. I hope you can at least make a basic waypoint editor that has maybe visual stuff too it, I accualy love to do pathing and stuff for maps..*shrugs*

28. http://forums.facepunchstudios.com/s...d.php?t=257272
>.>
<.<

time for a combine guard Snpc?

29. This would help me greatly in a gamemode i'm making, however...

Does anyone happen to have a copy?

This would help me greatly in a gamemode i'm making, however...

Does anyone happen to have a copy?

31. Sexy, Shame nobody is using it.

32. Ouch! My brain!

33. Nice but... whatever happened to that "industry leading AI" thing all Source games supposedly already have? Can't NPCs already find their way around maps that have their nodes made out?

34. NPCs made in the Source Engine yes, but not so easily Lua coded ones.

35. What kind of lua created NPCs can there be that can't simply inherit from an existing Source NPC? You shouldn't be having to reinvent the wheel here.

What kind of lua created NPCs can there be that can't simply inherit from an existing Source NPC? You shouldn't be having to reinvent the wheel here.
There are uses for it outside of NPCs. I didn't create it because I felt I had to, I did because I wanted to.

37. This could be useful if it got incorporated into wiremod.

38. Jinto posted:
There are uses for it outside of NPCs. I didn't create it because I felt I had to, I did because I wanted to.
I could see this being used to make some cool laser weapon effect, like from some animes where the beams will bend around obstacles instead of going thought them.

39. Cool

What kind of lua created NPCs can there be that can't simply inherit from an existing Source NPC? You shouldn't be having to reinvent the wheel here.
Yes in the case of NPCs you will. Let's say you wanna script an murderous box, in that case, creating a npc_rebel (for example) and setting his model to a box and a bunch of other stuff isn't really the optimal way of doing it. That NPC is made to behave like a rebel, which probably will do, unless you set a shitload of modifiers, and that will probably still present problems.

If you had the real sourcecode you could easily derive the base NPC, add stuff to it and more or less there wouldn't be a limit to what you could do. But we just have Lua and the NPCs that are already there doesn't work in every scenario.