eldoSlomo / nethack-android

Automatically exported from code.google.com/p/nethack-android
0 stars 0 forks source link

No way to resume game #12

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I [S]'d to save and quit

then restarted, entered my name, it says Destroy, I say no, and it quits.

Bummer.

Original issue reported on code.google.com by miser...@gmail.com on 19 Oct 2009 at 1:31

GoogleCodeExporter commented 9 years ago
That's no good... I've only ever seen it work here, never had problems with 
that. Did
it look like it succeeded when saving? What phone and OS version do you have? 
The
main things I can think of could go wrong would be if the disc is full so it 
couldn't
write because of that, or if it couldn't find the tool it uses for save game
compression (IIRC it's using /system/bin/gzip, perhaps it's not a good idea to 
assume
that it exists). Does it happen like that every time?

Original comment by farnst...@gmail.com on 19 Oct 2009 at 3:10

GoogleCodeExporter commented 9 years ago
I can confirm that this also happens for me, and it is very easy to reproduce. 
G1,
1.6, no modifications/rooting. Filesystem not full. /system/bin/gzip is in 
place and
working. Please let me know if there is any other info I can collect. 

I can save the game intentionally ("S") and resume it OK. But then when I am 
playing,
if the game is garbage collected, and I try to restart it, once I enter my 
name, I am
prompted that an existing game exists, and then it asks if I want to destroy 
it. If I
answer "n", the game exits.

This makes it seem like you can easily and permanently lose your game at any 
time,
and worse, it will appear to work long enough that you might actually have a 
game
you'd hate to lose.  I'm sure you don't want to do that to people. Because of 
the
severity of the problem, I would say this bug should be classed as a blocker, 
and I
would recommend either putting a big warning up, or pulling the current nethack 
build
until this bug is fixed. 

I may also take a look at the code myself tonight and see if I can spot what's 
going
on... New to Android dev, but figure it's worth a shot.

Original comment by davidkwood@gmail.com on 20 Oct 2009 at 5:50

GoogleCodeExporter commented 9 years ago
Same problem here -- intermittently. G1, no modifications. Sometimes a saved 
file
will reload just fine, but occasionally I am told that there is already a game 
by
that name, do I want to Destroy? "n" results in the game quitting.

I only installed the game two days ago. It seems like the longer I wait to 
reload a
game the more likely the bug is to surface, but if I notice any definite 
pattern,
I'll report it.

Thanks for the port to Android, by the way. Once this bug is fixed, it will be
awesome to play Nethack on my phone.

Original comment by dgibb...@gmail.com on 21 Oct 2009 at 1:50

GoogleCodeExporter commented 9 years ago
Thanks for the info. davidkwood, it's definitely the case that if Android shuts 
down
the application, it doesn't automatically save first. I would like for it to do 
that,
but haven't gotten around to try to implement that yet. But, that still sounds 
like a
different issue than miserlou/dgibbons described, as in that case, the game had 
been
explicitly saved using S.

I didn't let this hold up version 1.1.1, as I had fixes ready for many other 
serious
issues in version 1.0. But, I did add a warning about it in the About text, at 
least.

If you are having trouble loading back a save, note that player names are case
sensitive. This means that if you started a game as "Foo", let Android shut it 
down,
started a new game as "foo", saved, and then the next time launched as "Foo" 
(which
is what would have been displayed in the status text at the bottom of the 
screen even
if you launched as "foo"), it would not find your save, but the broken data 
from the
first user with the upper case F.

I would also like to check up and see if it's possible to include NetHack's 
recovery
tool as an option in the application - then you would at least be able to get 
back to
the last level switch if there was a crash or something.

Until the next version, you will just have to live with saving manually.

Original comment by farnst...@gmail.com on 21 Oct 2009 at 9:53

GoogleCodeExporter commented 9 years ago
I haven't experienced this problem again, although I've tried to re-create it. 
It is
possible that when I saw it before, I had indeed forgotten to save. Very likely 
the
issue is with the user, not the code, sorry!

Original comment by dgibb...@gmail.com on 21 Oct 2009 at 1:42

GoogleCodeExporter commented 9 years ago
I haven't had problems restoring games. I just save to quit, then shut down the
process. I'm on vanilla Donut 1.6 on the G1.

Original comment by dan.a.le...@gmail.com on 22 Oct 2009 at 5:54

GoogleCodeExporter commented 9 years ago
I believe the problem is that you can be interrupted in your game at any time,
regardless of how careful you are - by calendar appointments, a phone call, 
power
going out, etc. And then the nethack app can be garbage collected even one layer
down. This very thing has happened to me in the first couple hours after 
downloading.

So, no matter how careful you are, the concern is that you can lose your entire 
game
through no fault of your own. Based on what I have seen, I would consider it 
unlikely
anyone could win with the current build, odds just being what they are. 

Original comment by davidkwood@gmail.com on 22 Oct 2009 at 6:20

GoogleCodeExporter commented 9 years ago
The new version 1.1.2 should be much better at handling this. If you save 
manually
with ^S, it behaves like before. But, whenever the Activity ends, it performs an
auto-save similar to the checkpoints when moving between levels. It also stores 
off
the associated user name. If the application gets killed, the next time you 
start it
it should detect the save and load it back up again, without prompting for the 
user
name. This should make it a lot safer than what it was before (though if you 
have a
game you really care about and know you'll be away from the game for a while, 
perhaps
it's still safer to save manually).

Original comment by farnst...@gmail.com on 24 Oct 2009 at 8:52

GoogleCodeExporter commented 9 years ago
Outstanding! Thank you very much!

Downloading now to see if I can break the new build.  :)

Original comment by davidkwood@gmail.com on 24 Oct 2009 at 11:53

GoogleCodeExporter commented 9 years ago
I am very sorry to report that I have had no success with the new version ("3" 
in
application management). 

In fact, I tried several permutations to see if I could ever observe _not_ 
losing my
game, and I was not able to do it.

Some scenarios I used:

1. Start the game, select character, begin play.
2. Leave the game.
3. Open 1-5 other applications (gmail, sms, etc) - this should cause nethack to 
be
garbage collected.
4. Return to nethack. If the game is still in progress/instantly displayed, 
return to
step 3.
5. Game will prompt for your name, then prompt if you want to destroy your 
previous
saved game. (game permanently lost).

1. Start the game, select character, begin play.
2. Save the game.
3. Leave the game.
4. Open 1-5 other applications (gmail, sms, etc) - this should cause nethack to 
be
garbage collected.
5. Return to nethack. If the game is still in progress/instantly displayed, 
return to
step 4.
6. Game will prompt for your name, then prompt if you want to destroy your 
previous
saved game. (game permanently lost).

1. Start the game, select character, begin play.
2. Play for a while. Descend to level 2.
3. Save the game.
4. Leave the game.
5. Open 1-5 other applications (gmail, sms, etc) - this should cause nethack to 
be
garbage collected.
6. Return to nethack. If the game is still in progress/instantly displayed, 
return to
step 5.
7. Game will prompt for your name, then prompt if you want to destroy your 
previous
saved game. (game permanently lost).

and so on. 

I'm afraid this first attempt was not successful.  :(

Original comment by davidkwood@gmail.com on 27 Oct 2009 at 3:51

GoogleCodeExporter commented 9 years ago
This surprises me to hear, as it's been working pretty close to 100% in all my 
tests.

In your 2nd scenario and 3rd scenario, when you say "Save the game" and "Leave 
the
game", you mean just hitting S, right? In this case, it is meant to prompt for 
your
name, but if you type in the same as last time (case sensitive), it should say
"Restoring save file..." and take you back to where you saved. This should all 
have
been working since version 1.0.

In the 1st scenario, it should have worked, restoring from the auto-save. There
should not be a prompt for your name, but instead, say "Restoring save file..." 
right
over the NetHack copyright screen, and then take you back to the game.

A few questions to help sort out the issue:
A. Are you really sure the new version got installed? If you bring up the About
screen from the application menu, does it say "Android version 1.1.2"?
B. If you have access to the Android SDK, can you run "adb logcat" and see if 
you see
anything like this in the log:
  I/NetHack (19094): Auto-saving
  I/NetHack (19094): Auto-save succeeded
or, perhaps
  W/NetHack (19094): Auto-save failed
Anything else of interest in the log, like an indication of a hard crash in the
application on quit?
C. If you have any access to the file system (for example, through "adb 
shell"), do
you ever see anything like a file called
/data/data/com.nethackff/nethackdir/android_autosave.txt? This should get 
created
whenever the application gets shut down while a game is in progress, whenever 
you
didn't do a #quit or S.
D. Have you tried a clean install? When you don't have any saved NetHack data 
you
care about, try uninstalling the app through Android's "Manage applications" 
option,
and then installing it again fresh. This should delete the whole
/data/data/com.nethackff directory (which is the only place where the app 
should save
anything, AFAIK), so if there was anything corrupt with your installation, 
perhaps
that would clear it up.
E. If the problem persists, can you please let me know what phone this is on, 
which
O/S version, any mods (CyanogenMod, etc), anything else non-standard?

Also, if anybody else either has this same problem with version 1.1.2, or can 
confirm
that it's working for them, please feel free to report here, so we can 
determine if
it's broken for everybody but me, or just for a few users.

Anyway, sorry it's still not working for you, will do what I can to fix.

Original comment by farnst...@gmail.com on 28 Oct 2009 at 7:08

GoogleCodeExporter commented 9 years ago
Was definitely using 1.1.2, confirmed thru application mgmt, about screen. 
Interestingly, since doing the 
clean reinstall that went with the switch to droid, I have seen the autosave 
work for the first time, and 
have not been able to reproduce the problem again. Possibly some remnant files 
or state was 
responsible?

Original comment by davidkwood@gmail.com on 12 Nov 2009 at 2:38

GoogleCodeExporter commented 9 years ago
Still getting this problem in 1.1.3 running cupcake on G1. What are the chances 
of a patch? I'd love to 
be able to continue progress on those characters that I don't myself kill :)

Original comment by magnus.n...@gmail.com on 9 Dec 2009 at 6:39

GoogleCodeExporter commented 9 years ago
Uninstall and reinstall seems to resolve the issue for me.  I am not able to 
recreate
the problem after doing this.

Original comment by fewaffles on 9 Dec 2009 at 7:04

GoogleCodeExporter commented 9 years ago
Tried that after one point, when any login attempt returned "waiting for access 
to perm (9 
attempts)"...etc.  this issue was of course fixed, but the original destroy old 
file y/n prompt still results in 
a crash. 

Thanks, though :)

Original comment by magnus.n...@gmail.com on 9 Dec 2009 at 7:18

GoogleCodeExporter commented 9 years ago
I have the same problem on a G1. If I start a nethack game, then switch to a 
couple
other apps, nethack gets killed and it does not successfully save my game. If I
restart nethack, I get the "There is already a game in progress under your name.
Destroy old game? [yn]", saying "y" erases the saved game, saying "n" just 
quits nethack.

There are no I/NetHack lines in my adb logcat. I just see this around the time 
it dies:

I/WindowManager( 8770): WIN DEATH: Window{43e26c00
com.nethackff/com.nethackff.NetHackApp paused=false}
I/ActivityManager( 8770): Process com.nethackff (pid 32117) has died.

Running NetHack 3.4.3 Android version 1.1.3.

As long as I use 'S' to save my game, I don't have any problems. But it would 
be nice
if the auto-save worked and I didn't have to worry about that. Thanks.

Original comment by dro...@gmail.com on 18 Jan 2010 at 10:27

GoogleCodeExporter commented 9 years ago
I just started having this issue after updating to the newest Cyanogen mod. On 
the
previous version it seemed to be working great. It doesn't always do it when
switching apps but it will every time I switch to the browser and back.

Would also like to take the opportunity to thank you so much for porting this. 
I have
been playing Rogue and Hack almost from the beginning and have yet to beat it. 
It
cracks me up that I have a $400 phone that I spend most of my time playing 
Nethack on.

G1
Cyanogen 4.2.14.1
Android 1.6

Original comment by countspa...@gmail.com on 7 Feb 2010 at 7:57

GoogleCodeExporter commented 9 years ago
I am afraid to report that I have seen this problem recur several times since I 
last thought it might be fixed. 

There's definitely some case where this can still happen.

I will see if can get it to recur in a situation where I can pull the log. 

Original comment by davidkwood@gmail.com on 21 Jun 2010 at 4:09

GoogleCodeExporter commented 9 years ago
In version 1.2.4, there is another recovery option, in addition to the 
auto-recover that already happened after the application gets properly shut 
down by the OS. Now, instead of getting prompted if you should destroy the old 
game, you get prompted if you want to recover (like what the MSDOS version 
does). Hopefully this will take care of the problem. Please report back here if 
you're still having problems.

Original comment by farnst...@gmail.com on 2 Jul 2010 at 10:55

GoogleCodeExporter commented 9 years ago
I'm afraid this should definitely be reopened, even with the latest build. The 
recovery system is definitely not effective. Here is what happened:

1) Playing a game. 
2) A calendar reminder appeared. Clicked dismiss
3) Returned to the game, which had been killed in the intervening second
4) Recovery process was started, but a message appeared, roughly: "Checkpoint 
data incompletely written or subsequently clobbered"
5) It asks if you want to recover anyway. Say "y"
6) It informs you that the recovery failed, and asks if you want to destroy the 
old game. At least the destroy works and you can start over without having to 
wipe the app's data.

As you can see, this is a pretty severe problem - for a game like this, I'm not 
sure if it's winnable (or if you'd want to try it) when you can lose your game 
at any time like this. 

I know I'm naive... but I think there should be a simple way to automatically 
save the game as soon as the app leaves the foreground? :) What are you doing 
in your onPause()? I started to poke through your sources but haven't gotten 
oriented enough to understand where you're doing this work yet.

Original comment by davidkwood@gmail.com on 15 Sep 2010 at 6:43

GoogleCodeExporter commented 9 years ago
Sorry to hear that you are still having problems. Unfortunately I haven't 
really been able to reproduce any such problem myself, despite trying various 
things, like running on an emulator and using some development tool which kills 
the processes much more aggressively. In my onPause() I pretty much try to do 
what you suggest - if the game has been initialized and not quit, it saves in 
the same way as if doing a level checkpoint, and then shuts down the update 
thread and waits for it to finish. One thing that I suspect might happen is 
that perhaps the O/S has some sort of time limit for how long time the 
application is allowed to spend in onPause, and maybe the save takes longer 
than that on some devices and gets aborted by the O/S. If that's the case, it 
may be safer to only save on level changes, and perhaps periodically, or maybe 
I need to set up some sort of double buffering of the saves so that if one 
doesn't finish, it can still use the previous one. Or, perhaps there is some 
sort of bug in my multi-threading, but I have been trying to be somewhat 
careful about that stuff. Anyway, if you feel inclined to debug it yourself, I 
would certainly appreciate any fix you come up with. You may want to use the 
latest tagged release of the source, as I believe the trunk is in the middle of 
some changes and may not run properly.

Original comment by farnst...@gmail.com on 16 Sep 2010 at 5:35