Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: TerranRich on Thu 16/10/2003 04:55:35

Title: CJ - important resource splitting suggestion
Post by: TerranRich on Thu 16/10/2003 04:55:35
Upon release of my new By the Sword demo, I got two reports of the game not even starting, perhaps due to a memory problem. I have found that no matter what size I set the resource chunks at, the EXE file is still 57.5 MB large. I looked at the help file and apparently certain things must still be stored in the main EXE file. Is it possible to relocate these resources into separate files, like sprites? I have a lot of high-resolution sprites and that might be what is causing such a large EXE file.

Also, would you have any idea as to whether a 57-MB EXE file run on a 733MHz computer with 64MB of RAM would cause any problems?

Thanks :)
Title: Re:CJ - important resource splitting suggestion
Post by: Gilbert on Thu 16/10/2003 05:02:09
I'm not quite sure, but I think sprite datas are always stored in the basic executable, the splitted resources only contain room data.

The original reason for that option was just to speed up room loading time (loading rooms in large games did load slowly in earlier engines), and not for the sake of easy distributions. To have your game distributed in smaller serparate files, you may try splitting it with the archivers (ZIP, RAR, ARJ, etc.) instead.

Quote
Also, would you have any idea as to whether a 57-MB EXE file run on a 733MHz computer with 64MB of RAM would cause any problems?
I think even if it loads, the game can suffer from frequent slow downs caused by the use of (crap) virtual memory.
Title: Re:CJ - important resource splitting suggestion
Post by: Spyros on Thu 16/10/2003 14:51:55
I think in the setup there's an option that allow the player use more memory than the default 5MB
Title: Re:CJ - important resource splitting suggestion
Post by: TerranRich on Thu 16/10/2003 15:28:35
Oh! Do you mean the cache size in the setup, Spyros? If so, I'll try increasing that. I forgot about that option. I had to increase it before when I had less RAM. Hmm. :)
Title: Re:CJ - important resource splitting suggestion
Post by: Minimi on Thu 16/10/2003 15:53:26
No, I set this to 20mb, the maximum, and still it wouldn't run, and it slowed everything of my computer down, with the demo of BtS. I have a 1200mhz, with 128mbram, and 4GB free hd-space... I thought that that should just be enough, doesn't it?
Title: Re:CJ - important resource splitting suggestion
Post by: Pumaman on Sat 18/10/2003 19:56:06
The size of the EXE file shouldn't matter, as Gilbert says it contains all the non-room data.

If your game won't start up then there's a bug - can you provide any more information? Are there any error messages?
Title: Re:CJ - important resource splitting suggestion
Post by: TerranRich on Mon 20/10/2003 05:44:58
For BOYD1981, I *THINK* he said that it just stayed at the loading screen and didn't do anything. It works just fine for me and several other people, so it has to be a memory problem. He also said that he has 64MB of RAM and a 733 MHz processor.
Title: Re:CJ - important resource splitting suggestion
Post by: BOYD1981 on Mon 20/10/2003 10:33:22
i've only managed to get it working by running it in a window and with a 20mb cache, i also freed up more ram and more hard drive space before i tried running it again, i've yet to try run it in fullscreen again, i also turned anti-aliasing off...
Title: Re:CJ - important resource splitting suggestion
Post by: Ishmael on Mon 20/10/2003 12:05:13
Rich, your game if feast for the eye but pain for the computer :P
Title: Re:CJ - important resource splitting suggestion
Post by: Pumaman on Mon 20/10/2003 21:57:00
Ah, erm ... I was just having a little look, and erm ... there appears to be rather a serious memory leak with the TTF rendering code  :-[

So yes, any large games which use TTF fonts would suffer from this problem, I offer my sincere apologies for this gross coding error  ;)

Here's hopefully a fix:
http://www.agsforums.com/acwin.zip

TerranRich: compile the game again with this engine and see if it helps

Everyone else: unzip this new engine into the BtS folder, rename the "bts.exe" file to "ac2game.dat" and double-click the acwin file. See if that helps you.

Title: Re:CJ - important resource splitting suggestion
Post by: TerranRich on Tue 21/10/2003 06:15:45
Hoo-wah! Another obscure AGS bug found and KILLED! ;D

I didn't know you could just rename the EXE file to DAT and open it that way. Interesting. :) When I re-release the demo, all fixed up and debugged, I will compile it using this file. Thanks CJ! :D
Title: Re:CJ - important resource splitting suggestion
Post by: Timosity on Tue 21/10/2003 07:20:21
Would this bug cause any problems with small usage of ttf fonts?

eg. in my game in the top menu gui I have used 2 ttf fonts in two labels, 1 for the game name, and 1 for the score.

that is the only place in the game they are used, I haven't had any problems and neither have any beta testers.

I also guess this bug will be fixed for 2.57 somewhere along the line, and I'll probably update sometime, since I'll be needing more gui's.
Title: Re:CJ - important resource splitting suggestion
Post by: Pumaman on Tue 21/10/2003 20:43:17
terranRICH: hehe indeed - thanks for spotting this and leading me to the problem. It's been reported once before (by Neole I think) and I couldn't work out the cause at the time.
Hopefully that's the last mysterious bug now zapped :)


Timosity: basically, the bug is that for every TTF font in your game, it loads the entire EXE file into memory.
In Terran's case, his game has 3 TTF fonts, and the EXE file is 38 MB, so it was loading 116 MB of data into RAM that it didn't need.

Therefore, it doesn't matter whether you actually used the fonts or not, just how many you have in the game. If your EXE file is small, then the memory leak would also be small and probably not noticable - it's only when the file gets big that the problem really comes out.

Title: Re:CJ - important resource splitting suggestion
Post by: TerranRich on Wed 22/10/2003 03:18:34
Actually, CJ, there are 4 TTF fonts and a 57-MB EXE file. So that's 228 MB being loaded.

Holy crap!  :o
Title: Re:CJ - important resource splitting suggestion
Post by: Timosity on Wed 22/10/2003 04:58:14
Ok so my exe is 37MB so far and 2 ttf fonts so 74MB, so I guess if people have 64MB of ram that might have trouble, although doesn't virtual memory compensate, (it'd probably be ok for 74 but not 228)

I guess it'll be fixed for the next version so thanks  CJ & Terran for figuring that out
Title: Re:CJ - important resource splitting suggestion
Post by: Pumaman on Wed 22/10/2003 20:31:48
Yeah virtual memory would probably make it work, but it would definately be slow.

The point is moot though, because the fix will indeed be rolled into 2.57.