Hey everyone,
i'm dealing with a question about speed. I'm coding a pathfinding Library (for my own use, but i'm making it extremely easy-to-use... so maybe i'll put it in the CodeBase when it's done ). As some of you might know, pathfinding routines are often a very big pile of data and it take's pretty much CPU power to do a few search routines (for people who don't know what pathfinding is: it's just what is says, finding a path between point A and B, avoiding any obstacles)
Well okay, lot of talking but this is my question:
you can use functions to call a bunch of not-in-the-main-loop code, but you can also use subroutines with the gosub command. My current way of using things is that i put everything in functions and use them for my pathfinding. But are subroutines faster, or is there another way of making things more efficient? please let me know
P.s. for the few people who are interested about my pathfinding thing: It will be REALLY easy, something like the collision DLL by nuclearglory, maybe even a bit more easy (A): Just 1 command to initialize the entire pathfinding system. That command looks a bit like
Init_Pathfinding(X amount of tiles on the map, Z amount of tiles on the map, Size of the tile's, Amount of units that will use the pathfinding -> because every unit needs its own path storage array and some other stuff )
after that command, you're ready to go, this pathfinding is extremely usefull for use with matrices.
There will also be a function for pathfinding with multiple units, which works with a queue: all units that need a path are put into a queue, and the queue is then emptied one by one, and every unit that's thrown out of the queue will get a path and starts moving. This is all to prevent the system from calculating a lot of paths in one second, instead the job is spread over 1 or 2 seconds (if your dealing with lots of units, 100 or something, if you use 5 you will hardly notice this queue effect)
Oh yeah, and everything is A* pathfinding for who knows what that is. Damn this PS is long, this entire post is long, i'll f... off already ^^
Thanks for reading, if you're still there..
Juzt a dude who likez progging - Me loves RTS games