Skip to content

Prevent game from starting via checkboxes with unavailable map#20101

Merged
Mailaender merged 1 commit intoOpenRA:bleedfrom
PunkPun:checkbox-game-start
Sep 12, 2022
Merged

Prevent game from starting via checkboxes with unavailable map#20101
Mailaender merged 1 commit intoOpenRA:bleedfrom
PunkPun:checkbox-game-start

Conversation

@PunkPun
Copy link
Member

@PunkPun PunkPun commented Jul 4, 2022

Currently the player gets kicked from the multiplayer lobby

@PunkPun
Copy link
Member Author

PunkPun commented Aug 7, 2022

rebased

Copy link
Contributor

@AspectInteractive AspectInteractive left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good from here.

@PunkPun PunkPun force-pushed the checkbox-game-start branch 2 times, most recently from 93b0dc7 to f5fe68c Compare August 22, 2022 11:20
@Mailaender
Copy link
Member

Mailaender commented Aug 30, 2022

image

I can't reproduce the original issue. When I remove the map from the file system (why should I do that?) then the UI becomes inconsistent: The Start buttons leads to nowhere and the map search does not find the map even though it is on the resource center. Retry Search will find it. This pull request does not seem to solve any of that.

@PunkPun PunkPun force-pushed the checkbox-game-start branch 2 times, most recently from 83460ed to d0a560b Compare September 6, 2022 16:42
@PunkPun
Copy link
Member Author

PunkPun commented Sep 6, 2022

I can't reproduce the original issue.

When you click on ready instead of "starting the game" and then immediately kicking the player / everyone back to multiplayer lobby the game will simply not start. This fix doesn't allow the game to start in the first place

When I remove the map from the file system (why should I do that?) then the UI becomes inconsistent: The Start buttons leads to nowhere

Start button is disabled. I'm not sure what you mean

and the map search does not find the map even though it is on the resource center. Retry Search will find it. This pull request does not seem to solve any of that.

MapPreviewLogic needs a complete refactor. It's coded quite poorly IMO and I can't really trigger Retry Search without making it super hacky. For now I added a trigger to update MapCache on the Retry Search button. I'll have to add logic to search for last updated map with the refactor when I come to it

@PunkPun PunkPun added this to the Next release milestone Sep 6, 2022
@Mailaender
Copy link
Member

When I join a game, delete the map on both server and client and tick the ready checkboxes it now crashes the server:

/home/matthias/Entwicklung/OpenRA/mods/cnc/maps/master-alert.oramap was deleted
Exception of type `System.InvalidOperationException`: Sequence contains no matching element
   at System.Linq.ThrowHelper.ThrowNoMatchException()
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
   at OpenRA.Mods.Common.Server.LobbyCommands.CheckAutoStart(Server server) in /home/matthias/Entwicklung/OpenRA/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs:line 266
   at OpenRA.Mods.Common.Server.LobbyCommands.State(Server server, Connection conn, Client client, String s) in /home/matthias/Entwicklung/OpenRA/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs:line 293
   at OpenRA.Mods.Common.Server.LobbyCommands.InterpretCommand(Server server, Connection conn, Client client, String cmd) in /home/matthias/Entwicklung/OpenRA/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs:line 236
   at OpenRA.Server.Server.<>c__DisplayClass85_0.<InterpretServerOrder>b__0(IInterpretCommand t) in /home/matthias/Entwicklung/OpenRA/OpenRA.Game/Server/Server.cs:line 995
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
   at OpenRA.Server.Server.InterpretServerOrder(Connection conn, Order o)
   at OpenRA.Server.Server.InterpretServerOrders(Connection conn, Byte[] data) in /home/matthias/Entwicklung/OpenRA/OpenRA.Game/Server/Server.cs:line 931
   at OpenRA.Server.Server.ReceiveOrders(Connection conn, Int32 frame, Byte[] data) in /home/matthias/Entwicklung/OpenRA/OpenRA.Game/Server/Server.cs:line 892
   at OpenRA.Server.Server.ConnectionPacketEvent.OpenRA.Server.Server.IServerEvent.Invoke(Server server) in /home/matthias/Entwicklung/OpenRA/OpenRA.Game/Server/Server.cs:line 1474
   at OpenRA.Server.Server.<>c__DisplayClass54_0.<.ctor>b__2(Object _) in /home/matthias/Entwicklung/OpenRA/OpenRA.Game/Server/Server.cs:line 361
   at System.Threading.Thread.StartCallback()

Unhandled exception. System.InvalidOperationException: Sequence contains no matching element
   at System.Linq.ThrowHelper.ThrowNoMatchException()
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
   at OpenRA.Mods.Common.Server.LobbyCommands.CheckAutoStart(Server server) in /home/matthias/Entwicklung/OpenRA/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs:line 266
   at OpenRA.Mods.Common.Server.LobbyCommands.State(Server server, Connection conn, Client client, String s) in /home/matthias/Entwicklung/OpenRA/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs:line 293
   at OpenRA.Mods.Common.Server.LobbyCommands.InterpretCommand(Server server, Connection conn, Client client, String cmd) in /home/matthias/Entwicklung/OpenRA/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs:line 236
   at OpenRA.Server.Server.<>c__DisplayClass85_0.<InterpretServerOrder>b__0(IInterpretCommand t) in /home/matthias/Entwicklung/OpenRA/OpenRA.Game/Server/Server.cs:line 995
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
   at OpenRA.Server.Server.InterpretServerOrder(Connection conn, Order o)
   at OpenRA.Server.Server.InterpretServerOrders(Connection conn, Byte[] data) in /home/matthias/Entwicklung/OpenRA/OpenRA.Game/Server/Server.cs:line 931
   at OpenRA.Server.Server.ReceiveOrders(Connection conn, Int32 frame, Byte[] data) in /home/matthias/Entwicklung/OpenRA/OpenRA.Game/Server/Server.cs:line 892
   at OpenRA.Server.Server.ConnectionPacketEvent.OpenRA.Server.Server.IServerEvent.Invoke(Server server) in /home/matthias/Entwicklung/OpenRA/OpenRA.Game/Server/Server.cs:line 1474
   at OpenRA.Server.Server.<>c__DisplayClass54_0.<.ctor>b__2(Object _) in /home/matthias/Entwicklung/OpenRA/OpenRA.Game/Server/Server.cs:line 361
   at System.Threading.Thread.StartCallback()
./launch-game.sh: Zeile 35: 225450 Abgebrochen             (Speicherabzug geschrieben) ${RUNTIME_LAUNCHER} ${ENGINEDIR}/bin/OpenRA.dll Engine.EngineDir=".." Engine.LaunchPath="${LAUNCHPATH}" ${MODARG} "$@"

@PunkPun
Copy link
Member Author

PunkPun commented Sep 12, 2022

That's a weird crash. @teinarss mentioned that host will always be client 0. But in your case client 0 didn't exist. I handled it but I may be able to handle it better if I knew why client 0 didn't exist

@Mailaender Mailaender merged commit 43e0cca into OpenRA:bleed Sep 12, 2022
@Mailaender
Copy link
Member

Changelog

@PunkPun PunkPun deleted the checkbox-game-start branch September 12, 2022 18:20
@anvilvapre
Copy link
Contributor

Note there is a difference between Connection.LocalClientId is not the same as Player.Index.

Game.IsHost shows this.

It can be confusing to see IsHost, IsAdmin, clientIndex 0 and clientAt being used to get an admin. And connection and player also having an index field(?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants