keenmaster486 wrote: ↑Sat Nov 09, 2019 15:04
@K1n9_Duk3, I'd like to bring to your attention that AR 1.2 now fails to load without a "low on memory" error on real DOS. I've tried with JEMMEX too, which gives me the largest free amounts of conventional, upper, XMS, EMS, etc.
I take it you're referring to this message:
There is not enough memory available to play the game reliably. You can
play anyway, but an out of memory condition will eventually pop up. The
game was meant to be played in DOSBox. You probably won't be able to free
up enough memory on real DOS PCs.
Obvious reading comprehension jokes aside, the fact is that certain levels in Atroxian Realm require about 500k of free memory to be playable at all. And you actually need at least around 518k of memory to play all the levels with music enabled. If you pay attention to the text-based startup screen of the game, you'll see that there's a box that says "Memory Available to Game". If the "Total" amount (Standard + Expanded + Extended) in this box is less than 500k, then you won't be able to play all levels without encountering an "Out of memory" error. Which is exactly what it says in that message at the beginning.
Do not confuse this with the amount of memory you get from DOS when you type "mem". Mem just shows the amount of free conventional memory
before the game is started. The executable itself takes up over 200k of conventional memory, so it is absolutely impossible to run Atroxian Realm without encountering "out of memory" errors if you don't have both EMS and XMS. For example: if you run the game (v1.2) in DOSBox (v0.74), you'll see that the game lists a total of 554k of available memory. This includes 64k of EMS and 63k of XMS. DOSBox also reports 632k of free conventional memory when you enter "mem" at the command prompt. That means you need at least 578k of free conventional memory from DOS in order to run AR v1.2. But there's another issue that I ran into when testing this game (and Keen 4-6 and BioMenace) on actual hardware and that's that the games are unable to use XMS on any of my DOS 6.22 systems. Without the 63k of XMS, it is absolutely impossible to play all the levels in Atroxian Realm.
Unlike Keen 4-6, which just show a "not enough memory" screen and exit to DOS, this source mod actually allows you to play the game even if you don't have enough memory. That's because the part of the code that checks the memory situation was taken from Keen Dreams, not Keen 4-6. That check was also present in version 1.0 of Atroxian Realm, but it didn't use the correct values (it used 335k, the same value that was used in Keen Dreams). After I modified the code to make the game free up as much memory as possible in certain situations that were known to cause "out of memory" errors in v1.0, I took the time to check the memory requirements for every single level (with the built-in M+F10 debug command) both with and without music. After that, I inserted the correct value in the code for the memory check at startup. The code was in the game anyway, so why not make it actually useful? The idea behind this message is that if you
don't see this message at startup, then you should never encounter an "out of memory" crash and should be able to play through the entire game from beginning to end. However, you may still encounter the "insufficient memory for background music" error in-game, in which case the game just skips loading the music, but doesn't crash.
If you're curious: level 21 "Kridonnea Ruins" (Part 2) is the level that requires the biggest amount of memory at 499k without music (I rounded up to 500k for the memory check). With music, it's 510k. The second biggest level is level 8 "Security Layer" at 481k without music and 518k with music. Third is level 6 "Atroxian Mines" at 481k without music and 510k with music. All of these levels must be completed to finish the game.
The only way to lower the memory requirements of Atroxian Realm without altering the game itself would be to use some neat code that Lemm came up with. Lemm's code allows the game to draw the sprites and perform the necessary sprite shifts on the fly while drawing the sprites. This can reduce the memory requirements for certain sprites to 25% of the original amount. The downside of this new code it that it requires a relatively powerful machine (I think at least 33 to 40 MHz) to run at acceptable speeds. Since the vast majority would only ever play this game in DOSBox, this means that the default DOSBox cycle count of 3000 wouldn't be enough and people would have to mess with the cycles settings to get the game running at acceptable speeds. Gridlock once told me that he prefers solutions where people can just run the game in DOSBox without having to mess around with the settings, so I didn't bother adding a feature that would be a benefit for 1% of the audience and an inconvenience for the other 99%.
I haven't actually tested this, but based on my calculations, the shiftless drawing code would reduce the minimal memory requirements from 500k (without music) to just under 400k (
with music). If you're bored, grab the v1.2 source and
Lemm's source modding package and see if you can add the shiftless drawing code to AR.
Edit: The games have issues with XMS on my DOS 6.22 systems, not with EMS.