Jump to content
  • Advertisement
Sign in to follow this  
Gaj

A question regarding groups

This topic is 4588 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 sorry for the atrocious topic title, but it's late over here. My question is essentially this: It's been a while since I've tried programming a game - I have since been learning algorithm design, fascinating stuff - and I would like to try something a little different. No graphics yet, and I won't even try getting to those yet. What I'm trying to do is simulate a large group of "units" (I'm an RTS junkie...) using data structures, and I'm curious as to the best way of going about this. Weee... So, this is what I have so far: I have a class "unit", a wonderfully inventive name, which holds various data such as "attack", "defense", and other some military wordstuffs. I also have a class group, which is, as you may guess, a group of units via linked list. What I want to eventually try is have a method whereby you pass a group as a parameter, all the individual units' data are accessed, and various random algorithms chug through them. So, is a "unit" class, and then a group class (which, I hasten to remind, is just a linked list) the best way of going about this? Or is there are more practical way? Thank you very much, Gaj.

Share this post


Link to post
Share on other sites
Advertisement
Can a group do anything that isn't representable in terms of actions of the units? Does it need to store any "statistical" information for example? If not, you should probably just be passing around the containers of groups.

Note the word "container". Don't implement a linked list yourself. And don't assume "linked list" is the only or best way to represent these groupings of unknown size.

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!