View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
---|---|---|---|---|---|---|---|---|---|
0005543 | Spring engine | General | public | 2017-05-06 16:47 | 2017-05-19 21:50 | ||||
Reporter | lamer | ||||||||
Assigned To | hokomoko | ||||||||
Priority | normal | Severity | major | Reproducibility | always | ||||
Status | resolved | Resolution | fixed | ||||||
Product Version | 103.0 +git | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0005543: Save/load is broken by maps with predefined units/features | ||||||||
Description | On savefile loading Spring executes map's lua. It can create start units (that may be destroyed before save action occured). And savefile already has actual state of those units (dead or alive). | ||||||||
Steps To Reproduce | Play on Gunmetal Harbor and use save/load mechanics. http://springfiles.com/spring/spring-maps/gunmetal-harbor-1 | ||||||||
Additional Information | Seems ZK's сrutches with destroying all units (https://github.com/ZeroK-RTS/Zero-K/blob/0374d05a15bb5ef94195ef69204c278bdf2d6d15/LuaRules/Gadgets/api_saveload.lua#L514) and then creating new unitIDs (https://github.com/ZeroK-RTS/Zero-K/blob/0374d05a15bb5ef94195ef69204c278bdf2d6d15/LuaRules/Gadgets/api_saveload.lua#L224) is the way to go at the moment. But it breaks AI loading without additional crutches like passing old unitID in unitRulesParam: can't associate data with unit. | ||||||||
Tags | No tags attached. | ||||||||
Checked infolog.txt for Errors | |||||||||
Attached Files |
|
![]() |
|
lamer (reporter) 2017-05-06 17:26 |
I'm unsure if there's ultimate solution. Disabling Spring.CreateUnit/Spring.CreateFeature until gadget::Load(zip) was executed may produce unexpected results because people don't check results of CreateUnit/CreateFeature usually. Maybe additional Spring.IsSaveLoading() may atleast give opportunity to maps with predefined units to support save/load. |
Kloot (developer) 2017-05-06 23:55 Last edited: 2017-05-07 00:02 |
with some work Spring.Destroy* could be extended to force releasing an object's id immediately, guaranteeing Spring.Create*(savedObjectID) calls would always succeed. atm I can't consider this a high priority issue though. |
hokomoko (developer) 2017-05-08 11:19 |
I think a good approach is to only call PreGame and GameStart when the game isn't loaded from a save. |
Google_Frog (reporter) 2017-05-10 04:27 |
Be aware that using PreGame and GameStart like this will require some backwards compatibility changes. Whether an existing gadget/widget initializes in PreGame, GameStart, Initialize (or even GameFrame or Update) seems to be up personal preference/cargo cult. This is not much of an extra gameside problem since games already require extensive changes to implement save/load. I'm worried about map compatibility, the thing that this feature would be primarily designed to fix. |
hokomoko (developer) 2017-05-10 06:02 |
Well you can't eat the cake and leave it whole... |
silentwings (reporter) 2017-05-11 14:29 |
> Whether an existing gadget/widget initializes in PreGame, GameStart, Initialize (or even GameFrame or Update) seems to be up personal preference/cargo cult. This is not really true. It matters e.g. if you want units to be created "as though they are part of the map", if you have interaction with startpoint placing & team selection, if you need contact with other gadgets or use the action handler ... etc etc. Possibly there are also gadget authors who were inexperienced enough to make a random choice when there is one; imho the solution there is that such people should not be writing synced code. |
hokomoko (developer) 2017-05-19 21:16 |
Fix 46f3180620e3a323f3fbbb901f7f6ccd9250b5b0 committed to develop branch: Maintain synced callin consistency through save/load (Fix 0005543) GameStart and GamePreload won't be called when a saved game is loaded, repo: spring changeset id: 8230 |
hokomoko (developer) 2017-05-19 21:48 |
Fix f9933f0b645a973d6642022d04bdabc2331bcbf4 committed to develop branch: Maintain synced callin consistency through save/load (Fix 0005543) GameStart and GamePreload won't be called when a saved game is loaded, repo: spring changeset id: 8231 |
![]() |
|||
Date Modified | Username | Field | Change |
---|---|---|---|
2017-05-06 16:47 | lamer | New Issue | |
2017-05-06 17:26 | lamer | Note Added: 0017559 | |
2017-05-06 23:55 | Kloot | Note Added: 0017560 | |
2017-05-06 23:59 | Kloot | Note Edited: 0017560 | View Revisions |
2017-05-07 00:02 | Kloot | Note Edited: 0017560 | View Revisions |
2017-05-08 11:19 | hokomoko | Note Added: 0017565 | |
2017-05-10 04:27 | Google_Frog | Note Added: 0017588 | |
2017-05-10 06:02 | hokomoko | Note Added: 0017591 | |
2017-05-11 14:29 | silentwings | Note Added: 0017602 | |
2017-05-19 21:16 | hokomoko | Changeset attached | => spring develop 46f31806 |
2017-05-19 21:16 | hokomoko | Note Added: 0017664 | |
2017-05-19 21:16 | hokomoko | Assigned To | => hokomoko |
2017-05-19 21:16 | hokomoko | Status | new => resolved |
2017-05-19 21:16 | hokomoko | Resolution | open => fixed |
2017-05-19 21:48 | hokomoko | Changeset attached | => spring develop f9933f0b |
2017-05-19 21:48 | hokomoko | Note Added: 0017665 | |
2017-05-19 21:50 | hokomoko | Changeset removed | spring develop 46f31806 => |