Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / a litle waypoint problem

Author
Message
Coder#05
19
Years of Service
User Offline
Joined: 26th Oct 2005
Location: Denmark
Posted: 29th Apr 2006 23:27 Edited at: 29th Apr 2006 23:31
hey, ive got a litle problem in some thing im making(just playing with some stuff).
only one "enemy" is following its waypoints, this is the first enemy loaded in.
ive made a waypoint editor, to place waypoints this is the routine that loads the positions in(nothing wrong with this(i hope)).


this is the function that opdates to the next waypoint(i think that this is were the problem is)


then the function for making the enemy face the next waypoint
i think im gonna do this using vectors later on, anyway:


this is then called in the function that moves the enemys


BTW. ive searched the forum and did find some thing about waypoints,
so rigth now(when im done writeing this) im reading a paper called A* Pathfinding for Beginners by By Patrick Lester

the problem is that only enemy one, is moving. if i add any more enemy's they just move to their first waypoint and stay there.
if i change variable current_waypoint(number?) in the cli(the variable that holds the waypoint that the enemy is supposed to be heading for) to the next waypoint in its path, then it moves to that waypoint and turns around and moves back to its firstwaypoint. ah?

thx to any one who might figure it out.

BTW: (again)
im using the trail version of dbproo, have ordered the boxed version and got a mail that it was on its way yeah! hehe

sorry for my english typeing

Still a noob. easy comes easy goes
Tinkergirl
21
Years of Service
User Offline
Joined: 1st Jul 2003
Location: United Kingdom
Posted: 1st May 2006 13:13 Edited at: 1st May 2006 13:17
Right, whew - that was confusing

I think your problem may lie in the fact that when you load in your waypoints (in "prepare_enemy_path_data:") you close the file after every enemy.

This means that when you run down the list for the first baddie, all is well. Then the second baddie starts at the top of the file again (because you close and reopen the file) it gets the same information - BUT their start waypoint (set by the variable "wp") is much bigger than it should be. Is your first waypoint 0,0,0? Because I'd imagine that the 'empty' waypoints it's trying to create (with add to queue) would be empty and set to 0,0,0.

So, they're all using the same path/waypoints, only the start waypoint is too big so their path never increases.

You'd be better opening the file to read outside your baddie loop, and only closing it when you're finished.

At least, that's what I think's going wrong. It's hard to tell from unrunnable code. Hope that helps.

[edit] I should have said though - excellent progress for someone only on the trial. You've done this before, I can tell
Coder#05
19
Years of Service
User Offline
Joined: 26th Oct 2005
Location: Denmark
Posted: 3rd May 2006 03:41
Thx for trying to help me out

eh no my first waypoint aint 0,0,0 its 600,20,730 or some thing
Before i enter the main loop, i set the enemys start position to their first waypoint(and they do start at that position they just dont move away from it, but i checked and all the positions are read in, and if i change current_waypoint(enemyNumber) to lets say number 6, the secund enemy do move to waypoint number 6, but instead of moving on to waypoint 7, it turns, and walk back to its first waypoint).

The fact is that every path is in its own file.
path1

path2


notice the 1,2,3,4+ numbers that are read in, i dont use them. changed to use the variable wp in-stead. so in enemy 2s path waypoint 5 is the first waypoint.

i know that makes a lot of files if your gonna have allot off enemys. and i think I'm gonna redo it. but not before i can get them to follow their waypoints .

Again thx alot for trying to help me out.


Finnaly got read that paper today. think im gonna try making some-thing like that later on .

Still a noob. easy comes easy goes
Tinkergirl
21
Years of Service
User Offline
Joined: 1st Jul 2003
Location: United Kingdom
Posted: 3rd May 2006 16:16
Hm, oh yeah - sorry. Didn't read the line with the open file bit properly. Sorry.

Can I ask what you're doing when you call get_next_waypoint?
Quote: "current_waypoint(id-1)=get_next_waypoint(id-1,id-1,ox#(id),oy#(id),oz#(id))"

Specifically, the id-1 confuses me - does id in that case mean something else to what it means when it's in the get_next_waypoint function?

Sorry I couldn't help so far. I take it you've tried printing out all the waypoints that an agent thinks it has? *shrugs* I'm afraid I'm just clutching straws.
Coder#05
19
Years of Service
User Offline
Joined: 26th Oct 2005
Location: Denmark
Posted: 5th May 2006 04:56
Finally got it solved. the problem was that , the totalWaypoints() variable, didn't get opdated. only for the first enemy.
I should have seen this earlier, but i was confessed that the problem where in the routine that opdates the waypoints hehe

anyway the problem where in prepare_enemy_path_data
new code


thx for taking time to help me

Still a noob. easy comes easy goes

Login to post a reply

Server time is: 2024-11-26 21:30:27
Your offset time is: 2024-11-26 21:30:27