Page: [root]/code/rustorion/technical/units | src | faq | css

Unit design

If something needs a unit (like distance, speed, resource amount), take a smallest amount that can be considered useful in gameplay, and make it 1 unit. If unit is produced from other units, make it relative to 1 other units.

Resulting unit should still be divisible to microunits (1e-6). When using Units struct, this is how a unit works by default. Maximum possible amount of a unit stored in a variable then is ~9 trillion (i64 max being 9e18, 1e6 for microunits, 9e12 left).

Various relations between units (e.g. EC produced by 1 mil humans) should be stored as f64 (pondering Ratio) until calculated down to final amount of units being used to add or subtract.


Powered by bitcheese wiki engine