View unanswered posts | View active topics It is currently Thu Jan 16, 2025 11:09 am



Reply to topic  [ 37 posts ]  Go to page Previous  1, 2, 3  Next
 why not zip the mods? 
Author Message

Joined: Mon Aug 16, 2010 7:23 am
Posts: 12
Reply with quote
Post Re: why not zip the mods?
CrazyMLC wrote:
I think what he means is this:

Load the files as compressed files, without unzipping/whatevering them.
After loading is finished, and when, say, an actor is bought and its code is needed, unzip it and store its components in memory.
When all of said actor are killed, you could, say, delete the files from memory.

This would decrease loading times while only slightly worsening performance.

I don't know if it would really work, since I'm not a game developer or anything, but it seems plausible.


yes, I think most of the loading time spent on get file data from disk.
ps: I'm a programmer.


Mon Aug 16, 2010 8:43 am
Profile

Joined: Sat Feb 03, 2007 7:11 pm
Posts: 1496
Reply with quote
Post Re: why not zip the mods?
I think this was mentioned earlier, but a Game-friendly compression would be cool too.
It would create compressed files when the game started and any time after that
It would just run a check to see if the file had been modified since the last time the
game was run, and if it was, it would create a new version of the compressed file.

It would load slow the first time, but every time after that it would move quickly for non-modders.

TLB, considering YOU have inside access to Data (or at least more sway than we do) maybe this would be a good item on the to-do list?
I understand that creating a new file architecture is no simple task, but it may help since the game wouldn't
have to read/interpret user-friendly code, and your RAM would be spared because of the smaller files.

Heck, if .ini code could be loaded as fast as a .lua file, then there would be no problem.


Mon Aug 16, 2010 8:50 am
Profile WWW

Joined: Mon Aug 16, 2010 7:23 am
Posts: 12
Reply with quote
Post Re: why not zip the mods?
TheLastBanana wrote:
In the end, you've got the exact same loading time, but you're distributing it to different places. Yes, you wouldn't have to decompress the files at the beginning of the game, but they have to be decompressed at some point. If you were to do that every time a sprite was needed, it would slow the game to a crawl. Whether you're always aware or not, there can be dozens of different sprites on screen at any given time, and when you consider that sprites will change with animation, that's a whole other layer of complication.
People will probably mention that other games use a compressed file system (e.g. GCF files in Valve games). The main reason for these files is not to decrease load times - in fact, it increases them. It's to keep everything in one place. The other reason Valve's games can use this is that in any given level, the computer knows exactly which models are needed - a level in Left 4 Dead, for instance, is only going to use the models that are included in the level, aside from a limited few models that are included no matter what. Because of this, some loading can be done before the level starts. This approach is used in a lot of games. However, this doesn't work in CC. At any time, in any level, any object could be spawned. Therefore, you either have to load everything at once, or do it on-demand, which, as I mentioned, isn't really feasible.
tl;dr
No, zipping files isn't going to make the game load faster.


the res files will eventually loaded in the RAM,
pack method is only a "pre process" method for reducing loading time,
not change what happens next.

another experience of me, I wrote a program in 4M,
and use upx to compress it to 2M, reduced size and improved loading time...

I know this "packing trick" from a famous game programming book(forgot which one)


Mon Aug 16, 2010 8:51 am
Profile

Joined: Mon Aug 16, 2010 7:23 am
Posts: 12
Reply with quote
Post Re: why not zip the mods?
zalo wrote:
...
Heck, if .ini code could be loaded as fast as a .lua file, then there would be no problem.

the time spend on parse ini file can be reduced by introduce "inic" file,
same as compile "xxx.py" into "xxx.pyc" in python.


Mon Aug 16, 2010 8:56 am
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post Re: why not zip the mods?
In case this wasn't clear, the game isn't storing the INI files themselves, as far as I know. The game searches through the INI files, determines the values of all those variables, and stores the numbers/strings themselves. When it comes time to create an actor, it loads all the data from a preset full of data from the INI files. That said, putting it all into a custom file format would eliminate the need for human-friendly code parsing, and would increase load times a bit. On the other hand, I think this is contrary to what Data wants the game to do - the reason he made it human-readable code is because he wanted it to be open to modding, which is something that a binary file couldn't do.
Now, what you're suggesting is essentially storying the raw data in a cache file of sorts. While that is entirely possible, the question really comes down to whether it's worth it. Unless you've got a ridiculous number of mods installed, the load time isn't that considerable. As well, having a cache like that would greatly bloat the game's directory size. It would be one more thing to code, one more thing to work bugs out of, and at this point in the game's development, one more section of the engine to rewrite. Could it decrease load time? Yes. Is it going to happen? Probably not.

Halida, I'm having trouble understanding what you're trying to say here. No matter where in the process you compress the data, it isn't going to make it load faster. It's simply moving the loading time to another place in the program. At some point, the data needs to be decompressed, and when that happens, you've got load time. In a game like this, the only place that could occur at is either when the program first starts, or on demand. On demand would only slow the game when you first use a piece of data. So, yes, you've eliminated some of the loading time, but instead you're just peppering the loading time across the game. Considering we're talking about an engine that most computers have trouble running without the added stress, throwing decompression operations and storing that data while in the middle of running physics simulations is probably not going to end well.
Also, please use the edit button instead of posting twice in a row.


Mon Aug 16, 2010 9:01 am
Profile WWW
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: why not zip the mods?
CC using streamed gzips would be a terrible idea, however there is some merit to the point that a modern CPU can do things a lot faster in RAM than on-disk, ie loading the compressed data from disk and manipulating (in this case, decompressing) it in RAM. It'd be interesting to do tests on this sort of thing with CC-sized files. I'm expecting that straight-from-disk reading would be faster in the long term considering the size of the files and the fact that they're decompressed entirely for the most part (however, RLE bitmaps load... O_o it's a conspiracy), but there would be a point where it would be more efficient to have the shorter disk -> RAM period and an additional decompression stage if you've got the speed of RAM and a grunty CPU. It could mean CC was even more limited to modern hardware though..

This is speculation though. In reality, with an ~55% ratio of compression (gotten using windows built-in .zip compression on zombies.rte and inspecting filesizes, this would be smaller for .rars with best compression and larger wordlists I suppose) you still need a 45% speed increase in RAM, but you can probably getsomewhere near that using zlib or similar.
It's theoretically feasible to try and squeeze that extra juice out of the hardware, and considering you're going to be putting just as much data in RAM in the long term anyway there's no reason not to try it, but I suppose we'd have to know how Dan puts .rtes into memory to be able to do anything relating to a benchmark... Maybe we could just try iterating all the data in a folder and dumping it to RAM sequentially (not linking anything) and then doing the same with a compressed file but unzipping it in-RAM. I might do something like this later, to see the difference in times on my age-old lappy. I might not, I've got study to do. Considering how good a procastinator I am, I might do it though.

EDIT forgot to mention th 4 posts that happened between me writing this and posting it <_<

The main problem I see isn't the decompression, that's a factor, especially on older hard ware but it's more the fact that you've still got to iterate all the ♥♥♥♥ .ini once you're done with loading it into ram :\ I think Dan might be doing that as he goes (considering how it pauses on some lines longer than others), which would make all of this redundant.


Mon Aug 16, 2010 9:09 am
Profile WWW

Joined: Mon Aug 16, 2010 7:23 am
Posts: 12
Reply with quote
Post Re: why not zip the mods?
TheLastBanana wrote:
...the question really comes down to whether it's worth it...

yes, programmer face trade offs. what to optimize depend on whether or not worth it.

TheLastBanana wrote:
...Halida, I'm having trouble understanding what you're trying to say here. ..

maybe I'm not make myself clear enough,
here is a example:
a mod name xxx.rte,
loading lots of small files take lots of time, like 10s(without parse the files)

zip rte folder into a xxx.rte.zip file,
when game start, load this xxx.rte.zip file, take 1s(1/10 the size of rte folder)
unzip it, take 1s(because gamers have strong CPU, and this unzip process take place in RAM)
so total time is 2s.

edit:
I use 7zip to compress the rtes, takes 17s in my PC, ziped form 62m to 37m,
maybe because there are lots of ogg file..


Last edited by halida on Mon Aug 16, 2010 9:24 am, edited 2 times in total.



Mon Aug 16, 2010 9:15 am
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: why not zip the mods?
You really do need to use realistic values here halida. 40% is just about the best you're going to get for a big mod in terms of compression. Also, I'm not sure how much faster the decompression will be. I'm not disagreeing that it might be faster, just that you need to use realistic numbers or not use numbers at all.


Mon Aug 16, 2010 9:18 am
Profile WWW

Joined: Mon Aug 16, 2010 7:23 am
Posts: 12
Reply with quote
Post Re: why not zip the mods?
Geti wrote:
You really do need to use realistic values here halida. 40% is just about the best you're going to get for a big mod in terms of compression. Also, I'm not sure how much faster the decompression will be. I'm not disagreeing that it might be faster, just that you need to use realistic numbers or not use numbers at all.


if mod contains only bmp, ini, lua, compress rate can reach 1/10(and even more), like : Undead.rte


Mon Aug 16, 2010 9:26 am
Profile
User avatar

Joined: Sun Aug 09, 2009 9:26 am
Posts: 1633
Reply with quote
Post Re: why not zip the mods?
halida wrote:
(because gamers have strong CPU, and this unzip process take place in RAM)

That's a pretty big assumption. My computer has terrible RAM and such, and I play lots of video games. Saying that all gamers have strong CPU is wrong, and making the game even laggier for people without would be a terrible decision.


Mon Aug 16, 2010 10:52 am
Profile
happy carebear mom
User avatar

Joined: Tue Mar 04, 2008 1:40 am
Posts: 7096
Location: b8bbd5
Reply with quote
Post Re: why not zip the mods?
What I'm hearing is that if you decrease the number of files to load, then the disk seek time will be less and speed up loading.
That's perfectly doable without zipping, just put all of your .ini in one file. As well, you can shorten your code by doing as many CopyOfs as is useful to reduce the amount of text in a file. Sounds and sprites can't be put into one file each with offsets to separate, but that would be the next step.


Mon Aug 16, 2010 11:39 am
Profile
User avatar

Joined: Mon Aug 17, 2009 3:00 am
Posts: 242
Location: The Great White North
Reply with quote
Post Re: why not zip the mods?
CrazyMLC wrote:
Compression shrinks files down, yes, etc, etc.

thanks to your avatar, I read that entire thing in the professor's voice. Hats off to you.

Halida, you officially have no idea what you're talking about. Loading raw data will always, always, always be faster than decompressing it then loading it. This is basic computer science. You're trying to add 2 and 2 and get 1. It just doesn't work like that.

EDITL: actually, I lied. If you had a computer with a insanely slow hard disc bus speed or a really big, really fragmented disc and a massive cpu and an insane amount of ram, and a really well written decompressor, then yes, that might be true. But modern computers have a fast hard disc bus and if you watch, it's the ini files that are loading slowly.

Here's some simple proof. Time the amount of time it takes CC to load [Time A]. Now time the amount of time it takes to duplicate your CC folder and divide that by 2 [Time B]. Now subtract Time B from Time A [Time C].

Time B is the amount of time it takes the game to actually load the files from disk. Time C is the amount of time CC spends interpreting those files. Time C is much larger than time A. This is because most hard disks can copy about half a gig per second, meaning it takes about 1/3 of a second to load CC from disk, and 4 seconds [on my machine] to interpret the files.

A better suggestion would be for data to optimize the ini loader. It's bizarrely slow.


Mon Aug 16, 2010 1:54 pm
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: why not zip the mods?
I think the .ini parsing is so slow cause the game is linking everything into classes at that point rather than later, but I'm not sure. It sure as hell doesn't take that long to simply iterate a file and put all the stuff it references into RAM.


Mon Aug 16, 2010 2:39 pm
Profile WWW
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: why not zip the mods?
Yeah, Data's doing something weird with .ini parsing, but it's fairly well known that literally everything .ini wise is all said and done by the time that loading screen finishes. Which, considering the filesize of some mods, is actually pretty good (though quite the RAM bloat).

I said it first, other people have said it since:
Compressing mods is not going to optimize the game in any way, and even if Data did it, the most likely CC related time effect is going to be the next build taking longer.

No thanks.


Mon Aug 16, 2010 5:21 pm
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post Re: why not zip the mods?
halida wrote:
maybe I'm not make myself clear enough,
here is a example:
a mod name xxx.rte,
loading lots of small files take lots of time, like 10s(without parse the files)

zip rte folder into a xxx.rte.zip file,
when game start, load this xxx.rte.zip file, take 1s(1/10 the size of rte folder)
unzip it, take 1s(because gamers have strong CPU, and this unzip process take place in RAM)
so total time is 2s.

I get what you're saying now. However, this is a tradeoff that will inevitably leave some people out. Presently, the game takes longer to load for people with slower hard drives. With this method, the game will take longer to load for people with slow CPUs. You can't guarantee that everybody has a fast CPU. The fact is that you're just pushing the problem to a different part of the computer, and considering the amount of time it would take to implement a system like this into an engine that's already well-established, it really isn't worth it. It would be adding one more thing for Data to work into the engine, when really it isn't necessarily improving speed, but rather changing who experiences slow speeds.


Mon Aug 16, 2010 10:55 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 37 posts ]  Go to page Previous  1, 2, 3  Next

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.054s | 16 Queries | GZIP : Off ]