Why won't alternative art work?

Stuck at a level? Need help with R'n'D or anything R'n'D related? Post here!

Moderators: Flumminator, Zomis

Post Reply
Col. Lightbeam
Posts: 3
Joined: Tue Apr 20, 2010 11:18 pm

Why won't alternative art work?

Post by Col. Lightbeam »

I am a Ubuntu Linux user

I tried applying "Might of Elementals" artwork and sounds to Rocks N Diamonds from the Menu. as soon as I put Save changes and exit, it closes

Everytime I load it up, it shuts down. The last thing loading each time that I see is graph_14.pcx.

Help?
A shaft of light...

And then he was gone
Zomis
Posts: 1502
Joined: Mon Jun 21, 2004 1:27 pm
Location: Sweden
Contact:

Post by Zomis »

Look in your Rocks'n'Diamonds directory for the file 'stderr' (unless it's printed some other place in Linux, I can't remember). If there is such a file, tell us what it says.
User avatar
Holger
Site Admin
Posts: 4178
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Post by Holger »

Under Linux, output and errors aren't written to files, but directly printed to the corresponding file descriptors -- stdout and stderr. To see what happened, just start R'n'D from a shell, and you get all output and errors printed to the shell window.

As I assume that you get a "Segmentation fault", it would help a lot here if you could do the following: Remove the leading "#" from the line "# DEBUG = -DDEBUG -g" in file "src/Makefile" in the R'n'D directory and recompile and run R'n'D with "make gdb" -- if it crashes, it will then tell you exactly in which source file/line the crash occurred. (You might need some additional Ubuntu development packages installed, like SDL, gcc, gdb and make.)
filbo
Posts: 672
Joined: Fri Jun 20, 2014 10:06 am

Re: Why won't alternative art work?

Post by filbo »

Hi... my daughter just ran into this!

Her machine's running R'n'D 4.0.0.2; mine has 4.1.3.1. In both cases, both levelsets 'Might of Elementals' & 'Might of Elementals II' crash with 'Floating Point Exception'.

`make gdb` no longer seems to work:

Code: Select all

cd .. && gdb -batch -x GDB_COMMANDS ./rocksndiamonds
warning: GDB_COMMANDS: No such file or directory
Here's the actual failure:

Code: Select all

$ gdb ./rocksndiamonds
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.3) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./rocksndiamonds...done.
(gdb) run
Starting program: /usr/share/games/rocksndiamonds/downloads/src/rocksndiamonds-git/rocksndiamonds/rocksndiamonds 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffeacd9700 (LWP 7399)]
[Thread 0x7fffeacd9700 (LWP 7399) exited]
[New Thread 0x7fffeacd9700 (LWP 7400)]
-------------------------------------------------------------------------------
rocksndiamonds: warning: unknown token(s) found in config file:
rocksndiamonds: - config file: '/usr/share/games/rocksndiamonds/graphics/might_of_elementals/graphicsinfo.conf'
rocksndiamonds: - dynamic token: 'bd_magic_wall.dead.delay'
rocksndiamonds: - dynamic token: 'bd_magic_wall.dead.anim_mode'
rocksndiamonds: - dynamic token: 'maze_runner'
rocksndiamonds: - dynamic token: 'maze_runner.xpos'
rocksndiamonds: - dynamic token: 'maze_runner.ypos'
rocksndiamonds: - dynamic token: 'maze_runner.frames'
-------------------------------------------------------------------------------
rocksndiamonds: warning: error found in config file:
rocksndiamonds: - config file: '/usr/share/games/rocksndiamonds/graphics/might_of_elementals/graphicsinfo.conf'
rocksndiamonds: - config token: 'bd_amoeba'
rocksndiamonds: - image file: '/usr/share/games/rocksndiamonds/graphics/might_of_elementals/graph_05.pcx'
rocksndiamonds: - frame size: 32, 32
rocksndiamonds: error: first animation frame out of bounds (256, 0) [256, 96]
rocksndiamonds: custom graphic rejected for this element/action
rocksndiamonds: fallback done to 'char_exclam' for this graphic
-------------------------------------------------------------------------------
rocksndiamonds: warning: cannot find artwork file 'Rbug01.wav'
rocksndiamonds: warning: trying default artwork file 'gong.wav'
rocksndiamonds: warning: cannot find artwork file 'Rbug01.wav'
rocksndiamonds: warning: trying default artwork file 'sirr.wav'

Program received signal SIGFPE, Arithmetic exception.
0x00000000004b2e24 in getAnimationFrame (num_frames=1, delay=0, mode=1, start_frame=0, sync_frame=0) at anim.c:249
249	    frame = (sync_frame % (delay * num_frames)) / delay;
(gdb) where
#0  0x00000000004b2e24 in getAnimationFrame (num_frames=1, delay=0, mode=1, start_frame=0, sync_frame=0) at anim.c:249
#1  0x00000000004b42ab in DrawGlobalAnimationsExt (drawing_target=2, drawing_stage=1) at anim.c:799
#2  0x00000000004b446f in DrawGlobalAnimations (drawing_target=2, drawing_stage=1) at anim.c:841
#3  0x00000000004dca4b in FinalizeScreen (draw_target=2) at sdl.c:53
#4  0x00000000004dcb56 in UpdateScreenExt (rect=0x7fffffffdc70, with_frame_delay=1) at sdl.c:106
#5  0x00000000004dcde3 in UpdateScreen_WithFrameDelay (rect=0x7fffffffdc70) at sdl.c:231
#6  0x00000000004ddf33 in SDLCopyArea (src_bitmap=0x66edc00, dst_bitmap=0x66e3790, src_x=6, src_y=6, width=548, 
    height=548, dst_x=6, dst_y=6, mask_mode=0) at sdl.c:907
#7  0x00000000004baf8c in sysCopyArea (src_bitmap=0x66edc00, dst_bitmap=0x66e3790, src_x=6, src_y=6, width=548, 
    height=548, dst_x=6, dst_y=6, mask_mode=0) at system.c:525
#8  0x00000000004bbc4b in BlitBitmap (src_bitmap=0x66edc00, dst_bitmap=0x66e3790, src_x=6, src_y=6, width=548, 
    height=548, dst_x=6, dst_y=6) at system.c:868
#9  0x0000000000416528 in BackToFront () at tools.c:841
#10 0x0000000000410a6e in EventLoop () at events.c:363
#11 0x0000000000404a51 in main (argc=1, argv=0x7fffffffde78) at main.c:7762
(gdb) 
Looks like that's trying to divide by zero twice...

One additional oddity: unlike most times when R'n'D crashes, this does *not* cause ~/.rocksndiamonds/levelsetup.conf to be rewritten to avoid the bad levelset. So it crashes every time no matter what. On my 4.1.3.1, clicking the main menu 'Levelset' button quickly enough gets me into the levelset hierarchy; on her 4.0.0.2, this doesn't work and it always crashes. I 'fixed' her by editing levelsetup.conf, but ... oddly, every single time in the past that R'n'D rewrote my levelsetup.conf, I didn't want it to. This one time when it would have been useful, it didn't!
User avatar
Holger
Site Admin
Posts: 4178
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Why won't alternative art work?

Post by Holger »

Hi... my daughter just ran into this!

Her machine's running R'n'D 4.0.0.2; mine has 4.1.3.1. In both cases, both levelsets 'Might of Elementals' & 'Might of Elementals II' crash with 'Floating Point Exception'.
Eeek! :shock:
`make gdb` no longer seems to work:
Apparently file "GDB_COMMANDS" was never added to the repository; not sure if it was ever part of a source package...
Here's the actual failure:
Thanks -- that explains everything. :(

The culprit is line "toon_1.step_delay: 0" in "graphicsinfo.conf" of that artwork set, which should be "toon_1.step_delay: 1".

Such a bug in a config file (which of course should never crash the game, be it incorrect or not) apparently caused toons to crash the program after they were changed to be just a "special case" of the new global animations introduced with version 4.0.0.0 of R'n'D. (Animation delay values of "0" were always corrected to "1" to prevent such problems since long ago, but apparently using a wrong "step_delay" for old-style toons brought it back. *sigh*)

This is easy to fix, and I'll do it as soon as possible! :?
One additional oddity: unlike most times when R'n'D crashes, this does *not* cause ~/.rocksndiamonds/levelsetup.conf to be rewritten to avoid the bad levelset. So it crashes every time no matter what.
In fact, if R'n'D really crashes (like in this case), it cannot rewrite anything -- it just crashes. :(

The file "levelsetup.conf" only gets rewritten if R'n'D encounters a "recoverable" error which forces it to (cleanly) exit the program, to prevent running into that same error again (probably caused by the current level set).
oddly, every single time in the past that R'n'D rewrote my levelsetup.conf, I didn't want it to. This one time when it would have been useful, it didn't!
Are there any "common" error cases where R'n'D programmatically exits and rewrites "levelsetup.conf" where you think it should not? In this case, I would like to modify the error handling for such cases.

In my experience, such cases mostly happened in typical "development" situations, where I did something wrong and the program exits and rewrites "levelsetup.conf", although it wasn't helpful in that specific case.

So, this kind of error handling is mainly targeted to "end users" like your daughter, who is not necessarily able to recover from this error by herself (by editing a config file). Therefore, I am very sorry that she ran into such situation (and am happy that you were able to help her out), but if the program crashes hard, I can't do that much. :(

But this bug will be fixed soon!
User avatar
Holger
Site Admin
Posts: 4178
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Why won't alternative art work?

Post by Holger »

Fixed in the repo now!

Patch release will hopefully follow soon.
filbo
Posts: 672
Joined: Fri Jun 20, 2014 10:06 am

Re: Why won't alternative art work?

Post by filbo »

Are there any "common" error cases where R'n'D programmatically exits and rewrites "levelsetup.conf" where you think it should not? In this case, I would like to modify the error handling for such cases.
I don't know of specific cases; I do know the general method by which such things ought to be handled:

If a program crashes and has error handling which attempts to perform recovery by 'resetting to safe default values', it should always save aside a set of the settings it's overriding, and provide a path back to them.

A current egregious example I'm struggling with: the (current Chrome-based) Opera browser, when it crashes twice in a row, assumes it might be a problem with an extension. It therefore disables all extensions on the 2nd consecutive restart-after-crash.

My default configuration includes about 20 extensions, some of which are intentionally disabled. When they blunder in and disable everything, I lose my current intentional configuration. They should not modify the on-off switch of each extension; rather, they should start in a state in which each extension shows, in the extension manager, either 'off' or 'on, but currently disabled due to safe mode'.

Here, R'n'D should do one of these things:

A) Don't change the levelset in levelsetup.conf, but do write a 'crashed last time' indicator. On startup, query the user: 'You were playing [name of levelset] last time, and the game crashed. Do you want to return to that levelset or switch to a safe default?'

or

B) Rewrite `last_level_series` to a safe default, but save the prior value as e.g. `pre_crash_level_series`. Then provide a UI path to switch back to that pre-crash levelset; e.g. in the levelset browser, a button for 'levelset I was playing before crash'.

In either case, make sure not to commit the utterly commonplace bug in which this sequence forgets your levelset:

1. playing levelset xyz, game crashes
2. restart, game now knows that xyz is the pre-crash levelset but is on a safe default; crashes again anyway
3. now the pre-crash levelset has been set to 'safe default'

-- either by recognizing the 'safe default' and refusing to write it to the 'pre-crash' value, or some other sensible method.

'A' seems better to me, overall. The user is in control and overwrites the levelset info only if they choose to.

Also, 'A' can be implemented as a 'dead man switch'. On game startup, rewrite levelsetup.conf (or a new file) indicating game is currently running. On next startup, if that thing indicates 'running', it must have crashed last time; whether or not it had an opportunity to write out a crash log or do other cleanup. BUT: I often run 2x R'n'D (e.g. to better compare similar levels side-by-side, or to some someone else some other level while not disrupting the one I'm working on). So this also needs some trickery.
Post Reply