NaN bug

NaN bug

Classic game design, maintained to please you...

Moderator: Content Developer

Post Reply
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

NaN bug

Post by Tobi »

Someone in #main made me aware of a bug in either Spring or BA. It appeared to be BA.

The problem is that if you reclaim a feature with 0 metal and 0 energy, the feature will change to give NaN m/e (rez bot) or -2147483648 m/e (commander). During reclaiming the resource bar may also display an energy pull of -nan.

How to reproduce: Load therockjungle and reclaim some shrubs.

I suspect the bug is in here (LuaRules/Gadgets/unit_reclaim_fix.lua):

Code: Select all

local resource = math.max(FeatureDefs[featureDefID].metal,FeatureDefs[featureDefID].energy)
local newpercent = select(5,GetFeatureResources(featureID)) - ((((resource * oldformula) * 6) - (resource * newformula)) / resource)
Since there are no checks there for resource == 0 (or reclaimtime == 0).
User avatar
Wombat
Posts: 3379
Joined: 15 Dec 2008, 15:53

Re: NaN bug

Post by Wombat »

true ! i had same and also on this map, i noticed it appears while making circle on own base :x uber annoying anyway
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: NaN bug

Post by CarRepairer »

I'm pretty sure that's a feature. Those are NaN jungle shrubs of the tropical region of Northern England.
User avatar
TheFatController
Balanced Annihilation Developer
Posts: 1177
Joined: 10 Dec 2006, 18:46

Re: NaN bug

Post by TheFatController »

I wouldn't have expected AllowFeatureBuildStep to be called by the engine in this scenario since there is no build step to allow, however I'll fix this next rev.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: NaN bug

Post by hoijui »

still present in 7.14 (testing with spring RC), used the same map.
User avatar
Jazcash
Posts: 5309
Joined: 08 Dec 2007, 17:39

Re: NaN bug

Post by Jazcash »

Yeah, this is why I always hated playing The Rock Jungle...
User avatar
Wombat
Posts: 3379
Joined: 15 Dec 2008, 15:53

Re: NaN bug

Post by Wombat »

remove fucked trees which give -1 e/m ?

ARRRTTTTTTTURIIIIIIII
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: NaN bug

Post by hoijui »

fixed version of LuaRules/Gadgets/unit_reclaim_fix.lua

the commander icons also still need fixing.
looks like most icons are now under LuaUI/Icons as PNG, and the commander ones are still under icons as TGA, and LuaUI/Widgets/unit_customicons.lua will need adjusting too.
Attachments
unit_reclaim_fix.lua
(1.82 KiB) Downloaded 112 times
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: NaN bug

Post by knorke »

is this related?
look at ressource bar. i was speccing a game when that happend, it only happend for a few seconds but numerous times. once with ebar too.
Attachments
ba_bug_res_bar.jpg
(456.05 KiB) Downloaded 3 times
Post Reply

Return to “Balanced Annihilation”