delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/09/10:11:00

Date: Tue, 9 Mar 1999 10:10:55 -0500
Message-Id: <199903091510.KAA23215@delorie.com>
To: djgpp AT delorie DOT com
From: ListMaster <listserv AT delorie DOT com>
Subject: Re: Re: need some help on game dev.
Reply-To: djgpp AT delorie DOT com

Please be aware that listmaster AT delorie DOT com is usually not the right
address to send e-mail to.  It is intended to be a place where
listserv *errors* go to, not requests.  If you want to subscribe
or unsubscribe from a list, use listserv AT delorie DOT com.  If you are
having problems with a list, use <list>-request AT delorie DOT com.

Send a "help" or "longindex" message to listserv AT delorie DOT com for
more information.

Thanks,
The Delorie Software List Server
listserv AT delorie DOT com



------ Your original message follows
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