Found a very odd econ bug.

Found a very odd econ bug.

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Found a very odd econ bug.

Post by Argh »

Basically, it's like this- if a Unit takes less than 1 SlowUpdate to build, then the Metal used is incorrect. The error increments, too- it's very odd.

To replicate this error will take a minute. I apologize for the imposition, but I'm in the middle of something, so I can't produce a test mod atm.

To replicate... set the WorkerTime of a Factory to 150... set the BuildTime on a Unit to 30. Make the Metal cost of the test Unit to be built at 75.

Something fishy is definitely going on. The metal reported came out like this:

917
835
753

Note the pattern here.

First it's off by quite a lot- 83 vs. 75, or 8.
Then it's off by 1 less, per Unit built. Second cycle is 15 off, third cycle is 22 off... and so forth and so on.

At any rate, I don't have the foggiest what's up with this, but I thought I should probably report it, as it's a very strange fish, and may have deeper implications in the sim.

If it corrected on the next update (which is something I see happen quite clearly), it'd be one thing... but it doesn't seem to correct at all, until I raised the BuildTime on the test Unit to 75 (one SlowUpdate). IOW, it's a real math error, not just a temporary disconnect between report and reality.

I can live with half-second build times, for what I'm working on. But that's a very strange math issue.
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: Found a very odd econ bug.

Post by Pressure Line »

its always been like that afaik. very low buildtimes do very funny things.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Found a very odd econ bug.

Post by KDR_11k »

http://spring.clan-sy.com/phpbb/viewtop ... =14&t=9371

The displayed M drain is of course a bit inaccurate when the factory starts and stops building rapidly.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Found a very odd econ bug.

Post by Argh »

Spring thinks it runs at 32 frames per second (actually 30 but that's another discussion). The minimum interval between two consecutive events is 1 frame or 1/32 of a Spring second. Nanospray is spawned once per frame if sudfficient ressources are available. A nanoparticle always costs the same to make for a construction and always contributes the same to the construction. That means if the buildtime of a unit is not an integral multiple of the builder's workertime divided by 32 the construction costs more than the fbi says it does. For many mods that rounding error is of no consequence but for some it could be important (e.g. if you have a fixed ressource allocation for a given time and want to make sure that allocation covers exactly a set of built units).
Ah... meh, I totally forgot about that. Thanks.
Post Reply

Return to “Engine”