View Single Post
Old 29 June 2023, 12:06   #448
Muzza
Registered User
 
Muzza's Avatar
 
Join Date: Sep 2019
Location: Sydney
Posts: 357
Quote:
Originally Posted by Don_Adan View Post
Seems You dont understand me, my english is poor.
I know that WHDload alloc memory only once.
But Your game alloc memory many times.
MUST ALLOC MEMORY ONLY ONCE TOO.
f.e. for chip memory You need:
2x320kB for screen buffer
graphics data for Level 1 and music for Level 1 in total 500kB (You choosed the biggest value from all T2 AGA levels)
other data located in chip memory 100kB
then in total You need maximum of chip memory equal 2x320+500+100=1240kB
and You allocated 1240kB of chip ram only ONCE, via BSS_C or AllocMem.
Later game is handling this chip area for all game levels, intro and outro.

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.
Muzza is offline  
 
Page generated in 0.04685 seconds with 11 queries