View Issue Details

IDProjectCategoryView StatusLast Update
0003508Spring engineGeneralpublic2013-02-27 03:17
Reporterabma Assigned Toabma  
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionno change required 
Summary0003508: engine should kill units having invalid death animations after some time when hp == 0
Descriptionthis would disallow invulnerable units...
TagsNo tags attached.
Attached Files
20130226_000127_Ravaged_v2_92.0-37-g5d49df2 release.sdf.gz (Attachment missing)
Checked infolog.txt for Errors

Activities

abma

2013-02-26 01:56

administrator   ~0009922

not sure if this makes sense, if its hacky to implement, then no need to do so.

Kloot

2013-02-26 02:00

developer   ~0009923

how would you decide what an invalid death animation is?

abma

2013-02-26 02:03

administrator   ~0009924

lua crash? not existing?

Kloot

2013-02-26 02:07

developer   ~0009925

eh, be more specific please... "lua crash" can mean anything and the engine doesn't know about gadgets

abma

2013-02-26 02:15

administrator   ~0009926

my knowledge about death animations is like zero.

my idea is like that: (i hope its how it works)

death animations have a lua callin: if the luacode inside this callin crashes, remove the unit.

i guess thats:

scripts/*.lua

one of the callins...
(script.Killed / script.Create / ..?)

Kloot

2013-02-26 02:23

developer   ~0009927

.Killed yes, but checking that function isn't enough (because it can spawn a thread and return early)

abma

2013-02-26 02:27

administrator   ~0009928

the cause for this idea was:

[f=0006462] Error: LuaRules::RunCallIn: error = 2, UnitCreated, [string "LuaRules/Gadgets/ai_cai.lua"]:3262: attempt to index field '?' (a nil value)
stack traceback:
    [string "LuaRules/Gadgets/ai_cai.lua"]:3262: in function 'ProcessUnitCreated'
    [string "LuaRules/Gadgets/ai_cai.lua"]:3405: in function 'UnitCreated'
    [string "LuaRules/gadgets.lua"]:1300: in function <[string "LuaRules/gadgets.lua"]:1298>
    (tail call): ?

and a bit later:

[f=0008129] Error: LuaRules::RunCallIn: error = 2, UnitFinished, [string "LuaRules/Gadgets/ai_cai.lua"]:3390: attempt to index field '?' (a nil value)
stack traceback:
    [string "LuaRules/Gadgets/ai_cai.lua"]:3390: in function 'UnitFinished'
    [string "LuaRules/gadgets.lua"]:1308: in function <[string "LuaRules/gadgets.lua"]:1306>
    (tail call): ?

(thats Zero-K 1.1.2.12)

see demo

abma

2013-02-26 02:28

administrator   ~0009929

but yeah, thats a gadget, so i guess its not possible to implement that?!

Kloot

2013-02-26 02:38

developer   ~0009930

so what you want is for the engine to remove a unit entirely (extreme measure) if a gadget callin like UnitCreated causes an error no matter what?

abma

2013-02-26 02:49

administrator   ~0009932

for example:
https://github.com/spring/spring/blob/develop/rts/Lua/LuaHandle.cpp#L798

replace:
UnitCreated()
with
RunUnitCallInTraceback()

in all functions where first parameter is CUnit...
and in RunUnitCallInTraceback do as usual, but call UnitDestroyed on error / remove the unit when it failed in UnitDestroyed.

thats my idea :)

if that sucks, please close this request, thanks!

Kloot

2013-02-26 03:31

developer   ~0009933

Last edited: 2013-02-26 03:33

be careful not to create inconsistencies (calling UnitDestroyed directly from UnitXYZ means the engine and Lua will no longer agree on which units are present in the simulation)

Google_Frog

2013-02-26 11:33

reporter   ~0009939

Does this idea have a purpose besides making the engine workaround broken gadgets which should be fixed game side? I don't think the engine should provide such an invasive safety net for gadget crashes because it sounds like there will be situations in which the engine triggers it's safety net when nothing bad has occurred. I don't like this change because it sounds dangerous.

I may have this wrong because I don't see how UnitCreated is relevant to this.

Here is something which could be done (I don't know if it is already implemented). There could be a type of Spring.DestroyUnit which does not do script.killed.

abma

2013-02-27 03:17

administrator   ~0009945

@Kloot:

thanks for explaining, sounds for me like it would lead to much more worse problems if implemented.

@Google_Frog:

if really needed create a new report please.

Issue History

Date Modified Username Field Change
2013-02-26 00:42 abma New Issue
2013-02-26 00:44 abma Severity major => feature
2013-02-26 00:44 abma Summary engine should kill units with have invalid death animations after some time => engine should kill units having invalid death animations after some time
2013-02-26 01:55 abma Summary engine should kill units having invalid death animations after some time => engine should kill units having invalid death animations after some time when hp == 0
2013-02-26 01:56 abma Note Added: 0009922
2013-02-26 02:00 Kloot Note Added: 0009923
2013-02-26 02:03 abma Note Added: 0009924
2013-02-26 02:07 Kloot Note Added: 0009925
2013-02-26 02:15 abma Note Added: 0009926
2013-02-26 02:23 Kloot Note Added: 0009927
2013-02-26 02:27 abma Note Added: 0009928
2013-02-26 02:28 abma File Added: 20130226_000127_Ravaged_v2_92.0-37-g5d49df2 release.sdf.gz
2013-02-26 02:28 abma Note Added: 0009929
2013-02-26 02:38 Kloot Note Added: 0009930
2013-02-26 02:49 abma Note Added: 0009932
2013-02-26 03:31 Kloot Note Added: 0009933
2013-02-26 03:33 Kloot Note Edited: 0009933
2013-02-26 11:33 Google_Frog Note Added: 0009939
2013-02-27 03:17 abma Note Added: 0009945
2013-02-27 03:17 abma Status new => closed
2013-02-27 03:17 abma Assigned To => abma
2013-02-27 03:17 abma Resolution open => no change required