Technical Implementation: Difference between revisions

From DominAnt
Line 5: Line 5:
= Calculations done (on colonies and inventory) =
= Calculations done (on colonies and inventory) =
== Every other minute ==
== Every other minute ==
For now calculations take place every other minute. r_nnn below is the ratio on that order setting. Using a linear model. This makes one colony "slow to turn" but by using many colonies it gets done faster. Use ar_worker=worker/(worker+warrior) in some formulas instead of r_worker to reflect the actual population.
For now calculations take place every other minute. r_nnn below is the ratio on that order setting and ar_nnn in the acyual ratio in the nest (may differ from setting). Using a linear model. This makes one colony "slow to turn" but by using many colonies it gets done faster. Use ar_worker=worker/(worker+warrior) in some formulas instead of r_worker to reflect the actual population.
* capacity += r_expand * ar_worker * const
* capacity += r_expand * ar_worker * const
* secret capacity += r_expand * ar_worker * r_secret * const  (NOTE: secret is a part of the capacity)
* secret capacity += r_expand * ar_worker * r_secret * const  (NOTE: secret is a part of the capacity)

Revision as of 06:53, 8 May 2019

Note: This page contains technical details, if you are new to this game, don't read it, at least not yet :-)

Warning: Information on this page may be out of date

Calculations done (on colonies and inventory)

Every other minute

For now calculations take place every other minute. r_nnn below is the ratio on that order setting and ar_nnn in the acyual ratio in the nest (may differ from setting). Using a linear model. This makes one colony "slow to turn" but by using many colonies it gets done faster. Use ar_worker=worker/(worker+warrior) in some formulas instead of r_worker to reflect the actual population.

  • capacity += r_expand * ar_worker * const
  • secret capacity += r_expand * ar_worker * r_secret * const (NOTE: secret is a part of the capacity)
  • workers += if (worker+warrior < capacity) r_breed * r_worker * const
  • warriors += if (worker+warrior < capacity) r_breed * r_warrior * const
  • food += min(capacity, (r_food * ar_worker - level) * (workers+warriors) * const), Gathering and eating, if r_food*ar_worker kept at level or above the food increase, else it decreases. Testing with level = 0.4. NOTE: Food can be negative, to affect how many dies in steps below.

Transform workers to warriors and vice versa

  • if (to many warriors compared to workers) warriors -= const, worker +=const , i.e. if ar_worker > r_worker + 0.01
  • if (to many workers compared to warriors) warriors += const, worker -=const , i.e. if ar_worker < r_worker - 0.01

Starving:

  • if (food < 0) workers += food*ar_workers, warriors += food*(1-ar_workers)
  • if (workers + warriors < 2) colony is dead

Decaying.

  • food turn bad, slowly decreases? -= const similar to setting 1%?

Decaying both inhabited and not inhabited

  • if (capacity > 10 or not inhabited) capacity slowly decreases -= const similar to setting 1%?
  • if (capacity < 2 and not inhabited) nest is broken and destroyed

Every 10 minutes

  • Animals at colonies eat and destroy.
  • Food in inventory slowly decay.
  • Each warrior in inventory eat 0.01 food (if available), i.e. 0.06 per hour. (Comparison: They eat 0.1 per hour when in the colony)
  • Warriors in inventory without food decrease in number by both by 0.2% and 5 in actual numbers.

Network

  • Server controls what is on the map (the client shall not assume anything)

Client

  • Will have a service (or similar) run once per hour, or so, sending position (web or gcm). The pos is passivly get. I.e. if there is one, read it.

Client <-> Server

  • All actions are asynchronous
  • Send all waiting actions (in client) to one server script using a background thread.
    • The client application holds a list of actions waiting to be performed (with a generated serial id)
    • A json-list with actions
    • All actions have a serial number (unique to user and say 5 min?) and info on what to perform
    • If the action already took place (serial number) just send the updated info (for that action)
    • The server responds with apropriate data on all actions or error messages and also a part with new data (that might have been changed)
    • The client updates data and remove confirmed actions from the list of waiting actions
    • The client sends a new request with waiting actions (including those who where not confirmed)
  • Notification from server if nearby actions take place, the notifications shall contain enough data to update the info in the client (typically attacks)

Occurance of things

Animals

  • Amount of animals: Is currently linear to the number of colonies + the number of old energy bars (attracting bears)
  • Have a an (average) lifetime and disappears after that time (no matter if in inventory or on ground)
  • Show up on colonies with notification to owners

Food

  • Pretty evenly distributed on earth
  • Only visible on zoomed in.
  • If dropped, decrease and disappear after some time.
  • Math pattern having a fixed amount of food and a table with the removed ones (and dropped) and let the patters slowly slide/change in some way...
  • Where is it calculated?
    • One table with lat L,LL and long L,LL values showing where it has been added
    • One table with actual food items on the map. When picked up, they spawn after some time, or grow up again.
    • There are fixed areas where the food appear. (Maybe in the future: Over time the internal pos and location is changed. Two overlapping formulas or just one and a fix time when it is changed to the new. Once a week the removed resources are reset and the new ones appear?)