bugBos Wars - Bugs: bug #41967, Resource Usage Not Exact

 
 

bug #41967: Resource Usage Not Exact

Submitted by:  Doug <zerted>
Submitted on:  Wed 26 Mar 2014 10:44:32 PM UTC  
 
Severity:  3 - Normal Item Group:  Bug
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 08 Apr 2014 04:23:04 AM UTC, comment #1:

adaptive-rates-1.diff makes resource spending and harvesting rates adaptive. This patch isn't perfect, but it almost always fails safely. Meaning it never needs more than expected costs to build or train something and will never harvest less than expected. However, it may finish building early or harvest more than expected.

New Issues:

Issue 1) Buildings are completed one step early. Example: A power station requires 900 energy and 150 magma and that's all the resources a payer has. An engineer builds it at a rough rate of 40 energy and 11 magma. However the power station will be completed with 40 energy and 11 magma left in storage instead of the expected zero resources left. This is safer than the previous behavior (being unable to finish due to running out of magma), but is still incorrect.

Unresolved Issues:

Issue 1) Putting more engineers on a repair job changes the amount of resources used for the job (reduces the amount of non-primary resources needed).

Issue 2) When efficiency isn't at 100% resource usage can be off due to rounding.

(file #31135)

Doug <zerted>
Wed 26 Mar 2014 10:44:32 PM UTC, original submission:

A power plant is supposed to require 900 energy and 150 magma to create, but in a custom map with only 900 energy and 150 magma, the engineer runs our of magma before the power plant is built. The effects are also seen when having multiple engineers building the same building. See #bos 2014-03-20 (http://colabti.org/irclogger/irclogger_log/bos?date=2014-03-20)

The core of the issue is rounding in player.cpp's CalculateRequestedAmount().

Options
1) Always use max rates for each resource types until that we've spent the expected amount of resources - That's not how we want the game to feel.
2) Reduce usage rates to their greatest common factor - Might be surprising and unintuitive to some players.
3) Switch to floating point calculations - Will cause sync issues in multi-player.
4) Switch to fixed point integers.
5) Adaptive utilization rates at each step. Example: If the rate should be 4.3 for energy, have twice 4 and once 5.

Workaround) Adjust unit costs to reduce rounding errors

Doug <zerted>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #31135:  adaptive-rates-1.diff added by zerted (10KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by zerted (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-04-08 zerted Attached File- => Added adaptive-rates-1.diff, #31135

    Back to the top


    Powered by Savane 3.3