All this time I was under the impression that the level and tilemap would be to big to fit in the PS1's RAM all at once. Just because the first BatteryCheck level is so immensely big! I really had it stuck in my head that the level was about 1MB or more in memory. And this added with the TileSet, spashscreen etc....that it would just be to big you know! And that I would have to maybe stream the level data in a preprocessed form from the CD-ROM at a later stage. Until I actually looked at the size of the real uncompressed data in the level file!
The actual file for the level "Binnen.j2l" is just 26KB in it's compressed form. Fully uncompressed that expands into just 295KB! That includes the event map of where all objects are placed, the configuration per layer, animated tiles and finally the tilemaps for 8 layers. These tilemaps use something clever to sort of compress the used space even more. Instead of describing each tile of the map it does this in groups of 4 and references to a group in the layer maps. Let's just say it makes the required space a lot smaller. The exact format can be found here if you're interested (https://www.jazz2online.com/wiki/J2L_File_Format)
Having the uncompressed data made it easy to include that into the PS1's demo EXE and have a go at it. I copy/pasted some of my existing code over into it but it's barely enough to parse the configuration and get the tileid's. And I messed up some of the calculations too which made it not work for a long time...so I did some tricks with the help of the linux version to know where it went wrong. The offset into the tilemap for layer 8 (which is the background) is now hardcoded...but at least drawing it works perfectly now!
And overlayed on top of this is still the fixed hand drawn platform from before. Because the "drawlayer" functions is also quite limited and not capable of drawing the other layers yet for various reasons. But mostly because I can't trust the current offset calculations. I could have the Linux version dump those numbers for now and just have it drawn...and fix it later. Except that "fixing it later" usually never really happens.
Hopefully I get an even more recognizable screenshot soon....the start of the level!
EDIT: And as I had hoped here is a nice screenshot of the start of the level!!!!
It is still a static position as no controller input is processed at all! But it's using the real tilemap as explained above.
The actual file for the level "Binnen.j2l" is just 26KB in it's compressed form. Fully uncompressed that expands into just 295KB! That includes the event map of where all objects are placed, the configuration per layer, animated tiles and finally the tilemaps for 8 layers. These tilemaps use something clever to sort of compress the used space even more. Instead of describing each tile of the map it does this in groups of 4 and references to a group in the layer maps. Let's just say it makes the required space a lot smaller. The exact format can be found here if you're interested (https://www.jazz2online.com/wiki/J2L_File_Format)
Having the uncompressed data made it easy to include that into the PS1's demo EXE and have a go at it. I copy/pasted some of my existing code over into it but it's barely enough to parse the configuration and get the tileid's. And I messed up some of the calculations too which made it not work for a long time...so I did some tricks with the help of the linux version to know where it went wrong. The offset into the tilemap for layer 8 (which is the background) is now hardcoded...but at least drawing it works perfectly now!
And overlayed on top of this is still the fixed hand drawn platform from before. Because the "drawlayer" functions is also quite limited and not capable of drawing the other layers yet for various reasons. But mostly because I can't trust the current offset calculations. I could have the Linux version dump those numbers for now and just have it drawn...and fix it later. Except that "fixing it later" usually never really happens.
Hopefully I get an even more recognizable screenshot soon....the start of the level!
EDIT: And as I had hoped here is a nice screenshot of the start of the level!!!!
It is still a static position as no controller input is processed at all! But it's using the real tilemap as explained above.