0 registered members (),
18,008
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: ez_path -- for alpha testing! Simple Pathfind
[Re: Samb]
#44614
04/24/05 18:52
04/24/05 18:52
|
Joined: Mar 2002
Posts: 580 San Francisco
clone45
OP
User
|
OP
User
Joined: Mar 2002
Posts: 580
San Francisco
|
Samb, I guess that one of the benefits in helping test out is that you get your wish! I've added the ability to turn off the "line of sight" portion of the pathfinding. I can't imagine many times you'd want to turn this off, but a pacman game is a good example! Here's how to turn it off: pf_use_los(0);Here's an example: Code:
function main() { warn_level = 0; // This is necessary!
// Open the pathfinding .dll. Do this before the level loads so that entities // can reference the pathfinding .dll in their actions. Otherwise, the entity // actions can start running before the pathfinding .dll has loaded, resulting // in an error.
pathfind_handle = dll_open("pathfind.dll");
wait(3); level_load(level_str); wait(2);
pf_use_los(0); // turn off LOS pathfinding step
// Initialized pathfinding nodes. Do this after the level loads. The // .dll function pf_initialized() returns 1 when the pathfinding has completed // initialization.
pf_init_nodes();
}
Also, I updated ez_path.wdl to contain the new .dll function prototypes. You can get the new package at http://www.gamebeep.com/freebies/ez_path_src.zipEnjoy! - Bret
|
|
|
Re: ez_path -- for alpha testing! Simple Pathfind
[Re: clone45]
#44615
04/24/05 20:55
04/24/05 20:55
|
Joined: Mar 2002
Posts: 580 San Francisco
clone45
OP
User
|
OP
User
Joined: Mar 2002
Posts: 580
San Francisco
|
Hello again! If I have time in the future, I might attempt to add some optional dynamic A* pathfinding into the ez_path package. Basically, the logic would be: Code:
if (path blocked) { switch to a* pathfinding to reach next destination }
However, this would require that TONS of little pathfinding entities be added to the level. That's the only easy way I could think of implementing it. On the bright side, you wouldn't need to configure the nodes. Also, I'd use a radius of A* nodes in respect the player's position, which could keep the computations down to a reasonable amount. For really basic levels, it would be possible to assume there's a flat 2d grid that A* could use. But for complicated levels (think Tomb Raider), I can't think of a way that the A* nodes could be determined at runtime. They would require manual placement. (The node placement might not need to be this dense.)Any feedback? Do you think this would be a good feature to add? Thanks!! - Bret
|
|
|
Re: ez_path -- for alpha testing! Simple Pathfind
[Re: clone45]
#44617
04/25/05 01:36
04/25/05 01:36
|
Joined: Nov 2000
Posts: 1,534 hamburg
Samb
Serious User
|
Serious User
Joined: Nov 2000
Posts: 1,534
hamburg
|
thanks clone three things: 1. the engine freezes at start. if I reduce the node the engine doesn't freeze 2. If I move the target, the following guy is confused and go some werid ways 3. the engine can't find the new function here's the level with a really simpel and useless movement script http://www.sinn-los.de/level2.zip
|
|
|
Re: ez_path -- for alpha testing! Simple Pathfind
[Re: Samb]
#44618
04/25/05 01:57
04/25/05 01:57
|
Joined: Mar 2002
Posts: 580 San Francisco
clone45
OP
User
|
OP
User
Joined: Mar 2002
Posts: 580
San Francisco
|
Thanks for the feedback. Ok, I'm working on it!! It's possible that I didn't include the most up-to-date .dll. I think I did. But maybe I screwed up. In any case, even in the most recent version, you're bug #2 still exists: 2. If I move the target, the following guy is confused and go some werid waysI'll work on this over the next day or two. Hopefully I'll be able to post a solution shortly. In the meantime, I've updated the .zip file to ensure it contains the new .dll. One again, that's at: http://www.gamebeep.com/freebies/ez_path_src.zipSorry about the bugs. I didn't have the freezing issue on my machine. I'll try to figure out what's going on with that. - Bret
|
|
|
Re: ez_path -- for alpha testing! Simple Pathfind
[Re: clone45]
#44619
04/25/05 06:30
04/25/05 06:30
|
Joined: Mar 2002
Posts: 580 San Francisco
clone45
OP
User
|
OP
User
Joined: Mar 2002
Posts: 580
San Francisco
|
Great news!! Ok, I found two major bugs in the pathfinding routine and cleaned them up. The bugs were: 1. I was forgetting to clear one of the node "visited" flags, which caused the pathfinding to break down over time. 2. I had to introduce a more reasonable default for "maximum path search depth", as the nearly infinite search depth took a huge amount of time. The maximum search depth is now 9 nodes. This should speed things up considerably. It can be changed like this: pf_set_max_path(15); (Samb, I would suggest putting your search depth at around 16 for the pacman game.) 3. I simplified the routine that finds the "closes first node". I might have to revisit this portion of the code again later. OK!! The new file is in place and ready for download! Again, sorry for all the bugs, but you know what they say: "Never let a coder test their own code." Let me say, too, if I ever sell a "professional version", everyone who's helping me out will get a free copy. http://www.gamebeep.com/freebies/ez_path_src.zipCheers! - Bret
|
|
|
|