Jump to content
  • Advertisement
Sign in to follow this  

Looking for Architecture help.

This topic is 2832 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to make a program that have entities traverse a node graph (I believe that's the term) in C++. Here's a simplified mock-up of the graph:


The problem I'm having is figuring out how to represent the graph in code, or atleast, the connections. I can pseudo-code it as:


I can't see how to make this work with a 2D array, as making the connections from G and H seem impossible.
But does that mean to have the entities move around the graph, would I have the NODE class hold or reference itself? i.e.

class NODE

// other things

std :: vector<NODE> connected;

For an example of what I want to happen with this program, let's say an entity starts out at node E. It then is told to move, so it moves to node C. It is told to move again, and it moves to node H.

To restate my question: How would I represent a node graph with odd connections in C++?

Please note that this program is not looking for some goal, it is merely moving the entities around. Please trust me that it has a purpose in the final version of the program.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!