It is currently Sun Apr 18, 2021 9:39 am


The forum is READ ONLY. Please direct any future discussions to our Facebook page


 Page 1 of 1 [ 2 posts ] 
Author Message
 Post subject: Colonist Reproduction Changed...
PostPosted: Sun Feb 26, 2006 4:23 am 
Developer
Developer
User avatar

Joined: Wed Feb 19, 2003 6:07 pm
Posts: 2930
Colonist reproduction has always had the same problem as planetary interest. The more you have the faster you gain more. Basically it makes the production insanely huge.

We have changed the colonist production so it works in a similar manner as credit production. The closer you get to the maximum number of colonists your planet can support at its current tech level the slower your colonists will reproduce.

If your planet has 10% of the maximum number of colonists your planet can support then your colonists reproduction increases at 90% of the normal rate.

If you planet has 80% of the maximum number of colonists your planet can support then your colonists reproduction increases at 20% of the normal rate.

This should slow down the colonists reproduction rate considerably when the planets start getting close to being full.

For those of you curious as to how we are doing this, this is the technical and boring part, here is the single Mysql query we use.

Quote:
UPDATE {$db_prefix}planets SET

organics=GREATEST(organics + (LEAST(colonists, $colonist_limit + ($colonist_tech_add * ((fighter + sensors + beams + torp_launchers + shields + jammer + cloak) / 7))) * $prate[colonists] * ($prate[organics] * organics_planet) * prod_organics / 100.0 * $expoprod) - (LEAST(colonists, $colonist_limit + ($colonist_tech_add * ((fighter + sensors + beams + torp_launchers + shields + jammer + cloak) / 7))) * $prate[colonists] * $organics_consumption * $expoprod), 0),

ore=ore + ((LEAST(colonists, $colonist_limit + ($colonist_tech_add * ((fighter + sensors + beams + torp_launchers + shields + jammer + cloak) / 7))) * $prate[colonists]) * ($prate[ore] * ore_planet) * prod_ore / 100.0 * $expoprod),

goods=goods + ((LEAST(colonists, $colonist_limit + (
$colonist_tech_add * ((fighter + sensors + beams + torp_launchers + shields + jammer + cloak) / 7))) * $prate[colonists]) * ($prate[goods] * goods_planet) * prod_goods / 100.0 * $expoprod),

energy=energy + ((LEAST(colonists, $colonist_limit + ($colonist_tech_add * ((fighter + sensors + beams + torp_launchers + shields + jammer + cloak) / 7))) * $prate[colonists]) * ($prate[energy] * energy_planet) * prod_energy / 100.0 * $expoprod),

colonists= LEAST((colonists + (colonists * ($colonist_reproduction_rate * (1 - (colonists / ($colonist_limit + ($colonist_tech_add * ((fighter + sensors + beams + torp_launchers + shields + jammer + cloak) / 7)))))) * $expoprod)), $colonist_limit + ($colonist_tech_add * ((fighter + sensors + beams + torp_launchers + shields + jammer + cloak) / 7))),

credits=LEAST(credits + (((LEAST(colonists, $colonist_limit + ($colonist_tech_add * ((fighter + sensors + beams + torp_launchers + shields + jammer + cloak) / 7))) * $prate[colonists]) * $credits_prate * ((100.0 - prod_organics - prod_ore - prod_goods - prod_energy - prod_fighters - prod_torp - prod_research - prod_build) / 100.0) * $expoprod) * (1.0 + ((credits / max_credits) * $production_multiplier))), max_credits)

WHERE

(organics + (LEAST(colonists, $colonist_limit + ($colonist_tech_add * ((fighter + sensors + beams + torp_launchers + shields + jammer + cloak) / 7))) * $prate[colonists] * $prate[organics] * prod_organics / 100.0 * $expoprod) - (LEAST(colonists, $colonist_limit + ($colonist_tech_add * ((fighter + sensors + beams + torp_launchers + shields + jammer + cloak) / 7))) * $prate[colonists] * $organics_consumption * $expoprod) >= 0)


That one query updates every single planets production. :) And yes it gives me a headache to look at it.

The highlighted and underlined portion of the query is what limits the colonists reproduction based upon how close to maxing the total number of colonists the planet supports.



_________________
PJ's Annoyingly Useless Blog
ADOdb Lite
Template Lite
Offline
 Profile  
 
 Post subject:
PostPosted: Sun Feb 26, 2006 11:16 am 
AA Trader
AA Trader

Joined: Wed Apr 14, 2004 1:02 pm
Posts: 217
Yet another good idea. Thanks for listening and thinking a solution through PJ.


Offline
 Profile  
 
Display posts from previous:  Sort by  
 Page 1 of 1 [ 2 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

cron