View Single Post
Old 29 June 2023, 15:00   #450
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 2,002
Quote:
Originally Posted by Muzza View Post
Sorry, I don't really understand. Take this simplified scenario:
You have 1000k of Chip RAM total.
Level 1 needs 4 files loaded into RAM from disk:
A: 400k
B: 100k
C: 400k
D: 100k

Level 2 needs these 6 files loaded:
B: 100k
D: 100k
E: 300k
F: 200k
G: 200k
H: 100k

When going from level 1 to level 2, I have two options.
Option 1: Trash A,B,C,D and load B,D,E,F,G,H over it. Zero fragmentation, but I am reloading B and D - increasing loading times.

Option 2: Keep B and D in RAM and discard A and C.
Then I have:
FREE SPACE: 400k
B: 100k
FREE SPACE: 400k
D: 100k

Now load E,F,G,H in the Free Space so I end up with:
E: 300k
H: 100k
B: 100k
F: 200k
G: 200k
D: 100k

Level 2 fits in RAM and loading/decompression is faster because 200k of data was preserved from level 1. The downside is that over time, fragmentation increases.

I remember dealing with this back on the Playstation 1 era. There is no perfect solution, but there are several less-than-perfect work-arounds. For this game I prioritized load times because of the floppy version and because some of the decompression times can be significant too.
Ok, more infos. If file must be depacked then use fast memory to load and depack to chip or fast.
Think how works original Turrican 2. This game needs only 0.5MB chip from $0 to $80000 area.
Then if You allocate 0.5MB of chip ram under OS and relocate all absolute addresses to new values, You can run this game from different memory, but it still needs only 0.5MB of chip.

F.e for original T2, of course I dont remember exactly location.

all ingame music are loaded at $60000, no difference if TFMX song has 60kB or 50kB,
all graphics level data are loaded $20000 and memory area from $20000 to $60000 is
reserved for level graphics data, not important if some levels used f.e only $20000 KB or $30000 KB. $40000 KB of memory is reserved for graphics level data.

Original T2 has short loading screen, then all old level data can be overwritten.

From Your example You need 1000k of memory. Then alloc only 1000k once.

And show short loading screen, and load/depack all necessary to 1000k area.
Don_Adan is offline  
 
Page generated in 0.05143 seconds with 11 queries