Level, tile and audio limits

Tools, assembly, and file formats.
Post Reply
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Level, tile and audio limits

Post by levellass »

I WANT to talk to Andy or Xky on this, and I WILL complain if this doesn't occur!


There are many, seemingly arbitrary limits in Keen 4-6, number of songs, number of levels, number of sounds, tiles, etc. Everything is preset and limited.

I want a song for every level, I want to be able to play the high scores if I want, I want more FLEXIBILITY. I KNOW other people would welcome such flexibility and I think it's time we did something about it.

I have a few small pieces of the puzzle, what controls various things, I can do stuff like patching the level warp cheat, but I am far away from being able to do what I want.

My problem is that I have too many places to look; I have no guidance, no direction. Where is the maximum level number set? In the configuration file? In the level entrance code? In several places at once? Does it check for less than a number?, grater than? Less or equal? Not? I need to know, at least roughly, how things work.

I can't do that alone, I know too little about how to read code. I need to contact someone who has explored Keen and knows at least the outlines of how things work, once I have that, I should be able to work out most things by myself. I know there are people out there who know this stuff, so I am asking for your input now. Email me, IM me, post on this topic, I don't care if you have to write me a letter and post it. My mod is half done, and I want to solve these problems before it is finished.

So if you're out there, and you know, contact me.
User avatar
adurdin
Site Founder
Posts: 549
Joined: Fri Aug 29, 2003 11:27 pm
Location: Edinburgh, Scotland
Contact:

Post by adurdin »

levellass wrote:There are many, seemingly arbitrary limits in Keen 4-6, number of songs, number of levels, number of sounds, tiles, etc. Everything is preset and limited.
Most of this is a side-effect of the way the game was put together. They had X number of songs for the game, so they put those into the data file, and used the X in the code, wherever they needed it. So the limits will be buried in the code, like in the condition of a for loop; or more than one place quite likely.
My problem is that I have too many places to look; I have no guidance, no direction. Where is the maximum level number set? In the configuration file? In the level entrance code? In several places at once? Does it check for less than a number?, grater than? Less or equal? Not? I need to know, at least roughly, how things work.
Is there a maximum level number? I wasn't aware of it; at least not if it's less than 100, being the number of slots in the MAPHEAD.

However, if there is, it's likely to be in at least couple of places:

* When Keen presses Ctrl on the map, the code will need to check that the info plane value refers to a valid level; so the code there will quite possibly have a maximum level number hard-coded.

* When the level loads, the 'entering the level' message is shown. This message is loaded from a bunch of strings in the Z segment. The number of levels is implicitly limited by the number of messages here, and the code to pick the right message for the level may also enforce the limit; although the code that loads the string could be alter to read these messages from, say, an external data file.

* Ditto above for the level names as shown on the status screen.

* When the level loads, the music for the level will be loaded; again, there's a table of music indices, with one entry per level, which I believe is also implicitly limited to the number of levels, as with the level strings.

* The saved games need to store the status of completed levels, so the predefined level limit is likely to crop up in the game saving code and the game loading code.

As you can see, increasing the number of levels available is going to be a difficult job, and making sure it's reliable (i.e. that you've patched every bit of code that depended on the number of levels) is likely to be tricky. And each bit of code may check the maximum level number differently--or may not check it at all, and just corrupt memory, or crash, if more than 19 levels are used.
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

Most of this is a side-effect of the way the game was put together. They had X number of songs for the game, so they put those into the data file, and used the X in the code, wherever they needed it. So the limits will be buried in the code, like in the condition of a for loop; or more than one place quite likely.
That is the big problem, I had hoped you knew a bit more about where things might be.
Is there a maximum level number? I wasn't aware of it; at least not if it's less than 100, being the number of slots in the MAPHEAD.
Yes, Keen won't respond to an entry sprite on the map larger than 18 (Keen 4), the warp cheat won't warp to higher than that, nor will the demo (Slightly different limit) and if you DO get in (I found the warp cheat limit) you get a bad music number because the background music function only loads 19 songs. The problem I'm having is that no simple limit (Less than 19, larger than 18 larger or equal to...) seems to work, or even be found in the code I'm looking at.
* When the level loads, the music for the level will be loaded; again, there's a table of music indices, with one entry per level, which I believe is also implicitly limited to the number of levels, as with the level strings.
This is true, however, somehwere a string of x is taken from a specific location (I have this location) and then the level's music value is read off from this depending on the level number (Same with the help music patch, except the value used is not taken from the map sprite but specified.) I fear that the other locations may be similar, and I have not yet figured out how the game sets the string's length.

I see we have a lot of problems.


Right, that's levels, any hints on the sound and graphics limitations? (I'm making some headway on the audio though. Did you check out the partial patch I made?)
Post Reply