Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement skirmish game saves. #16419

Merged
merged 5 commits into from May 5, 2019

Conversation

@pchote
Copy link
Member

commented Apr 19, 2019

This PR enables save games for skirmishes after implementing IGameSaveTraitData on the bot modules.

Depends on #16411.

@pchote pchote force-pushed the pchote:skirmish-savegames branch from 6c15e7c to ab4ec93 Apr 20, 2019

@pchote

This comment has been minimized.

Copy link
Member Author

commented Apr 20, 2019

Updated - added saving and loading for skirmish observer viewports.

@pchote pchote force-pushed the pchote:skirmish-savegames branch from ab4ec93 to 617ae8c Apr 20, 2019

@reaperrr

This comment has been minimized.

Copy link
Contributor

commented Apr 20, 2019

Needs rebase now.

@pchote pchote force-pushed the pchote:skirmish-savegames branch from 617ae8c to 7eb35c8 Apr 20, 2019

@pchote pchote removed the PR: Rebase me! label Apr 20, 2019

@pchote

This comment has been minimized.

Copy link
Member Author

commented Apr 20, 2019

Rebased. This should now be much less intimidating to review :)

@reaperrr

This comment has been minimized.

Copy link
Contributor

commented Apr 23, 2019

Had that "no loading progress" issue again. RA, map Maelstrom, 4 bots and me as spectator.

@pchote

This comment has been minimized.

Copy link
Member Author

commented Apr 23, 2019

Was the game saved on the current version of the PR, or reloaded from an earlier version?

Can you please upload the orasav file?

@reaperrr reaperrr added this to the Next Release milestone Apr 25, 2019

@reaperrr

This comment has been minimized.

Copy link
Contributor

commented Apr 25, 2019

Was the game saved on the current version of the PR, or reloaded from an earlier version?

Pretty sure it was on this version, but not 100% sure.

Can you please upload the orasav file?

https://github.com/reaperrr/OpenRA/tree/broken-save

@pchote

This comment has been minimized.

Copy link
Member Author

commented Apr 25, 2019

That is very weird, the save file is missing data for frame 2, so the playback stalls indefinitely waiting for the orders that never arrive. The issue that triggers this must be inside GameSave.DispatchOrders or the code that calls it, so I don't think its related to this PR.

@reaperrr

This comment has been minimized.

Copy link
Contributor

commented Apr 25, 2019

Could this be caused by #16052?

@pchote pchote force-pushed the pchote:skirmish-savegames branch from 7eb35c8 to 81397dd Apr 25, 2019

@pchote

This comment has been minimized.

Copy link
Member Author

commented Apr 25, 2019

Could this be caused by #16052?

Good thinking, but not quite. Until the latest rebase this PR was based on bleed before that PR was merged. Your comment gave me the lead I needed to identify the real issue - which was exactly the bug that #16052 fixed!

The problem was triggered by order packets that started with an immediate order, which caused the check in DispatchOrders to ignore everything in the packet and break the order stream. This was obvious when it happened because these ignored packets had a non-zero frame number, which doesn't happen for normal immediate orders.

To quote myself from #16052: "Well derp, the old code was indeed obviously wrong."

This was tricky to reproduce in the first place because it relied on non-deterministic timing, but i'm fairly confident that rebasing on latest bleed will have fixed this.

@reaperrr

This comment has been minimized.

Copy link
Contributor

commented Apr 26, 2019

Got this while trying to save a 6-AI skirmish.

No savegame created.

OpenRA engine version {DEV_VERSION}
Red Alert mod version {DEV_VERSION}
on map e19510e03a0eda3f0a78e10c1e42f956453969da (Doughnut by hamb).
Date: 2019-04-26 13:15:00Z
Operating System: Windows (Microsoft Windows NT 6.2.9200.0)
Runtime Version: .NET CLR 4.0.30319.42000
Exception of type `System.NullReferenceException`: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
   bei OpenRA.Mods.Common.Traits.BotModules.Squads.Squad.Serialize() in d:\dev\OpenRA\OpenRA.Mods.Common\Traits\BotModules\Squads\Squad.cs:Zeile 92.
   bei OpenRA.Mods.Common.Traits.SquadManagerBotModule.<OpenRA.Traits.IGameSaveTraitData.IssueTraitData>b__10(Squad s) in d:\dev\OpenRA\OpenRA.Mods.Common\Traits\BotModules\SquadManagerBotModule.cs:Zeile 358.
   bei System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   bei System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   bei System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   bei OpenRA.Mods.Common.Traits.SquadManagerBotModule.OpenRA.Traits.IGameSaveTraitData.IssueTraitData(Actor self) in d:\dev\OpenRA\OpenRA.Mods.Common\Traits\BotModules\SquadManagerBotModule.cs:Zeile 356.
   bei OpenRA.World.RequestGameSave(String filename) in d:\dev\OpenRA\OpenRA.Game\World.cs:Zeile 523.
   bei OpenRA.Mods.Common.Widgets.Logic.GameSaveBrowserLogic.<>c__DisplayClass48.<Save>b__45() in d:\dev\OpenRA\OpenRA.Mods.Common\Widgets\Logic\GameSaveBrowserLogic.cs:Zeile 315.
   bei OpenRA.Mods.Common.Widgets.Logic.GameSaveBrowserLogic.Save(World world) in d:\dev\OpenRA\OpenRA.Mods.Common\Widgets\Logic\GameSaveBrowserLogic.cs:Zeile 330.
   bei OpenRA.Mods.Common.Widgets.Logic.GameSaveBrowserLogic.<>c__DisplayClass24.<.ctor>b__2() in d:\dev\OpenRA\OpenRA.Mods.Common\Widgets\Logic\GameSaveBrowserLogic.cs:Zeile 76.
   bei OpenRA.Mods.Common.Widgets.ButtonWidget.<.ctor>b__a(MouseInput _) in d:\dev\OpenRA\OpenRA.Mods.Common\Widgets\ButtonWidget.cs:Zeile 80.
   bei OpenRA.Mods.Common.Widgets.ButtonWidget.HandleMouseInput(MouseInput mi) in d:\dev\OpenRA\OpenRA.Mods.Common\Widgets\ButtonWidget.cs:Zeile 178.
   bei OpenRA.Widgets.Widget.HandleMouseInputOuter(MouseInput mi) in d:\dev\OpenRA\OpenRA.Game\Widgets\Widget.cs:Zeile 400.
   bei OpenRA.Widgets.Ui.HandleInput(MouseInput mi) in d:\dev\OpenRA\OpenRA.Game\Widgets\Widget.cs:Zeile 102.
   bei OpenRA.DefaultInputHandler.<>c__DisplayClass7.<OnMouseInput>b__6() in d:\dev\OpenRA\OpenRA.Game\Input\InputHandler.cs:Zeile 50.
   bei OpenRA.Sync.RunUnsynced[T](Boolean checkSyncHash, World world, Func`1 fn) in d:\dev\OpenRA\OpenRA.Game\Sync.cs:Zeile 182.
   bei OpenRA.DefaultInputHandler.OnMouseInput(MouseInput input) in d:\dev\OpenRA\OpenRA.Game\Input\InputHandler.cs:Zeile 50.
   bei OpenRA.Platforms.Default.Sdl2Input.PumpInput(Sdl2PlatformWindow device, IInputHandler inputHandler) in d:\dev\OpenRA\OpenRA.Platforms.Default\Sdl2Input.cs:Zeile 121.
   bei OpenRA.Platforms.Default.Sdl2PlatformWindow.PumpInput(IInputHandler inputHandler) in d:\dev\OpenRA\OpenRA.Platforms.Default\Sdl2PlatformWindow.cs:Zeile 334.
   bei OpenRA.Renderer.EndFrame(IInputHandler inputHandler) in d:\dev\OpenRA\OpenRA.Game\Renderer.cs:Zeile 164.
   bei OpenRA.Game.RenderTick() in d:\dev\OpenRA\OpenRA.Game\Game.cs:Zeile 677.
   bei OpenRA.Game.Loop() in d:\dev\OpenRA\OpenRA.Game\Game.cs:Zeile 794.
   bei OpenRA.Game.Run() in d:\dev\OpenRA\OpenRA.Game\Game.cs:Zeile 812.
   bei OpenRA.Game.InitializeAndRun(String[] args) in d:\dev\OpenRA\OpenRA.Game\Game.cs:Zeile 255.
   bei OpenRA.Program.Main(String[] args) in d:\dev\OpenRA\OpenRA.Game\Support\Program.cs:Zeile 37.
@pchote

This comment has been minimized.

Copy link
Member Author

commented Apr 26, 2019

Do you have the replay from that game?

Edit: Ah nevermind, I bet this is because the target actor was already dead.

@pchote pchote force-pushed the pchote:skirmish-savegames branch from 81397dd to aa2039d Apr 26, 2019

@pchote

This comment has been minimized.

Copy link
Member Author

commented Apr 26, 2019

Fixed.

@matjaeck
Copy link
Contributor

left a comment

This save point replay of a skirmish game on the latest revision of this PR crashes when it is almost loaded:

OpenRA engine version {DEV_VERSION}
Red Alert mod version {DEV_VERSION}
on map 3fcca6fe322b77e12ef3b965a44f6f71feac34fb (Mass Confliction by Nuke'm Bro.).
Date: 2019-04-27 21:19:48Z
Operating System: Linux (Unix 4.15.0.47)
Runtime Version: Mono 5.20.1.19 (tarball Thu Apr 11 09:02:17 UTC 2019) CLR 4.0.30319.42000
Exception of type `System.NullReferenceException`: Object reference not set to an instance of an object
  at OpenRA.Mods.Common.Traits.BotModules.Squads.Squad..ctor (OpenRA.Traits.IBot bot, OpenRA.Mods.Common.Traits.SquadManagerBotModule squadManager, OpenRA.Mods.Common.Traits.BotModules.Squads.SquadType type, OpenRA.Actor target) [0x0001f] in <038e78e4d6734379add7e3e1f39950e2>:0 
  at OpenRA.Mods.Common.Traits.BotModules.Squads.Squad.Deserialize (OpenRA.Traits.IBot bot, OpenRA.Mods.Common.Traits.SquadManagerBotModule squadManager, OpenRA.MiniYaml yaml) [0x000ac] in <038e78e4d6734379add7e3e1f39950e2>:0 
  at OpenRA.Mods.Common.Traits.SquadManagerBotModule.OpenRA.Traits.IGameSaveTraitData.ResolveTraitData (OpenRA.Actor self, System.Collections.Generic.List`1[T] data) [0x0028b] in <038e78e4d6734379add7e3e1f39950e2>:0 
  at OpenRA.World.Tick () [0x00066] in <c159506b19684c1fa30cdf1328bff380>:0 
  at OpenRA.Game.InnerLogicTick (OpenRA.Network.OrderManager orderManager) [0x00201] in <c159506b19684c1fa30cdf1328bff380>:0 
  at OpenRA.Game.LogicTick () [0x0004a] in <c159506b19684c1fa30cdf1328bff380>:0 
  at OpenRA.Game.Loop () [0x000e0] in <c159506b19684c1fa30cdf1328bff380>:0 
  at OpenRA.Game.Run () [0x0003c] in <c159506b19684c1fa30cdf1328bff380>:0 
  at OpenRA.Game.InitializeAndRun (System.String[] args) [0x00010] in <c159506b19684c1fa30cdf1328bff380>:0 
  at OpenRA.Program.Main (System.String[] args) [0x00044] in <c159506b19684c1fa30cdf1328bff380>:0 

replays.zip
savegame.zip

@pchote pchote force-pushed the pchote:skirmish-savegames branch from aa2039d to 69d6868 Apr 27, 2019

@pchote

This comment has been minimized.

Copy link
Member Author

commented Apr 27, 2019

Crash was caused by trying to restore bot state during a replay, where bots are not active. Fixed by adding an explicit replay check.

@pchote

This comment has been minimized.

Copy link
Member Author

commented May 4, 2019

Is anything blocking review here?

@reaperrr
Copy link
Contributor

left a comment

One minor thing (not a blocker if it's not an easy fix): When loading a replay via 'Watch' the loading screen still says 'Loading Saved Game', the load screen doesn't differentiate here.

Apart from that, looks good to me.

@pchote

This comment has been minimized.

Copy link
Member Author

commented May 4, 2019

I'm not sure what we should be showing in that case. "Loading replay" isn't really more or less correct - we are replaying the loading of the save game.

@reaperrr

This comment has been minimized.

Copy link
Contributor

commented May 4, 2019

OK, let's just leave it like that then.

@matjaeck
Copy link
Contributor

left a comment

Can't find any issue here, looks all good to me.

@reaperrr reaperrr merged commit 5e38cfd into OpenRA:bleed May 5, 2019

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@pchote pchote deleted the pchote:skirmish-savegames branch Aug 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.