cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/09/08:59:31

From: Airhead Zoom <airhead_zoom AT hetnet DOT nl>
X-Priority: Normal
To: djgpp AT delorie DOT com
Subject: Re: need some help on game dev.
X-Mailer: Pronto Pro [ver 1.00 (0225)Trio]
Mime-Version: 1.0
Message-ID: <026451054130939NET014S@hetnet.nl>
Date: 9 Mar 1999 14:54:10 +0100
Reply-To: djgpp AT delorie DOT com

Hello,

> so, say player x has 300 scouts, how the heck do i keep track of all those?
> i thought of a double array, but jeez, there'z GOT to be a better way than 
having
> a multilayered array, it would also be inefficiant since the # of ships a 
person could
> have would be limited to how many layers of an array i had say, i wanted them 
to be able to
> have 1,000 ships, well, from what i know, if i used an array, i would have to 
say--
> 
> arrray_O_ships[10][100];
> 
> but that gets confusing...

Hmmm.. I think this is the best question ever posed here. (since I subscribed)
I'm also very interested in game programming techniques like AI etc.
I like making source for that more than for devices or APIs.
I've had a moment's thought about it and I think you might do something like 
this..?
At least it doesn't eat memory when the ships aren't needed.

scout_ship *ship[65536];        // Or should this be 65535?

And when a new ship is added, just 'malloc' a new scout thing, like this:

ship [number] = malloc (sizeof (scout_ship));

(And

*ship[number]->hull--;

)

Don't worry about this maximum, an int/long won't go any further than this value 
(if I'm not mistaken?)
But I don't like this solution either....
Any suggestions?

PS I'm a bit confused. Is this combination of arrays/pointer ok?
Don't be mad @ me if it's wrong. I've been struggling with pointers from the 
moment I got to know about them
But if so, please reply and show me what is wrong!

Greetz,

Airhead Zoom of Dancing Pumpkin Productions

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019