delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/08/20:14:08

Message-ID: <004901be69c9$072598c0$ed9d2bd1@puter>
From: "Juff" <sw AT tenforward DOT com>
To: "djgpp" <djgpp AT delorie DOT com>
Subject: need some help on game dev.
Date: Mon, 8 Mar 1999 17:06:13 -0800
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.72.3110.1
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Reply-To: djgpp AT delorie DOT com

This is a multi-part message in MIME format.

------=_NextPart_000_0046_01BE6985.F87470A0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

hey--
im developing (er, trying?) a strategy game...annnnnnnndd,
im having trouble with one little thing, since im new to this
whole *game* dev thing i was wondering how the heck i=20
would store shipz, here's an example--

say ive got my scout ship--

class scout_ship {
private:
int shields; /* shield state */
int hull;      /* hull state */
=20
public:

int damage_scout(int scout_damage_modf); /*this would check to see if =
shields failed, if so, damage hull */

/************
well the list could go on, but basically ive got my ship class...
**************/
};

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...

so do i have to hurt my brain and just boggle through this strange =
array, or is there
a much much much better way of keeping track of all these???

thanks!






------=_NextPart_000_0046_01BE6985.F87470A0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#c0c0c0>
<DIV><FONT color=3D#000000 size=3D2>hey--</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>im developing (er, trying?) a =
strategy=20
game...annnnnnnndd,</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>im having trouble with one little =
thing, since=20
im new to this</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>whole *game* dev thing i was =
wondering how the=20
heck i </FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>would store shipz, here's an=20
example--</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>say ive got my scout =
ship--</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>class scout_ship {</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>private:</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>int shields; /* shield state =
*/</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>int =
hull;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* hull=20
state */</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>&nbsp;</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>public:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>int damage_scout(int =
scout_damage_modf); /*this=20
would check to see if shields failed, if so, damage hull */</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>/************</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT><FONT size=3D2>well the list =
could go on,=20
but basically ive got my ship <U>class</U>...</FONT></DIV>
<DIV><FONT size=3D2></FONT><U></U><FONT =
size=3D2>**************/</FONT></DIV>
<DIV><FONT size=3D2>};</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>so, say player x has 300 scouts, how =
the heck do=20
i keep track of all those?</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT><FONT size=3D2>i thought of a =
double array,=20
but jeez, there'z GOT to be a better way than having</FONT></DIV>
<DIV><FONT size=3D2>a multilayered array, it would also be inefficiant =
since the #=20
of ships a person could</FONT></DIV>
<DIV><FONT size=3D2>have would be limited to how many layers of an array =
i had=20
say, i wanted them to be able to</FONT></DIV>
<DIV><FONT size=3D2>have 1,000 ships, well, from what i know, if i used =
an array,=20
i would have to say--</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#000000 =
size=3D2>arrray_O_ships[10][100];</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT><FONT =
size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>but that gets confusing...</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>so do i have to hurt my brain and just boggle =
through this=20
strange array, or is there</FONT></DIV>
<DIV><FONT size=3D2>a much much much better way of keeping track of all=20
these???</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>thanks!</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0046_01BE6985.F87470A0--

- Raw text -


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