Crash in editor on cursor keys -- reproducible?

Found a bug in R'n'D? Report it here!

Moderators: Flumminator, Zomis

Post Reply
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Crash in editor on cursor keys -- reproducible?

Post by Holger »

Some people encountered R'n'D crashing hard when pressing cursor keys in the level editor -- for example, see this post:

viewtopic.php?t=1492&start=15

Has anybody else encountered that bug? Is there any way to reproduce this bug? :-o
Zomis
Posts: 1502
Joined: Mon Jun 21, 2004 1:27 pm
Location: Sweden
Contact:

Post by Zomis »

All I did was to open up Zelda II, go to the level editor, scroll right (using cursor keys) until map position 42,0 is on top left corner. Then down (still using cursor keys) until (42, 33) is in the top left corner.

Then press cursor key left. BOOM!

Btw: I just did the same with map position 37, 33 in top left corner. Same result ;)

Map position 46, 48 also works... in case you were wondering... however, (1, 1) did not work.
Scrolling down first and right afterwards and then left also causes a BOOM.


After a bit of analyzation, I noticed it happens when scrolling 2 or more right, and one or more positions down. Pressing left then causes a crash.

But I guess it's different from level to level. This was tested with the Zelda II level.
Last edited by Zomis on Wed Sep 19, 2007 8:08 pm, edited 2 times in total.
User avatar
RTADash
Posts: 180
Joined: Sun May 27, 2007 11:33 am
Location: USA (Ohio)

Post by RTADash »

Oh, this also happened to me the one time when I wasn't sure where to go next. I guess it was probably similar conditions, although I wasn't really paying much attention.
Those who can't learn will teach; those who can't teach will learn.
Daniel H.
Posts: 535
Joined: Sun Apr 02, 2006 7:13 pm
Location: USA

Post by Daniel H. »

I just got this to happen, but it seems to work almost anywhere on row 33. I didn't try any other rows.

It also works without using the Zelda II artwork. It happens both with fullscreen mode on and off.

At the moment, I am using Rocks'n'Diamonds SDL on Windows NT 5.1 SP2.
The H. World levelset can be downloaded from http://www.bd-fans.com/RnD.html -- search The H. World on that page.
User avatar
Alan
Posts: 661
Joined: Fri Jun 18, 2004 7:48 pm

Post by Alan »

It has nothing to do with zelda2.

It has happend to me with the levels I've made before Z2, the older RNDs EXE, and the older SDLs so its been with us for a while, how long I don't know.
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Post by Holger »

> go to the level editor (on Link's belt), scroll right (using cursor keys) until
> map position 42,0 is on top left corner. Then down (still using cursor keys)
> until (42, 33) is in the top left corner.
>
> Then press cursor key left. BOOM!

OOPS! :-O

Great! This is reproducible now! Thanks for the detailed description!

(BTW: The bug still does not happen on my Linux development box, and also running it inside valgrind does not show any anomalities, but it in fact always crashes my Windows 2000 box when following the above instructions! No stderr.txt, though. I'm afraid I have to debug it the hard way... :-/ )

> It has nothing to do with zelda2.

No, definitely, absolutely no Zelda 2 problem -- this is a 100% genuine R'n'D crash bug... :-o

Hope that I have found and fixed it soon! :-)
Last edited by Holger on Wed Sep 19, 2007 7:56 pm, edited 1 time in total.
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Post by Holger »

> Oh, this also happened to me the one time when I wasn't sure where to go
> next. I guess it was probably similar conditions, although I wasn't really
> paying much attention.

Was this also in the editor, or while playing a game? Just to be sure...

> Hope that I have found and fixed it soon! :-)

I think I have found the bug -- newer SDL.dll on Windows seems to not like blitting from and to the same bitmap (although this is explicitely allowed according to the SDL documentation). Added a temporary bitmap for scrolling in the editor. (In fact, I also had to add this for scrolling inside the game on the Windows platform, although this "only" caused graphical glitches, but no crashes. This makes scrolling slower, of course. :-( )

OK, I hope this bug is really fixed now. Time will tell... :-/
Zomis
Posts: 1502
Joined: Mon Jun 21, 2004 1:27 pm
Location: Sweden
Contact:

Post by Zomis »

Alan wrote:It has nothing to do with zelda2.

It has happend to me with the levels I've made before Z2, the older RNDs EXE, and the older SDLs so its been with us for a while, how long I don't know.
Indeed correct. But I've never found it so easy to reproduce the RnD buggy behaviour, that's why I used the Zelda2 levelset.
Holger wrote:I think I have found the bug -- newer SDL.dll on Windows seems to not like blitting from and to the same bitmap
If you scroll right twice, down once and then left, how can that be blitting to the same bitmap? Since that scrolling shows a new view of the map, with map position (1, 1) in the top left corner. Oh well, whatever... as long as it gets fixed ;)
Holger wrote:(In fact, I also had to add this for scrolling inside the game on the Windows platform, although this "only" caused graphical glitches, but no crashes. This makes scrolling slower, of course. :-( )
Oh, how come? I don't think this bug is game-related, only editor-related. But can't that temporary bitmap be added to the editor without being added to the game? Well, I hope it won't slow down too much.
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Post by Holger »

> If you scroll right twice, down once and then left, how can that be blitting to
> the same bitmap?

It's easy: When you start the editor, a part of a larger level is drawn to the main screen area (33 small tiles width and 32 small tiles height when scrollbars are to be displayed). Now when you press "cursor right", the displayed playfield gets scrolled one tile column to the left (while the visible screen virtually scrolls to the right). To make things faster, not the whole playfield is completely re-drawn (this would be 33 x 32 single blit operations), but the right part that is still visible ( (33 - 1) x 32, for scrolling one tile column right) is blitted one tile column to the left and a new tile column (1 x 32 tiles) is added at the right border. To do this, there is a (33 - 1) * 16 pixels wide and 32 * 16 pixels high area that is blitted FROM the backbuffer TO the (same) backbuffer. Then the new column is drawn. Then the backbuffer is blitted to the visible window buffer (or video buffer for fullscreen mode).

> I don't think this bug is game-related, only editor-related.

Yes, THIS bug has nothing to do with the game mode at all. But the scrolling in the game mode had exactly the same problem (but not causing a crash for whatever reason).

> But can't that
> temporary bitmap be added to the editor without being added to the
> game?

Yes, it's completely independent. To fix both problems, both the editor backbuffer and the game scrolling backbuffer (independently) need a temporary buffer to prevent blitting from and to the same bitmap (game playfield or editor playfield).

> Well, I hope it won't slow down too much.

Usually not, as one single screen blit is usually much faster than several smaller blits of the same size. (For scrolling, this means that it's faster to blit everything that does not change in one large blit one column or row to the left, right, up or down and then drawing a new column or row of new tiles (which would be 1 large blit plus 17 (game) or 32 (editor) new tiles). It's slower to re-draw the whole backbuffer in comparison (which would be 17 x 17 (game) or (roughly) 32 x 32 (editor) new tiles. On most systems, it's still faster to do TWO large blits (from backbuffer to temp buffer, then from temp buffer to backbuffer) plus the new tiles.

Therefore, this workaround definitely can make scrolling slower, as there's an additional large blit every tile-sized scroll position that normally is not needed. On the other side, I did not notice a frame rate dropdown on my Linux (2 GHz Athlon, Matrox card) or Windows system (800 MHz P III, Riva TNT card).

I'm sure that this is a bug in recent SDL versions -- this problem did not occur with SDL 1.2.8, for example. (Just try with R'n'D 3.2.3 on Windows with BD2K3, second level, scrolling left and right: With SDL 1.2.8, everything's fine, while with SDL 1.2.11 or SDL 1.2.12, you get small colored lines and other small graphical glitches. I think the reason for both problems is the same, and if I remember correctly, SDL 1.2.8 used the SDL directx driver as the default video subsystem, while SDL 1.2.11 and 1.2.12 use the SDL windib driver instead. This should be further investigated in the SDL source code.)
User avatar
Alan
Posts: 661
Joined: Fri Jun 18, 2004 7:48 pm

Post by Alan »

All I did was to open up Zelda II, go to the level editor (on Link's belt), scroll right (using cursor keys) until map position 42,0 is on top left corner. Then down (still using cursor keys) until (42, 33) is in the top left corner.
Ahhh ha! It does do it here everytime......I would always go back to RND and try to reconstruct all the work I lost (whilst still fresh in my head) and just make a note of the crash. It would always happen just when I made something interesting.

Just tried the "right down left" method on an empty unedited cave and it crashed in the right place for once..........but you don't need to first "right down" key presses to see it, just scroll the level using the bars to the bottom right of any cave and press left.

Not that much off-topic here (hey, who cares in this forum anymore right?), but shouldn't you mention the "alt-enter emulation" bug too Holger? I find it just as annoying, and again hard to prove.
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Post by Holger »

> shouldn't you mention the "alt-enter emulation" bug too Holger? I find it
> just as annoying, and again hard to prove.

Good point! I've added a separate thread for it here:

viewtopic.php?p=10078
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Post by Holger »

> All I did was to open up Zelda II, go to the level editor (on XXXX's XXXX), [...]

Would you mind editing your post to remove telling about that cheat (now that it is not needed anymore to reproduce the bug)? I think it was hidden by intention! :-)

At least adding a spoiler warning would be nice for those who must be protected from themselves! ;-) (You could, for example, use white text on white background, which is only visible when selected, as many people already did in this forum when talking about things that may spoil the fun...)

Thanks! :-)
User avatar
Alan
Posts: 661
Joined: Fri Jun 18, 2004 7:48 pm

Post by Alan »

A bit late for that isn't it?

You and I have already quoted this spoiler above! :wink:

*edit*
I think it was hidden by intention! :-)
Yep, and now it is even more hidden since I've now changed the package.
Post Reply