Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! Clones, Extensions, Modding » Stars! Nova - Development » Need to move away from using names as IDs
Re: Need to move away from using names as IDs Sat, 25 June 2011 07:28 Go to previous messageGo to previous message
Daniel is currently offline Daniel

 
Chief Warrant Officer 3
Stars! Nova developer
Stars! Nova developer

Messages: 179
Registered: April 2006
Location: Nowra, Australia
Musmuris wrote on Sat, 25 June 2011 21:09


We can either make strings (like "1/1", "1/2") I tend to prefer ints - and use the (e.g) high 8 bits for empire ID and the rest for the counter. This allows for 128 empires with 16 million IDs each. To get the Empire ID just && with 0xFF000000 and the ID && with 0x00FFFFFF. I.e. start numbering Empires at 0x01000000 and go up from there (no need it has to start at 1!)




As we do not need to squeeze out every last bit of memory here we can avoid the trickery of bit stuffing and use two ints, one for the empireId and one for the fleetNumer/shipDesignNumber/starbaseDesignNumber. Otherwise we might run into trouble when people accidently use logical-and instead of bitwise-and.



Have fun.

Report message to a moderator

 
Read Message icon4.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message icon14.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Turn year
Next Topic: Orders overwriting Star Data
Goto Forum:
  


Current Time: Thu May 02 14:01:18 EDT 2024