ethanmoffat / EndlessClient

An open source client for Endless Online written in C#
MIT License
34 stars 16 forks source link

Crashes/visual glitches when transitioning between game states #305

Closed ethanmoffat closed 1 year ago

ethanmoffat commented 1 year ago

There are some weird issues when adding many components to the monogame game components collection. Sometimes, character info panels will not be displayed or not all components will be added. Sometimes there are crashes ("failed to compare two elements in the array) from monogame.

image

I suspect this is due to the call to add components happening somewhat concurrently with the call to remove old components. Some of the new components get caught up in the removal.

The plan is to try and add some locking mechanism around the game's components collection when modifying it during game state transitions. In-game doesn't seem to have issues with adding new components, it's just when the huge batch of components changes between states in the pre-game menus and transitoning to in-game, so the change can probably be limited to the control set code.