Archived

This topic is now archived and is closed to further replies.

BulletProofMonkey

Suggestions for waypoint Stucts

Recommended Posts

I am doings a 2D tile scroller, and away to implement way points for my Agents, working in C and looking for inspuration for my waypoint structs to be able to go onto the processor for them. If any one has any cool ideas or simple suggestions I would be gratefull. cheers! "Be the Monkey!"

Share this post


Link to post
Share on other sites
Start with a struct that has X,Y locations. Create an STL list container that has pointers to the struct above. When building the list, you push_back on the list. When traversing the waypoints you check the front item. When it is reached, you pop_front. When displaying the entire sequence of waypoints, you traverse the list from front to back. When double-checking the validity of the path, you can start at the front and traverse the list. If you need to insert a new waypoint in the middle for navigational purposes, you can insert a new *struct at the correct position.

Dave Mark - President and Lead Designer
Intrinsic Algorithm -
"Reducing the world to mathematical equations!"

Share this post


Link to post
Share on other sites
Yeh, unfortunatly using C++ isn''t "hardcore" enough so i''m limeted to using C. I have a linked list struct all setup nice and neat. I figured that x and y coords would feature, just i seen crazy old man "theMothe" and his stucts feature stuff like way point names and other cazy stuff like that, just wondering if any one has any cool ideas that i could use in a stuct, i.e if the player has been there resently, so my agents would go into there search modes at that point, just silly fun stuff like.

Cheers for replying!

"Be the Monkey!"

Share this post


Link to post
Share on other sites
quote:
Original post by BulletProofMonkey
Yeh, unfortunatly using C++ isn''t "hardcore" enough...
For what/who?

quote:
i seen crazy old man "theMothe" and his stucts feature stuff like way point names and other cazy stuff like that, just wondering if any one has any cool ideas that i could use in a stuct

That''s not what you asked for, however. What you put in there is entirely up to how you want to design the game. If you want a list of where the player has been, make one. *shrug* Don''t choose a tool and then figure out how to use it, figure out what you want to do and then build/use a tool that makes it work.



Dave Mark - President and Lead Designer
Intrinsic Algorithm -
"Reducing the world to mathematical equations!"

Share this post


Link to post
Share on other sites
Sorry buddy, yeh the hardware I am working on is limeted to C, by "not hardcore enough" I was just joking, obviously not funny, soz.

All I simply want is info and suggestions for a way point struct. Keeping in mind i am limited to C and this is for a 2D game.


Cheery Cheers!

Share this post


Link to post
Share on other sites
As Dave has already indicated, the attributes of your data structure entirely depend on your game and the information that is pertinent to the path, rather than the agent. Obviously, each waypoint needs to include a set of coordinate values, so that it can be ordered according to some plan. Other than that, the only other semi-essential attribute is an ID that can be used to look up the waypoint in whatever structure you use to store the sequence of waypoints corresponding to a path.

Of course, if you actually mean node instead of waypoint (as may be found in a search graph for pathfinding), then yes, there is other information you would want to store; e.g., partial path costs, pointers to child nodes in the tree, pointer to parent node, list of available actions at this node, etc.

More information about the actual problem you are trying to solve would greatly assist people in helping you. Giving a single sentence stating that you''re writing a game in C and want to know what to put in your waypoints is not going to generate much of a response for you.

Timkin

Share this post


Link to post
Share on other sites