Baron of Hell
Register | User Profile | Member List | F.A.Q | Privacy Policy | New Blog | Search Forums | Forums Home
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Doom General > The Medusa Effect Curiosity
 
Author
All times are GMT. The time now is 22:27. Post New Thread    Post A Reply
Marnetmar
Forum Staple


Posts: 2025
Registered: 09-10


Some of you may have heard of the famous Medusa Effect, which was definitely a pain in the ass if you encountered it not knowing what it was.

The reason I created this thread was mainly because of a question I couldn't find the answer to. When you look at the medusa effect and the game slows down to a crawl, what is actually happening causing that to happen? Does the ugliness turn your processor to stone or what?

Old Post 11-13-11 06:20 #
Marnetmar is online now Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
andrewj
Senior Member


Posts: 1379
Registered: 04-02


Due to a bug, the engine starts drawing the contents of random memory (or the executable) instead of a texture. Textures are divided into posts which require a certain value to terminate, so it ends up drawing thousands of posts per column (instead of a couple) because the terminator rarely occurs in random memory.

Old Post 11-13-11 10:54 #
andrewj is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
GoatLord
Senior Member


Posts: 1414
Registered: 07-02


It's also called the tutti-fruity effect because of the appearance of the pixels. Seems like it's an easily enough avoided bug if you have good mapping skills, but I wouldn't know.

Old Post 11-14-11 00:26 #
GoatLord is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Marnetmar
Forum Staple


Posts: 2025
Registered: 09-10


Actually, the medusa effect and the tutti-frutti effect are two different things.

Old Post 11-14-11 00:29 #
Marnetmar is online now Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
EarthQuake
9.5 on the Richter!


Posts: 2746
Registered: 05-03


Technically, wouldn't medusa actually generate tutti-fruttis? It certainly appears that way, with medusa drawing a lot more junk pixels. Also, can you use a multipatch middle texture with only one patch showing and avoid the bug?

Old Post 11-14-11 04:52 #
EarthQuake is online now Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Quasar
Moderator


Posts: 4615
Registered: 08-00


IIRC, Lee Killough claimed once that the extreme slowdown that stems from the Medusa effect originated from Z_Malloc. I have never figured out the wherefores or whatnots involved, however. He described it as "heap thrashing".

I do know some memory corruption and/or illegal reads are involved, however, as Chocolate Doom will often crash when subjected to displaying the Medusa effect. As usual, DOOM under DOS was able to commit murder that no app on a modern OS can get away with.

Old Post 11-14-11 11:00 #
Quasar is online now Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Maes
I like big butts!


Posts: 8661
Registered: 07-06


TBQH I hardly ever remember seeing the effect in action, as it requires a very specific set of circumstances to occur. Perhaps the most important one is having to draw a transparent (aka not fully covered) multi-patched two-sided sidedef. If you simply draw this on a single-sided wall, you get plain old tutti-frutti (since the tiling eventually puts an end to the runaway drawing, no matter how fugly it looks).

On two-sided walls, the engine is trying to draw the equivalent of a composite transparent patch, which does not exist in vanilla Doom, and is NOT stopped by texture tiling. Ports like Boom and derivatives introduced this concept (creating transparent mid-textures from multiple patches) and thus indirectly fixed the medusa effect.

A good example of what could cause medusa is in cybie2 (the gridded fencing on top of the brick walls): these are actually one single transparent texture made up from multiple patches, a concept which is alien to the vanilla engine.

Old Post 11-14-11 12:02 #
Maes is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
hex11
Senior Member


Posts: 1481
Registered: 09-09


FreeDM (from Freedoom v0.7) has a good demonstration of the medusa effect:

chocolate-doom -iwad freedm.wad -warp 2

Turn around counter-clockwise. If you're unlucky, the game will crash (segmentation fault), but if not there's a good chance for some heavy slowdown as you turn to face the hallway where the chaingun is located.

I guess GRAY4 is a multi-patch texture? :)

Old Post 11-14-11 14:13 #
hex11 is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
GoatLord
Senior Member


Posts: 1414
Registered: 07-02


I don't think I really understand the difference between the Medusa Effect and the tutti-fruity effect.

Old Post 11-14-11 19:58 #
GoatLord is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
printz
CRAZY DUMB ZEALOT


Posts: 6845
Registered: 06-06



GoatLord said:
I don't think I really understand the difference between the Medusa Effect and the tutti-fruity effect.

Tutti-frutti is static and harmless, Medusa is out of control and as Quasar said potentially harmful.

However, I tend to call this one the more appropriate Medusa effect: Visplane overflows! I have to keep my eyes on the automap not to be bombed by them.

Old Post 11-14-11 20:17 #
printz is online now Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
Wagi
Member


Posts: 273
Registered: 11-10


Tutti frutti effect happens when you try to make a wall texture tile vertically when it is less than 128 pixels tall. Because R_DrawColumn() ignores the texture height and instead opts to use "&127" for all of it's vertical tiling, it causes textures with lower heights to run out of bounds, reading from either junk data or the column to the right (left?).

The effect you will see is that one of the iterations of the texture will display perfectly fine, while the next iteration will be shifted sideways with a column of multicolored garbage in there, and sandwhiched between the two is a row of garbage.

The medusa effect is explained above. An interesting note, Vanilla doom's medusa effect seems much more random than Chocolate doom's. In Chocolate, it seems to be reading more from other, unrelated textures (with consistent coloring), whereas in Vanilla it's just multicolored snakes. Probably because the different memory layouts.

Edit: I thought R_DrawColumn() would reject trying to draw outside of the screen bounds anyway. Can somebody explain to me how the medusa effect corrupts memory? Wouldn't some of that show up on the status bar or in screens[1] to screens[3]?

Old Post 11-14-11 20:55 #
Wagi is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Graf Zahl
Why don't I have a custom title by now?!


Posts: 7130
Registered: 01-03



Wagi said:

Edit: I thought R_DrawColumn() would reject trying to draw outside of the screen bounds anyway. Can somebody explain to me how the medusa effect corrupts memory? Wouldn't some of that show up on the status bar or in screens[1] to screens[3]?




I'm not sure it corrupts memory. But due to the strange way Doom's textures are defined (a post's start is always relative to the top of the texture) it can endlessly overdraw the texture and grind the computer to a halt. I think the worst that can happen is an eventual crash because it tries to read beyond the end of valid memory.

Old Post 11-14-11 21:11 #
Graf Zahl is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
printz
CRAZY DUMB ZEALOT


Posts: 6845
Registered: 06-06



Quasar said:
As usual, DOOM under DOS was able to commit murder that no app on a modern OS can get away with.
What about protected-mode runtime (as in Windows 98 or even XP without DOSBOX)? Would it bomb out of Doom and display that message box in the down-right corner, with the explicit "you need to close all programs and restart your computer"?

Old Post 11-14-11 21:13 #
printz is online now Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
Wagi
Member


Posts: 273
Registered: 11-10



Graf Zahl said:
I'm not sure it corrupts memory. But due to the strange way Doom's textures are defined (a post's start is always relative to the top of the texture) it can endlessly overdraw the texture and grind the computer to a halt. I think the worst that can happen is an eventual crash because it tries to read beyond the end of valid memory.
Ahh. I guess I was under the impression that invalid reads were somehow less restricted than invalid writes.

Old Post 11-14-11 21:24 #
Wagi is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Marnetmar
Forum Staple


Posts: 2025
Registered: 09-10



GoatLord said:
I don't think I really understand the difference between the Medusa Effect and the tutti-fruity effect.


The medusa effect looks much more screwed up and slows the game down to probably a frame every 5-10 seconds.

This can still be replicated on DOOM95, actually. I was able to make it happen twice, but I don't have any idea how I did it and that was before I even knew what the medusa effect was.

Old Post 11-14-11 22:38 #
Marnetmar is online now Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Quasar
Moderator


Posts: 4615
Registered: 08-00



printz said:
What about protected-mode runtime (as in Windows 98 or even XP without DOSBOX)? Would it bomb out of Doom and display that message box in the down-right corner, with the explicit "you need to close all programs and restart your computer"?

When DOOM was run under Win9x, DOS4GW would not load itself since it detected a DPMI host already loaded (Win9x provide their own DPMI services to DOS programs).

Win9x DPMI is, in some ways, more strict, and in others, less strict, than known DOS DPMI hosts. Win9x is far more strict than Watcom's DOS4GW, but is known to be significantly less strict than DJGPP's CWSDPMI. I know this because many of the early problems in SMMU v3.21 and v3.30 happened because fraggle was running/testing it under Windows 98 instead of DOS. When I ran the same EXE he thought was perfect under DOS, all kinds of problems would suddenly and violently surface.

With a more strict DPMI, DOOM is forced to bomb out before it can damage operating system, driver, and real-mode application data structures outside of its strictly owned pages of RAM. Otherwise "harmless" illegal reads are also treated as instantly fatal.

Old Post 11-14-11 22:49 #
Quasar is online now Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Superfly TNT
Newbie


Posts: 2
Registered: 11-11


When I first started mapping I used to raise floors and lower ceilings, texturing the upper and lower parts thereupon creating the effect and had no idea.

Old Post 11-23-11 21:56 #
Superfly TNT is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
All times are GMT. The time now is 22:27. Post New Thread    Post A Reply
 
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Doom General > The Medusa Effect Curiosity

Show Printable Version | Email this Page | Subscribe to this Thread

 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are OFF
[IMG] code is ON
 

< Contact Us - Doomworld >

Powered by: vBulletin Version 2.2.5
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Forums Directory