Pre-Loading of Game Object Data *edited*

Pre-Loading of Game Object Data *edited*

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Pre-Loading of Game Object Data *edited*

Post by Argh »

As usual... these are just some thoughts, as a result of some practical playtesting. I realise that Zaphod is knee-deep in other things at the moment, so Zaphod, please don't freak out- I type these up when I have a spare moment- that doesn't mean I expect it tomorrow, if ever ;)


Very simply, this is a request that Spring load all game objects into memory during initial startup of a game. This very specifically includes models, their texturemaps, and sound data.

Why? Simply put... if Spring doesn't do that, then mods with hi-resolution texture-maps simply aren't playable. An uncompressed TGA map (the only texturemap format that is 100% compatible with video cards, in my tests) at 1024/1024 (which is not gigantic, by today's standards) takes up nearly 8 MB of data. If compressed via DDS DXT1 (which is acceptable for the color channel), then it's about 512Kb, but the main color and alpha map still won't compress to very small without really yucky compression flaws that will be obvious. This takes considerable time for a hard drive to load into RAM- we're talking a noticable pause here- and that will mean a whole series of sync errors during play, when players will be creating the units for the first time (and, under the current Spring build, that's when the geometry/script/texture is being loaded).

S3Os are the only things really impacted by this. 3DO textures are effectively pre-loaded, since that 2048/2048 texture is being loaded when the game starts (or the Commander is built at start- I should test that with an invisible Commander with no polygons hehe).

Yes, I know that this will mean a drastic increase in RAM usage, and high-resolution mods will take longer to load during startup. But... uh... that's inevitable, when mods move to S3O anyhow. Not preloading just means that such mods are, effectively, not going to be playable online, which is bad.

With today's high-RAM machines available, it should be able to have every single unit, script, sound, texture, etc. pre-loaded if at all possible, for performance's sake. S3O mods will probably require something on the order of 200-300MB RAM at that point (assuming 1024/1024 maps, DDS compression, etc., so that a typical unit comes in around 1.5MB apiece, so a 200-unit mod would run about 300MB, plus about 10MB for sound data, and a tiny fraction of that for Everything Else- scripts, etc., are a tiny part of the dataset in modern games).

But what about people with low-end machines and less RAM then that? Should we leave them in the cold? Nah.

[Edit]After thinking on all of this for a bit, here's a possible solution that would make everybody happiest, I think, including you poor developers. Yes, I do have sympathy for you, despite showering you with lengthy wishlists on a regular basis ;)

This solution is very simple. Allow for mods that featured low, medium and high texure sizes... specified in the unit's TDF description. Instead of having S3O's point towards each texture, it might be preferable to have the TDF do so... but either way would work. Lazy modders would just do one level, but most modders would go ahead and do three (I mean, how much work is it to shrink your 1024/1024 map to 256/256 using Photoshop...). That might be the best solution of all- make preloading mandatory, let users decide what they'd like, and what will perform best for them, but leave all of the work needed to give users available performance options in modders' hands, so that it's not your problem. The more I think about this, the more I think this is the best possible solution- easier to code on your end, and it leaves modders with choices- if I, say, want NanoBlobs to have a "low-end graphics" option with 128/128, crappy-looking maps at the low end, for super-high speed... let me do that- don't force users to wait for their processors![/edit]
IMSabbel
Posts: 747
Joined: 30 Jul 2005, 13:29

Post by IMSabbel »

No.
Just no.

That would totally defy logic and reason.
There is a very good chance some units wont be used, or not used at the same time.
In a typical game, not even half of it will be needed (for example ships, or higher end untis, ect).

What do you mean with "colour map not well compressible". DXT has a fixed compression ratio....
And to load 512k from HD takes about 10-20 milliseconds. If you have lag, than the code that handles the loaded data is at fault
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

<shrugs> I do not see your points at all. If players do not want to see a mod in full graphical glory, or don't have the RAM, they can run in a lower resolution, and then they have no disadvantages. 200 units textured at 128/128 is not a great deal more RAM used than by current mods- we're talking 30MB here. People who don't have 30MB free to load that much content into memory need new computers.

We'll see how much of a real problem this is going to be when DDS is working correctly with the shaders Zaphod wrote for the new version of UpSpring. My suspicion is that this will be more of a problem than you think, but who knows? Until DDS doesn't cause black units in Spring with some video cards, I'm forced to use giant, uncompressed TGAs, which are hardly ideal.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

I already see a very noticeable pause in my games when new units are being loaded. It's not very proffessional looking at all, and should be remedied..
mongus
Posts: 1463
Joined: 15 Apr 2005, 18:52

Post by mongus »

The game beguining, (3-7 min), is usually quiet and could be used to pasively load stuff.
IMSabbel
Posts: 747
Joined: 30 Jul 2005, 13:29

Post by IMSabbel »

Or the game could just try using some kind of non-blocking way to load stuff.
For example, the first time a factory is build is lots of time to preload all the stuff build IN the factory, without need for blocking game progress.
Post Reply

Return to “Engine”