PreCache.con

Ask questions, discuss ideas, get answers
Post Reply
anselmus
Posts: 82
Joined: Sun Oct 18, 2009 6:42 pm

PreCache.con

Post by anselmus »

What is "PreCache.con? What is and how it can be used?
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: PreCache.con

Post by Apache Thunder »

For me the quickest way to make one of these is to run your map with the debugger, then use the console command "game.writePrecache" to write a Precache.con file at the game's root folder. You can then copy this file to your map.

The command is exactly as follows:

Code: Select all

game.writePrecache
There are no settings for this command, thus do not place a "1" or anything else at the end of it. Doing so will result in the console rejecting the command.
ImageImageImage
I have cameras in your head!
anselmus
Posts: 82
Joined: Sun Oct 18, 2009 6:42 pm

Re: PreCache.con

Post by anselmus »

But what is the real objetive or reason to have Precache.con on some maps?
At what time will be necessary to create a file "Precache.con?
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: PreCache.con

Post by Apache Thunder »

Generally I don't really notice a difference between not having one and having one. I guess it would have some effect on slower machines. But my machine is a beast and so it is impossible for me to tell the difference. :P

I assume Precache was meant to cut down on lag associated with loading object meshes and such midgame (judging from the debugger logs the game always loads ALL the game coding at map load, so it doesn't cache object coding as far as I can tell). So things like meshes and textures are cached faster via the Precache so it doesn't have to load them ingame when the object spawns. But machines these days are easily able to do this on demand and the Precache doesn't do much now.
ImageImageImage
I have cameras in your head!
User avatar
Senshi
Posts: 697
Joined: Sun Oct 18, 2009 1:14 pm
Location: Germany
Contact:

Re: PreCache.con

Post by Senshi »

You got it right.

The files defined in the PreCache.con are loaded to RAM during map load. This means that they are already "available" for the engine once they have to be rendered when they enter the players visual range. If they weren't precached, they would be loaded only once they appear in your field of view. Back in the old days when BF42 was brand new on the shelf this could cause tiny lag issues on some machines (Those computers that were pure crap even then, and are considered medieval today). Even the worst of worst currently existing hardware sets don't benefit from the Precache.con anymore, so it's completely safe to just ignore it in about EVERY case.

When I created the vehicle test maps for BG42 I tested the Precache.con, because those maps had an extreme number of unique and complex vehicles on it (test map, eh...). Without Precache, I got a slight (like a splitsecond) lag the first time I put the full ground vehicle park in view. Which are several hundred unique meshes and textures in BG42.
When I did the same WITH a Precache.con, this teeny tiny lag was gone. So unless you intend to swarm a kingsize-map with gargantuan loads of vehicles, you are safe without Precache.
freddy
Posts: 1267
Joined: Sun Oct 18, 2009 4:58 pm

Post by freddy »

Senshi wrote: Back in the old days when BF42 was brand new on the shelf this could cause tiny lag issues on some machines
it was a bit annoying when your screen froze and started to lag when you met a enemy vehicle that wasnt in the memory yes.

especially Desert Combat took (on that time) a lot more resources of your computer
Jeronimo
Posts: 196
Joined: Sun Dec 27, 2009 8:55 pm
Location: Germany
Contact:

Re: PreCache.con

Post by Jeronimo »

I still have this on certain BG42 maps when they forgot to put some vehicles in the Precache.con. You'd take a flag and suddenly your screen stands still for a second or two, because several vehicle types spawn for the first time and need to be loaded from HDD first. :oops:
Image
Post Reply