Sesu8642 / FeudalTactics

Strategy game with countless unique and challenging levels.
GNU General Public License v3.0
79 stars 20 forks source link

Crash on skip first move #40

Closed awb95 closed 1 year ago

awb95 commented 1 year ago

The game sometimes crashes when you try to skip the Ai's first move. After restarting the game i can continue with my first move. Unfortunately, I could not reproduce the error permanently. I'm using v1.1.2

Sesu8642 commented 1 year ago

Thanks for reporting! I couldn't reproduce it so far but I will try to have a closer look.

d-albrecht commented 1 year ago

Hey,

I'm just hijacking this to report my own game crash (rather than re-opening my own crash report), because the game just crashed for me as I was re-generating a new random level.

I was on the level select screen and clicked the die a few times to find a playable/win-able starting position, and at one point, the game just closed/crashed.

FabulousOne commented 1 year ago

I have the same crash problems. I tried to catch logs. Could you look at them and tell me if they are helpful? If not I'll try again. Thanks for this nice little addicting game, @Sesu8642 !

feudal-tactics-logs-2023-02-25-14-16-09.zip

Sesu8642 commented 1 year ago

Thanks for the logs, @FabulousOne. There could be useful information in the logcat but the snipped you included doesn't unfortunately. I suspect the error looks something like this:

02-25 15:46:39.522 18950 18976 E AndroidRuntime: FATAL EXCEPTION: GLThread 952
02-25 15:46:39.522 18950 18976 E AndroidRuntime: Process: de.sesu8642.feudaltactics, PID: 18950
02-25 15:46:39.522 18950 18976 E AndroidRuntime: java.lang.RuntimeException: TEST
02-25 15:46:39.522 18950 18976 E AndroidRuntime:    at de.sesu8642.feudaltactics.FeudalTactics.create(FeudalTactics.java:34)
02-25 15:46:39.522 18950 18976 E AndroidRuntime:    at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:281)
02-25 15:46:39.522 18950 18976 E AndroidRuntime:    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1557)
02-25 15:46:39.522 18950 18976 E AndroidRuntime:    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1272)

I am not sure though. I need to put in some more work and make it easy for users to get debug information in crash situations.

FabulousOne commented 1 year ago

OK, I'll check and try again.

FabulousOne commented 1 year ago

@Sesu8642 check that, please:

feudal-tactics-logs-2023-02-26-18-24-44.zip

Sesu8642 commented 1 year ago

Thanks, @FabulousOne. This is exactly what I needed.

FabulousOne commented 1 year ago

😅

Sesu8642 commented 1 year ago

I fixed a bug that happened under these rather specific conditions:

  1. play a game that has a winner (indicated by a popup about one side giving up)
  2. play at least another turn
  3. exit the game to the main menu
  4. start a new game in which the player is not the first to do their turn

This would cause the game to crash when the first (human) player turn started because of some non-cleared information from the previous game. This is what I could find out from @FabulousOne's log but very likely also what happened to @awb95. @d-albrecht I need logs to analyze your crash - either from the console or logcat. I'm working on making it easier to get the logs in crash situations. It will be included in the next non-bugfix release.

d-albrecht commented 1 year ago
[de.sesu8642.feudaltactics.backend.ingame.GameController] generating a new game state with bot intelligence LEVEL_3 and MapParameters [humanPlayerNo=1, botPlayerNo=5, seed=1678650312305, landMass=150, density=0.0]
[de.sesu8642.feudaltactics.backend.ingame.GameController] generating a new game state with bot intelligence LEVEL_3 and MapParameters [humanPlayerNo=1, botPlayerNo=5, seed=1678650318025, landMass=150, density=0.0]
[de.sesu8642.feudaltactics.backend.ingame.botai.BotAi] the game crashed because of an unexpected exception
java.lang.NullPointerException: Cannot invoke "de.sesu8642.feudaltactics.backend.gamestate.Player.getType()" because the return value of "de.sesu8642.feudaltactics.backend.gamestate.GameState.getWinner()" is null
    at de.sesu8642.feudaltactics.frontend.ui.screens.IngameScreen.lambda$handleGameStateChange$4(IngameScreen.java:246)
    at de.sesu8642.feudaltactics.frontend.ui.screens.IngameScreen.render(IngameScreen.java:386)
    at com.badlogic.gdx.Game.render(Game.java:48)
    at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window.update(Lwjgl3Window.java:387)
    at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.loop(Lwjgl3Application.java:192)
    at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:166)
    at de.sesu8642.feudaltactics.desktop.DesktopLauncher.main(DesktopLauncher.java:22)

Before I read your request for a log, it crashed several times, after I had read it, it worked flawlessly for quite some time! But finally it crashed again. This was with commit: 7103128b8476f2cd80bb1e4a12a493356c716f9b As I described, on the level selection screen, by clicking the dice (until it crashes).

Sesu8642 commented 1 year ago

Thanks, @d-albrecht. This looks basically the same as the other stack trace. Looks like re-generating the map can also cause the crash. It should be fixed in version 1.1.3.

d-albrecht commented 1 year ago

I just pulled the new commits and switched to the latest version. And then this happened: AI: Hard Size: Medium Density: Medium Seed: 1678814257297 Crash (reproducible) on first turn. I guess the problem in fact isn't fixed yet.

Sesu8642 commented 1 year ago

Was it the same exception as before? And how do you reproduce it? I tried your parameters and don't have any issues.

d-albrecht commented 1 year ago

I'm pretty sure that I properly updated to 1.1.4 because after I updated and reopened the game, I got the "see changelog" dialog. But I can't reproduce the crash any more. And I only launched the game via shortcut when I reported this, so without any way to see/store the log. And opening the game via shell yields no more crashes. But just like my former installed version, I started the game, selected a match, clicked play, watched the AIs' turns, and then it crashed. But as even I can't reproduce the crash anymore, I'd suspect that I hadn't "fully" upgraded yet and ran some messed up "intermediate" version. Unless this happens again in the future.

Sesu8642 commented 1 year ago

The situation I fixed was caused by a previously played game. You probably encountered a different issue.

Sesu8642 commented 1 year ago

I can see on Google Play that someone had another crash at the same line of code. Looks like it I missed something.