Can a level MAV because it is too big?

Discuss the games (no level solutions or off-topic, please).

Moderators: ~xpr'd~, tyteen4a03, Stinky, Emerald141, Qloof234, jdl

Post Reply
User avatar
Tech Warrior
Rainbow Keeper
Posts: 380
Joined: Mon Feb 27, 2012 12:02 am
Location: over the rainbow

Can a level MAV because it is too big?

Post by Tech Warrior » Fri Aug 27, 2021 9:59 pm

Alright, I have tried for days, weeks even, to figure this out myself, and just when I think I have determined the cause - the MAV upon exiting RTW returns. So now I am bringing the issue to the open, to see if maybe somebody else has an idea that I am missing...

The MAV:

It only appears after you quit the game, when the small "black" windowed screen appears after Stinky says goodbye. It also appears occasionally - not every time. But when it does appear, it's always when this specific level is played.

Context:

The RTW level in question was originally started in the default RTW editor, then moved over to be finished in Crumpet. As some of you may know, Crumpet is an improved editor for RTW. However, it does not support link sphere generators or sticky cube generators - these must be re-added in the RTW editor. The size of the level is 99x99, the max allowed in RTW, however I have never gotten a MAV from any of the other 99x99 levels I have made. Only when I moved the level to Crumpet, did the MAV begin appearing...

At first, I believed it was a compatibility issue. Crumpet does not recognize custom backgrounds either - so you have to do this in the RTW editor as well. I changed this, and added the sphere/sticky cube generators back where necessary (Crumpet just turns them into empty tiles). Voila - no more exit MAV!

...Until it returned. I have tried every variable imaginable, down to changing game resolution, turning sound/music off - I even created test levels in Crumpet purposefully adding/re-adding link sphere and sticky cube generators to see if that compatibility issue was the cause. Other tests included starting a test level in RTW (some with link/sticky generators), switching it to Crumpet, then moving it back to RTW. I tried copies with and without the generators that were removed by Crumpet (did all the same stuff with custom backgrounds too). No such MAV in any of these tests.

The only difference between this level and other 99x99 levels, at least that I can see, is that the level in question is 79kb, whereas the others of comparable size max out at 78kb. Could this be the issue, in which RTW can only load 78kb before it experiences issues? But then I wonder why it wouldn't MAV during play...

There are NO hex-edited tiles in this level either - obviously it isn't that.

In short: I have no idea why I am getting a MAV from this level. Based on the information here, does anybody else have an idea what it could be??
Quest for the Five Elements - a 195-level RTW expansion pack
I am also known as Joey_San on Discord.
User avatar
Tech Warrior
Rainbow Keeper
Posts: 380
Joined: Mon Feb 27, 2012 12:02 am
Location: over the rainbow

Re: Can a level MAV because it is too big?

Post by Tech Warrior » Sat Aug 28, 2021 4:53 am

!! SOLVED !!

Okay, I'll keep this topic here so I can address the source of the MAV, which is quite fascinating and exposes a really bad bug within RTW. After talking with HumanGamer and Lazy Loof about this, here is what is happening:

In RTW there is a limit to how many surface arrays can be in a given level construction - this is either 49 or 50. The level in question had a total of 53 such surfaces. I used a modded version of W+ to find this information, and to observe the variety of tests that followed.

Through each test, I made different changes within the level: removing patches of walls, changing floor types to other floor types, removing "layers" or rings of walls/lava/water, thinking that surfaces were defined by isolation - that is, each "chunk" of floor counting as one surface, separated by a chunk of walls (three surfaces as they generate a top and two sides), and so on. Oh, this was completely the wrong way of thinking about surfaces.

It has nothing to do with any of that at all. Rather, the game doesn't care where the surfaces are - just whether they exist. This means that by adding an element that didn't previously exist in the level - say, a single left-facing conveyor - this would create a new surface array. Note that this only applies to elements determined in the level construction (this means terrain tiles - link spheres for example do not add surfaces). Check out the following screenshot:

Image

^ In this screenshot, you will notice there are several left-facing conveyors, but only 15 total surface counts as noted in the console. Here is a breakdown of these:

3 surfaces for walls (one wall top, two wall sides)
1 surface for floor (each floor type counts as a separate surface)
2 surfaces for deep walls (two wall sides)
5 surfaces for each ice type
4 surfaces for each conveyor direction (note that switcheroos do NOT add surfaces if regular conveyors are already present)

Once this exceeds 50, the game is using corrupted memory to process surfaces over the limit - so you will get an exit MAV.

In an effort to document these findings and to help prevent what is actually an easily achievable MAV in a level, I'll be providing a download for a test file that often MAVs (but not every time!) upon exiting the game. This test file contains every tile that affects the surface count.

Here is a full list of every item that adds surface count to your level (up to 53):

Image

Default Floor - 1
Floor Type B - 1
Floor Type C - 1
Floor Type D - 1
Trampoline - 1
Wall h:1.0 - 3
Wall h:1.5 - 3
Wall h:2.0 - 3
Deep wall - 2
Fake wall h:1.0 - 3
Fake wall h:1.5 - 3
Fake wall h:2.0 - 3
Water - 3
Lava - 3
Sign - 1
Ice + curves - 1 each, up to 5
Conveyor Set 1 - 1 per direction, up to 4 (switcheroos do NOT add surface)
Conveyor Set 2 - 1 per direction, up to 4 (switcheroos do NOT add surface)
Teleporter - 1 per type, up to 8

If your RTW level exceeds 50 surfaces, it has a chance to MAV on exiting the game.

If you change the background to either Water or Lava, the number of surfaces is reduced by 2 if deep walls are present (as these are not rendered).

Here's the test file - enjoy. Thanks to HumanGamer and Lazy Loof for their help in these discoveries.
Attachments
MAVSURFACE.LV6
(2.52 KiB) Downloaded 127 times
Quest for the Five Elements - a 195-level RTW expansion pack
I am also known as Joey_San on Discord.
User avatar
Wonderman109
Rainbow MegaStar
Posts: 3530
Joined: Thu Jun 28, 2012 11:25 pm

Re: Can a level MAV because it is too big?

Post by Wonderman109 » Sun Aug 29, 2021 10:09 am

Wow, talk about subtle limits. Neat find! :stinkyhappy:
gottfriedjacob5
Rainbow Seeker
Posts: 259
Joined: Wed Mar 01, 2017 12:26 am

Re: Can a level MAV because it is too big?

Post by gottfriedjacob5 » Wed Nov 10, 2021 9:54 pm

The largest "official" level is, to the best of my knowledge, "Five Squared, Squared", so the levels can be quite big without crashing.
Post Reply