unitdefs inconsistency running spring.exe vs springlobby

unitdefs inconsistency running spring.exe vs springlobby

Discuss your problems with the latest release of the engine here. Problems with games, maps or other utilities belong in their respective forums.

Moderator: Moderators

Post Reply
raaar
Metal Factions Developer
Posts: 1095
Joined: 20 Feb 2010, 12:17

unitdefs inconsistency running spring.exe vs springlobby

Post by raaar »

I've been told my game crashes on singleplayer when run through weblobby.

I test my game using springlobby's singleplayer mode and it works.

I confirmed the problem, it's a "attempt to compare number with string" error when processing unitdefs_post and doing this

Code: Select all

	...
	local mv = unitDef.maxvelocity
	if (mv and mv > 0) then               <---------------- fails here
		Spring.Echo(unitDef.name.." HERE! "..mv)
	...
I also get the error by running the spring 103 exe directly,

in the context of unitdefs_post , it seems it reads the unitdefs values as strings if run through the exe or weblobby, but reads them as floats when started through springlobby(edited)
[f=-000001] Stratos HERE! 4.80000019 <------ from springlobby
vs
[f=-000001] Stratos HERE! 4.8 <------ from exe/weblobby

i can fix it with a "tonumber(...)", but the fact that the exact same game package produces different results is disturbing
(same game, same map, same engine binary)
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: unitdefs inconsistency running spring.exe vs springlobby

Post by Kloot »

Compare "script.txt" generated by both lobbies with "_script.txt" generated by Spring when running standalone.
raaar
Metal Factions Developer
Posts: 1095
Joined: 20 Feb 2010, 12:17

Re: unitdefs inconsistency running spring.exe vs springlobby

Post by raaar »

you mean the "_script.txt" on my spring data directory, right?

_script_binary.txt
from running spring.exe 103.0
(440 Bytes) Downloaded 11 times
_script_springlobby.txt
springlobby
(1.08 KiB) Downloaded 16 times
_script_weblobby.txt
weblobby
(628 Bytes) Downloaded 9 times

the mod options change, there's nothing about unit restrictions, and the unitdef where the issue first showed up was processed in all three cases.

(these were generated after the fix)
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: unitdefs inconsistency running spring.exe vs springlobby

Post by Kloot »

the mod options change
Precisely, and what relation exists between unitdefs_post, the mod-option (string) "velocitymult" and the line referencing (number) unitDef.maxvelocity?
raaar
Metal Factions Developer
Posts: 1095
Joined: 20 Feb 2010, 12:17

Re: unitdefs inconsistency running spring.exe vs springlobby

Post by raaar »

ah, that's why it worked through springlobby, having that option made it replace that attribute with the number value in unitdefs_post before reaching that code block.

Lua auto-converts when multiplying string with number, but throws an error if it's a comparison.
Post Reply

Return to “Help & Bugs”