View Single Post
Old 01 July 2023, 10:27   #460
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 56
Posts: 2,024
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.
I rethinked Your loading and I think that for level 1 You must/can load files to next offsets:

B-100k
D-100k
A-400k
C-400k

For level 2 it will be as:
B-100k unchanged
D-100k unchanged
E- 300k
H-100k
F-200k
G-200k
Don_Adan is offline  
 
Page generated in 0.04367 seconds with 11 queries