A question regarding groups

Started by
1 comment, last by Zahlman 18 years ago
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.
Advertisement
make that DOUBLY linked list. More memory, but faster!
A JPEG is worth a thousand and twenty four DWORD's. ;)
Note: Due to vacationing my website will not be updated till late-August. Of course I still have internet, but who wants to program during a vacation?
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.

This topic is closed to new replies.

Advertisement