General question about handling many references of some objects

  • Thread starter Thread starter Crirus
  • Start date Start date
C

Crirus

I have this game application:
A top clas called Game
A class called Player.
Game class have lots of instances of Player
Player have lots of instances of Unit, wich is base clas for every unit a
player create.
The same for Building.. etc

At a certain point, I have to run ... say a battle calculation and take in
account all this objects...

Can you tell me some good ways to handle all this, flexible and easy?
I'm asking how to maintain all this references in some arrays or specialized
classes I didnt discovered yet in net etc..

Thanks,
Cirrus
 
Crirus said:
Can you tell me some good ways to handle all this, flexible and easy?
I'm asking how to maintain all this references in some arrays or specialized
classes I didnt discovered yet in net etc..

It's an interesting question. You could probably find something on a game
developer's site (not in vb.net but a "strategy") but I think you may need
to reaccess your strict hierarchy of objects.

The Game object should probably be maintaining the "state" of everything so
it would have collections of players, units, buildings, the time of day,
etc. It is also the only way I can think of that one player could know
where the other player is. Every object can communicate with itself and
"the Game" which represents the environment.

Is that the sort of thing you're looking for?

Tom
 
you might want to have a look at this thread
From: "Kishor" Subject: Question Related to Inheritance( multiple)
Date: Thu, 30 Oct 2003 12:42:36 +0530

eric
 
Kind of but not only...
I look for tehnical hints on wich is the best way to organise the
comunication between this sort of objects, given this specifics

Crirus
 
Well, I just found myself CollectionBase and builded a specific type
colection with it as base
Seems the thread pointed confirmed me I'm walking the right way:)
Thanks

Crirus
 
Crirus said:
Kind of but not only...
I look for tehnical hints on wich is the best way to organise the
comunication between this sort of objects, given this specifics

Hmmm... it sounds like a question about the best way to implement the
inner-workings of a game. You might try taking a look at some of the
game-building sites (for instance) http://www.flipcode.com/

They have code and people there who design games all the time. You're
likely to get good information and they would know the trade-offs between
various implementations. I read "Flights of Fantasy" years ago which
demonstrates how to write a flight simulator but I doubt there is a .Net
version planned.

Tom
 
Well, the game issue is only for a practical exercice... the main issue is
to make all this classes working together.. not what types should I have in
game :)

Crirus
 
Anyway, I'm loking for a way to design only once that collection class and
instantiate it for particular types...
 
Back
Top