andstatus / game2048

2048 Open Fun Game - multiplatform implementation in Kotlin and KorGe game engine
Apache License 2.0
180 stars 27 forks source link

App do not react and will be closed #4

Closed acutus9 closed 2 years ago

acutus9 commented 2 years ago

Hello, I play the game for quite a while (794282 points), because I love the App Design and gameplay Unfortunately in the meantime the respond to the user interaction become slower and slower. Now I can not play anymore, because I get after 1 or 2 moves a message from the operating system that tells me the App do not react and close it. The Android Settings tell me that the App uses 122MB Data. When I delete that data and start again, the App works fine. Looks for me the App save to much history. I use a Huawei P30 pro, android 10, emui 11.0.0.159

yvolk commented 2 years ago

Hello @acutus9. Thank you for your report.

Occupation of 122 MB data is not that much actually and shouldn't be a problem for a device. I think that amount of data stored is not related to the slowness that you observed.

Next time you encounter the same slowness, please:

  1. Exit the game by navigating to the Home screen.
  2. Restart your device.
  3. After restart please continue playing the same game that played slowly before restart..
  4. Does the game works normally now?

Ps: I guess that an answer at the point 4 will be "yes". I suspect that slowness is caused by some other memory leak. I will start fixing it with an update of the game engine...

mabalew commented 2 years ago

I have the same problem. 546692 points and app is not working anymore. After initial logo, it shows the last game screen but even timer is not counting the time. After few seconds the game quits. Restarting of device doesn't help. Device: Xiaomi POCO M3 Pro 5G.

yvolk commented 2 years ago

@mabalew Thank you for the feedback. Looks like it's really not easy to remember so many moves :-) Will review this and fix.

yvolk commented 2 years ago

@acutus9 @mabalew I see that for a quick fix I need to limit maximum number of moves that the app stores it its memory.

Could you help me in testing and "Share game" with me the longest game that you could still open in the app, e.g. via email andstatus@gmail.com or attaching the shared ".json" file here. So I could use such long games during performance improvements.

I could get only about 42000 points :-)

yvolk commented 2 years ago

Meanwhile I applied the quick fix limiting maximum number of stored moves, please test it after sharing your longest games (in order not to lose first moves of them...) In addition, I updated Game engine library to the latest version, so maybe this will improve something also...

See #1

acutus9 commented 2 years ago

Hi, I try your proposal some times. The phone restart procedure help for some moves. Now I am complete stucked. The app crash after I start the game. 2021-08-12-07-22_832440.game2048.zip

yvolk commented 2 years ago

@acutus9 Thank you! I could load your game on my PC (running as a JVM app, where I have much more memory than on Android...) and see the size and the great game :-) I see that too much memory is needed during saving and loading a game. I will optimize this to allow playing and saving game history even for such long games.

game2048-832440

yvolk commented 2 years ago

Dear @acutus9 and @mabalew I just released v.1.11.0 of the 2048 app, in which the problem with tens of thousand moves is solved. This is achieved by:

  1. During the game saving game moves not in a single record, as before, but in pages (2500 moves per page).
  2. Similar approach for sharing and loading a game: I changed exchange format so that now shared game is loaded sequentially (concatenated JSON...). Old format is still supported, but you may still be unable to load a huge game stored using the old format ,i.e. by app v. before 1.11.

Please note that if you have huge game in your installed app, you need to save it once (e.g. by adding a bookmark or making another move), so app will save it in separate pages...

@acutus9 I manually reformatted your shared game, so now I think you will be able to load it (just unzip): c2_2021-08-12-07-22_832440.game2048.zip

The new version is available here: https://github.com/andstatus/game2048/issues/1

Waiting for your feedback!