diff --git a/core/src/com/unciv/UncivGame.kt b/core/src/com/unciv/UncivGame.kt index 74abaeb374..0952c9517e 100644 --- a/core/src/com/unciv/UncivGame.kt +++ b/core/src/com/unciv/UncivGame.kt @@ -40,28 +40,34 @@ class UncivGame(val version: String) : Game() { lateinit var ruleset:Ruleset override fun create() { + // If this takes too long players, especially with older phones, get ANR problems. + // Whatever needs graphics needs to be done on the main thread, + // So it's basically a long set of deferred actions. + // We probably could make this better by moving stuff that we can to another thread but ehhhhhhh + Current = this - ruleset = Ruleset(true) + Gdx.app.postRunnable { + ruleset = Ruleset(true) - if(Gdx.app.type!= Application.ApplicationType.Desktop) - viewEntireMapForDebug=false - Gdx.input.setCatchKey(Input.Keys.BACK, true) - settings = GameSaver().getGeneralSettings() - if(settings.userId=="") { // assign permanent user id - settings.userId = UUID.randomUUID().toString() - settings.save() - } - if (GameSaver().getSave("Autosave").exists()) { - try { - loadGame("Autosave") - } catch (ex: Exception) { // silent fail if we can't read the autosave - startNewGame() + if (Gdx.app.type != Application.ApplicationType.Desktop) + viewEntireMapForDebug = false + Gdx.input.setCatchKey(Input.Keys.BACK, true) + settings = GameSaver().getGeneralSettings() + if (settings.userId == "") { // assign permanent user id + settings.userId = UUID.randomUUID().toString() + settings.save() } - } - else setScreen(LanguagePickerScreen()) + if (GameSaver().getSave("Autosave").exists()) { + try { + loadGame("Autosave") + } catch (ex: Exception) { // silent fail if we can't read the autosave + startNewGame() + } + } else setScreen(LanguagePickerScreen()) - thread { startMusic() } - isInitialized=true + thread { startMusic() } + isInitialized = true + } } fun startMusic(){