Precaching - Why it sucks.

edited 2006 Sep 17 in Developers
<i>This post was originally made by <b>Yagisan</b> on the dengDevs blog. It was posted under the categories: Blog, Engine, Games, jDoom, jHeretic, jHexen.</i>

Precaching is a fundamental way of improving up the users experience, by making the game appear smoother. It does this by obviously loading the resources before they are needed. However, there is a problem. From a users perspective, deng is failing to precache the level data. The result is often choppy gameplay, and a dissatified user.

Lets analyse a few typical runs shall we:

Our first candidate today is jdoom. jdoom has the largest amount of jpacks available, so is particularly sensitive to failed precaching. Using models from the JDRP 1.01, JDRP 1.1 alpha, and Abbspack 4.01, along with the JDTP, JDEP, and JDUP we sent our happless space marine off to battle the demons of hell, while we analysys how precaching is working.

Map01 loads
<code>P_CheckLevel: Checking MAP01 for errors...
LoadImage: data/jdoom/Textures/Flat-FLOOR0_1.png (256x256)
LoadImage: data/jdoom/Textures/Flat-FLOOR4_1.png (128x128)
LoadImage: data/jdoom/Textures/Flat-FLOOR3_3.png (256x256)
LoadImage: data/jdoom/Textures/Flat-GRNLITE1.png (256x256)
LoadImage: data/jdoom/Textures/Flat-FLAT5_5.png (256x256)
LoadImage: data/jdoom/Textures/Flat-FLOOR0_2.png (256x256)
LoadImage: data/jdoom/Textures/Flat-GRASS1.png (256x256)
LoadImage: data/jdoom/Textures/Flat-FLAT4.png (256x256)
LoadImage: data/jdoom/Textures/Flat-MFLR8_3.png (512x512)
LoadImage: data/jdoom/Textures/Flat-RROCK09.png (256x256)
LoadImage: data/jdoom/Textures/Flat-CEIL3_1.png (256x256)
LoadImage: data/jdoom/Textures/Flat-CEIL1_2.png (256x256)
LoadImage: data/jdoom/Textures/Flat-CEIL1_3.png (256x256)
LoadImage: data/jdoom/Textures/Flat-FLAT10.png (256x256)
LoadImage: data/jdoom/Textures/Flat-FLOOR5_4.png (256x256)
LoadImage: data/jdoom/Textures/Flat-FLAT1_2.png (128x128)
LoadImage: data/jdoom/Textures/Flat-FLAT5.png (256x256)
LoadImage: data/jdoom/Textures/Flat-FLAT1_1.png (128x128)
LoadImage: data/jdoom/Textures/Flat-CEIL5_2.png (256x256)
LoadImage: data/jdoom/Textures/Flat-FLOOR7_1.png (256x256)
LoadImage: data/jdoom/Textures/Flat-FLOOR5_3.png (256x256)
LoadImage: data/jdoom/Textures/Flat-CEIL5_1.png (256x256)
LoadImage: data/jdoom/Textures/Flat-FLAT20.png (256x256)
LoadImage: data/jdoom/Textures/Flat-FLOOR1_1.png (256x256)
LoadImage: data/jdoom/Textures/Flat-FLAT18.png (256x256)
LoadImage: data/jdoom/Textures/Flat-FLAT2.png (256x256)
LoadImage: data/jdoom/Textures/Flat-FLAT23.png (256x256)
LoadImage: data/jdoom/Textures/Flat-TLITE6_4.png (256x256)
LoadImage: data/jdoom/Textures/Flat-CEIL3_3.png (256x256)
LoadImage: data/jdoom/Textures/ASHWALL3.png (256x512)
LoadImage: data/jdoom/Textures/BIGDOOR1.png (512x384)
LoadImage: data/jdoom/Textures/BRNSMAL1-ck.png (256x256)
LoadImage: data/jdoom/Textures/BRONZE1.png (256x512)
LoadImage: data/jdoom/Textures/BRONZE2.png (256x512)
LoadImage: data/jdoom/Textures/BROWN1.png (512x512)
LoadImage: data/jdoom/Textures/BROWN96.png (512x512)
LoadImage: data/jdoom/Textures/BROWNGRN.png (256x512)
LoadImage: data/jdoom/Textures/BROWNHUG.png (256x512)
LoadImage: data/jdoom/Textures/CEMENT9.png (256x512)
LoadImage: data/jdoom/Textures/COMPSPAN.png (128x512)
LoadImage: data/jdoom/Textures/COMPWERD.png (256x512)
LoadImage: data/jdoom/Textures/DOORTRAK.png (32x512)
LoadImage: data/jdoom/Textures/EXITDOOR.png (512x288)
LoadImage: data/jdoom/Textures/EXITSIGN.png (512x128)
LoadImage: data/jdoom/Textures/MIDBARS3-ck.png (256x256)
LoadImage: data/jdoom/Textures/MODWALL2.png (256x512)
LoadImage: data/jdoom/Textures/MODWALL3.png (256x512)
LoadImage: data/jdoom/Textures/PIPE2.png (1024x512)
LoadImage: data/jdoom/Textures/PIPE4.png (1024x512)
LoadImage: data/jdoom/Textures/SPACEW3.png (256x512)
LoadImage: data/jdoom/Textures/SPACEW4.png (256x512)
LoadImage: data/jdoom/Textures/STONE7.png (256x512)
LoadImage: data/jdoom/Textures/SUPPORT2.png (256x512)
LoadImage: data/jdoom/Textures/SW1BRCOM.png (512x512)
LoadImage: data/jdoom/Textures/SW2BRCOM.png (512x512)
LoadImage: data/jdoom/Textures/SW1BRNGN.png (256x512)
LoadImage: data/jdoom/Textures/SW2BRNGN.png (256x512)
LoadImage: data/jdoom/Textures/SW1COMP.png (256x512)
LoadImage: data/jdoom/Textures/SW2COMP.png (256x512)
LoadImage: data/jdoom/Textures/TEKGREN1.png (256x512)
LoadImage: data/jdoom/Textures/TEKGREN2.png (256x512)
LoadImage: data/jdoom/Textures/TEKGREN3.png (256x512)
LoadImage: data/jdoom/Textures/TEKGREN4.png (256x512)
LoadImage: data/jdoom/Textures/TEKGREN5.png (256x512)
LoadImage: data/jdoom/Textures/TEKWALL6.png (1024x512)
LoadImage: data/jdoom/models/Monsters/FormerHuman/squish.pcx (256x256)
LoadImage: data/jdoom/models/Monsters/Imp/imp_skin.pcx (256x256)
LoadImage: data/jdoom/models/Monsters/Imp/imp_pain1.pcx (256x256)
LoadImage: data/jdoom/models/Monsters/Imp/imp_pain2.pcx (256x256)
LoadImage: data/jdoom/models/Monsters/FormerHuman/soldier_zombskin.pcx (256x256)
LoadImage: data/jdoom/models/Monsters/FormerSergeant/Soldier_sargeskin.pcx (256x256)
LoadImage: data/jdoom/models/Monsters/FormerHuman/soldier_zombdie.pcx (256x256)
LoadImage: data/jdoom/models/Monsters/FormerSergeant/Soldier_sargedie.pcx (256x256)
LoadImage: data/jdoom/models/Monsters/FormerHuman/zombi_h0.png (256x512)
LoadImage: data/jdoom/models/Monsters/FormerHuman/zombi_h1.png (256x512)
LoadImage: data/jdoom/models/Monsters/FormerHuman/zombi_h2.png (256x512)
LoadImage: data/jdoom/models/Monsters/FormerHuman/zombi_h3.png (256x512)
LoadImage: data/jdoom/models/Monsters/FormerHuman/zombi_h4.png (256x512)
LoadImage: data/jdoom/models/Monsters/FormerHuman/zombi_h5.png (256x512)
LoadImage: data/jdoom/models/Monsters/FormerHuman/zombi_h6.png (256x512)
LoadImage: data/jdoom/models/Monsters/FormerHuman/zombi_h7.png (256x512)
LoadImage: data/jdoom/models/Monsters/FormerHuman/zomb_h0h.png (256x512)
LoadImage: data/jdoom/models/Monsters/FormerHuman/zomb_h1h.png (256x512)
LoadImage: data/jdoom/models/Monsters/FormerHuman/zomb_h2h.png (256x512)
LoadImage: data/jdoom/models/Monsters/FormerHuman/zomb_h3h.png (256x512)
LoadImage: data/jdoom/models/Monsters/FormerHuman/zomb_h4h.png (256x512)
LoadImage: data/jdoom/models/Monsters/FormerHuman/zomb_h5h.png (256x512)
LoadImage: data/jdoom/models/Monsters/FormerHuman/zomb_h6h.png (256x512)
LoadImage: data/jdoom/models/Monsters/FormerHuman/zomb_h7h.png (256x512)
LoadImage: data/jdoom/models/Monsters/FormerHuman/soldier_weapon.pcx (256x256)
LoadImage: data/jdoom/models/Monsters/FormerSergeant/Sold_Mf0.pcx (128x128)
LoadImage: data/jdoom/models/Monsters/FormerHuman/sold_mf2.pcx (128x128)
LoadImage: data/jdoom/models/Monsters/FormerHuman/sold_mf3.pcx (128x128)
PNG-Warning: tRNS chunk not allowed with alpha channel
LoadImage: data/jdoom/models/Items/A-Clip/ammoclip.png (128x128)
LoadImage: data/jdoom/ShineMaps/Metal2.png (64x64)
LoadImage: data/jdoom/models/Items/H-SpiritualArmor/spiritualarmor.png (256x256)
LoadImage: data/jdoom/ShineMaps/Metal3.png (64x64)
LoadImage: data/jdoom/models/Items/H-Stimpack/Stimpack.png (256x256)
LoadImage: data/jdoom/models/Items/H-Armor/Armor_Blue.png (512x512)
LoadImage: data/jdoom/models/Items/H-Armor/Armor_Green.png (512x512)
LoadImage: data/jdoom/models/Items/H-HealthPotion/HealthPotion.png (512x512)
LoadImage: data/jdoom/models/Items/H-HealthPotion/HealthPotion2.png (512x512)
LoadImage: data/jdoom/models/Items/W-Shotgun/WShotgun.png (512x512)
LoadImage: data/jdoom/models/Items/A-Shells/shells.png (128x128)
LoadImage: data/jdoom/models/Items/H-Medikit/MediKit.png (256x256)
LoadImage: data/jdoom/models/Items/W-RocketLauncher/grocketlnchr.pcx (256x256)
LoadImage: data/jdoom/models/Items/W-Chainsaw/gsaw.pcx (256x256)
LoadImage: data/jdoom/models/Player/marine_green.pcx (256x256)
LoadImage: data/jdoom/models/Player/marine_indigo.pcx (256x256)
LoadImage: data/jdoom/models/Player/marine_brown.pcx (256x256)
LoadImage: data/jdoom/models/Player/marine_red.pcx (256x256)
LoadImage: data/jdoom/models/Player/supergun.pcx (128x128)
LoadImage: data/jdoom/models/Player/marine_gun_muzzleflash0.pcx (128x128)
LoadImage: data/jdoom/models/Player/marine_gun_muzzleflash1.pcx (128x128)
LoadImage: data/jdoom/models/Player/marine_gun_muzzleflash2.pcx (128x128)
LoadImage: data/jdoom/models/Player/gsaw.pcx (128x128)
LoadImage: data/jdoom/models/Player/marine_stub.pcx (8x8)
LoadImage: data/jdoom/models/Player/gbfg.pcx (128x128)
LoadImage: data/jdoom/models/Player/marine_bfg_mf0.pcx (128x128)
LoadImage: data/jdoom/models/Player/marine_bfg_mf1.pcx (128x128)
LoadImage: data/jdoom/models/Player/marine_bfg_mf2.pcx (128x128)
LoadImage: data/jdoom/models/Player/marine_bfg_mf3.pcx (128x128)
LoadImage: data/jdoom/models/Player/gplasma.pcx (128x128)
LoadImage: data/jdoom/models/Player/marine_plasma_mf0.pcx (64x64)
LoadImage: data/jdoom/models/Player/marine_plasma_mf1.pcx (64x64)
LoadImage: data/jdoom/models/Player/marine_plasma_mf2.pcx (64x64)
LoadImage: data/jdoom/models/Player/marine_plasma_mf3.pcx (64x64)
LoadImage: data/jdoom/models/Player/grl.pcx (128x128)
LoadImage: data/jdoom/models/Player/marine_rl_mf0.pcx (128x128)
LoadImage: data/jdoom/models/Player/marine_rl_mf1.pcx (128x128)
LoadImage: data/jdoom/models/Player/marine_rl_mf2.pcx (128x128)
LoadImage: data/jdoom/models/Player/gchain.pcx (128x128)
LoadImage: data/jdoom/models/Player/gshotgun.pcx (128x128)
LoadImage: data/jdoom/models/Player/marine_weapon.pcx (256x256)
LoadImage: data/jdoom/models/Player/marine_squished.pcx (256x256)
LoadImage: data/jdoom/models/Skies/Doom2/Sky1/side1.png (512x512)
LoadImage: data/jdoom/models/Skies/Doom2/Sky1/side2.png (512x512)
LoadImage: data/jdoom/models/Skies/Doom2/Sky1/side3.png (512x512)
LoadImage: data/jdoom/models/Skies/Doom2/Sky1/side4.png (512x512)
LoadImage: data/jdoom/models/Skies/Doom2/Sky1/side5.png (512x512)
LoadImage: data/jdoom/models/Skies/Doom2/Sky1/side6.png (512x512)
Precaching took 38.55 seconds.</code>
Not bad, only 38.55 seconds, or is it ? In fact we still haven't finished loading yet. What's next ?
<code>LoadImage: MD2/jDoom/hud/abbspack/punch/punch.png (256x256)
LoadImage: MD2/jDoom/hud/abbspack/Pistol/pistol.png (256x256)
LoadImage: MD2/jDoom/hud/abbspack/shiny.png (72x72)
LoadImage: MD2/jDoom/hud/abbspack/Pistol/pistol_flash.png (256x256)
LoadImage: data/jdoom/models/HUD/Shotgun/hud_shotgun.png (512x512)
LoadImage: data/jdoom/models/HUD/Shotgun/hud_shotgun_mf0.pcx (128x128)
LoadImage: data/jdoom/models/HUD/Shotgun/hud_shotgun_mf1.pcx (128x128)
LoadImage: data/jdoom/models/HUD/Shotgun/hud_shotgun_mf2.png (32x32)
LoadImage: MD2/jDoom/hud/abbspack/chaingun/chaingun.png (256x256)
LoadImage: MD2/metallic.png (72x72)
LoadImage: MD2/jDoom/hud/abbspack/chaingun/mf0.png (256x256)
LoadImage: MD2/jDoom/hud/abbspack/chaingun/mf1.png (256x256)
LoadImage: MD2/jDoom/hud/abbspack/chaingun/mf2.png (256x256)
LoadImage: MD2/jDoom/hud/abbspack/chaingun/mf3.png (256x256)
LoadImage: MD2/jDoom/hud/abbspack/Launcher/launcher1.png (256x256)
LoadImage: MD2/jDoom/hud/abbspack/Launcher/launcher2.png (256x256)
LoadImage: MD2/jDoom/hud/abbspack/Launcher/muzzleflash0.png (256x256)
LoadImage: MD2/jDoom/hud/abbspack/Launcher/muzzleflash1.png (256x256)
LoadImage: MD2/jDoom/hud/abbspack/Launcher/muzzleflash2.png (256x256)
LoadImage: MD2/jDoom/hud/abbspack/Launcher/muzzleflash3.png (256x256)
LoadImage: data/jdoom/models/HUD/PlasmaRifle/plasmarifle.png (512x512)
LoadImage: data/jdoom/models/HUD/PlasmaRifle/plasmarifle1.png (512x512)
LoadImage: data/jdoom/ShineMaps/Metal.png (64x64)
LoadImage: data/jdoom/models/HUD/PlasmaRifle/plasmarifle-fl.tga (256x256)
LoadImage: data/jdoom/models/HUD/PlasmaRifle/plasmarifle-fl1.tga (256x256)
LoadImage: data/jdoom/models/HUD/PlasmaRifle/plasmarifle-fl2.tga (256x256)
LoadImage: MD2/jDoom/hud/abbspack/bfg/bfg1.png (260x257)
LoadImage: MD2/jDoom/hud/abbspack/bfg/bfg2.png (260x257)
LoadImage: MD2/jDoom/hud/abbspack/bfg/bfg_flash0.png (256x256)
LoadImage: MD2/jDoom/hud/abbspack/bfg/bfg_flash1.png (256x256)
LoadImage: MD2/jDoom/hud/abbspack/bfg/energy_flash0.png (256x256)
LoadImage: MD2/jDoom/hud/abbspack/bfg/energy_flash1.png (256x256)
LoadImage: MD2/jDoom/hud/abbspack/bfg/energy_flash2.png (256x256)
LoadImage: MD2/jDoom/hud/abbspack/saw/saw.png (256x256)
LoadImage: MD2/jDoom/hud/abbspack/saw/sawhand.png (256x256)
LoadImage: Md2/JDoom/Hud/v_dssg/HUD_SSG.pcx (640x640)
S_StartMusic: runnin.</code>

hmm, it looks like we continued to load a few hud weapons after precaching was supposed to finish. We should be done now right ? Lets take a stroll though map01
<code>LoadImage: data/jdoom/Patches/STIMA0-hud.png (112x120)
LoadImage: data/jdoom/Patches/AMMOA0-hud.png (224x128)
LoadImage: data/jdoom/Patches/ARM1A0-hud.png (229x126)
LoadImage: Data/Graphics/RadioCC.pcx (32x32)
LoadImage: Data/Graphics/RadioOO.pcx (64x64)
LoadImage: Data/Graphics/RadioOE.pcx (64x64)
LoadImage: Data/jDoom/Shinemaps/HPShine.png (64x64)
LoadImage: Data/jDoom/Shinemaps/Masks/floor0_1.png (256x256)
LoadImage: Data/jDoom/Shinemaps/Gold.png (64x64)
LoadImage: Data/jDoom/Shinemaps/Masks/step2.png (32x32)
LoadImage: Data/Graphics/RadioCO.pcx (32x32)
LoadImage: Data/jDoom/Shinemaps/Masks/tekgren2.png (128x256)
LoadImage: Data/jDoom/Shinemaps/HPShine2.png (128x128)
LoadImage: Data/jDoom/Shinemaps/Masks/support2.png (64x128)
LoadImage: Data/jDoom/Shinemaps/Masks/tekgren5.png (128x256)
LoadImage: Data/jDoom/Shinemaps/Masks/grnlite1.png (64x64)
LoadImage: Data/jDoom/Shinemaps/Masks/tekgren4.png (128x256)
LoadImage: Data/jDoom/Shinemaps/Masks/tekgren3.png (128x256)
A chainsaw! Find some meat!
LoadImage: Data/Graphics/Painflash.png (512x256)
Picked up a clip.
Picked up a clip.
Picked up a clip.
Picked up an armor bonus.
Picked up a stimpack.
Picked up a clip.
LoadImage: Data/jDoom/Shinemaps/Masks/bigdoor1.png (128x128)
LoadImage: data/jdoom/models/Projectiles/ImpFireball/ImpFireball.tga (64x64)
Picked up a clip.
LoadImage: Data/jDoom/Shinemaps/Masks/brown1.png (128x128)
LoadImage: Data/jDoom/Shinemaps/SpecShine.png (64x64)
LoadImage: Data/jDoom/Shinemaps/Masks/exitdoor.png (128x128)
LoadImage: Data/Graphics/Painflash.png (512x256)
LoadImage: Data/Graphics/Painflash.png (512x256)
Picked up a stimpack.
You've found a secret area!
You've found a secret area!
Picked up 4 shotgun shells.
You got the shotgun!
LoadImage: data/jdoom/Patches/SBOXA0-hud.png (320x120)
Picked up a medikit.
You've found a secret area!
LoadImage: Data/jDoom/Shinemaps/Masks/tekgren1.png (128x256)
Picked up a health bonus.
Picked up a health bonus.
Picked up a health bonus.
Picked up a health bonus.
Picked up a health bonus.
Picked up a health bonus.
Picked up a health bonus.
Picked up a health bonus.
You've found a secret area!
You got the rocket launcher!
LoadImage: data/jdoom/Patches/ROCKA0-hud.png (60x135)
LoadImage: Data/jDoom/Shinemaps/Masks/floor1_1.png (64x64)
LoadImage: Data/jDoom/Shinemaps/Masks/spacew3.png (64x128)
LoadImage: Data/jDoom/Shinemaps/Masks/spacew4.png (128x256)
LoadImage: data/jdoom/models/Projectiles/Rocket/PRocket.png (512x512)
PNG-Warning: Incomplete compressed datastream in iCCP chunk
PNG-Warning: Profile size field missing from iCCP chunk
LoadImage: data/jdoom/models/Projectiles/Rocket/rockair_exhaust_3.png (128x64)
PNG-Warning: Incomplete compressed datastream in iCCP chunk
PNG-Warning: Profile size field missing from iCCP chunk
LoadImage: data/jdoom/models/Projectiles/Rocket/rockair_exhaust_8.png (128x64)
PNG-Warning: Incomplete compressed datastream in iCCP chunk
PNG-Warning: Profile size field missing from iCCP chunk
LoadImage: data/jdoom/models/Projectiles/Rocket/rockair_exhaust_1.png (128x64)
PNG-Warning: Incomplete compressed datastream in iCCP chunk
PNG-Warning: Profile size field missing from iCCP chunk
LoadImage: data/jdoom/models/Projectiles/Rocket/rockair_exhaust_2.png (128x64)
LoadImage: Data/Graphics/Painflash.png (512x256)
LoadImage: Data/jDoom/Shinemaps/Metal3.png (64x64)
LoadImage: Data/jDoom/Shinemaps/Masks/flat23.png (64x64)
Picked up a clip.
Picked up a clip.
Picked up a stimpack.
You've found a secret area!
Picked up the armor.
Picked up a stimpack.
Picked up a clip.
Picked up a clip.
LoadImage: data/jdoom/Patches/INTERPIC.png (1024x640)
LoadImage: data/jdoom/Patches/WIF.png (276x36)
S_StartMusic: dm2int.</code>
Well, that was a painful trip. lets analyse it for hq now.

First off, our marine must be showing his age - he was hit 4 times. That pain flash was loaded each time he got hit, causing lag each time. This will cause many marines to die in a crowded firefight, so from this we can recommend <strong>precache the pain animations</strong>

For some reason we didn't cache any of the patches for the HUD. this results in slowdows as our marine checks his hud, upgrades his armour, or changes his weapons. This leads to our second recommendation <strong>precache the hud patches - for all weapons, armour and status indicators</strong>

An interesting anomally appears that for some reason the imps projectiles were not precached. This causes lag when you get attacked the first time. This often causes our marine to take fire, which in turn triggers the pain animation lag. Our third recommendation to increase our marines survial rate is <strong>when precaching the enemies on a level, precache all their states (eg moving, being gibbed) and their projectiles</strong>

Like with the imp, it appears our hapless space marines projectiles were also not cached. It's no fun to lag out espcially when using weapins that could turn our beloved marine into an ex-marine, so our forth recommendation is <strong>precache all player weapons (both hud and pickups), all their states, and projectiles</strong>

We also notice that we have not precached any shine maps. Our fifth recommendation is <strong>precache shinemaps for which a base texture is already precached</strong>

That's it, our marine has made it to map02 ! Onward to further glory

<code>Precaching took 21.18 seconds.
S_StartMusic: stalks.</code>

<code>Level 2: Underhalls
Author: id Software</code>

<code>LoadImage: Data/jDoom/Shinemaps/Masks/starg1.png (128x256)
Picked up a clip.
Picked up a clip.
You got the shotgun!
Picked up 4 shotgun shells.
Picked up a stimpack.
Picked up an armor bonus.
Picked up an armor bonus.
You got the shotgun!
Picked up a clip.
You got the shotgun!
LoadImage: Data/Graphics/Painflash.png (512x256)
Picked up a clip.
LoadImage: Data/Graphics/Painflash.png (512x256)
Picked up a clip.
You got the shotgun!
You got the shotgun!
Picked up a clip.
LoadImage: data/jdoom/models/FX/TeleFOG/TeleFog.tga (128x128)
LoadImage: Data/Graphics/Painflash.png (512x256)
LoadImage: Data/Graphics/Painflash.png (512x256)
Picked up an armor bonus.
Picked up an armor bonus.
You got the shotgun!
You got the shotgun!
You got the shotgun!
You got the shotgun!
You got the shotgun!
LoadImage: Data/Graphics/Painflash.png (512x256)
You got the shotgun!
You got the shotgun!
You got the shotgun!
You've found a secret area!
Picked up a stimpack.
LoadImage: Data/Graphics/Painflash.png (512x256)
Picked up the MegaArmor!
LoadImage: data/jdoom/Patches/ARM2A0-hud.png (229x126)
LoadImage: Data/Graphics/Painflash.png (512x256)
Picked up a red keycard.
LoadImage: data/jdoom/Patches/RKEYA0-hud.png (120x120)
LoadImage: Data/Graphics/Painflash.png (512x256)
LoadImage: Data/jDoom/Shinemaps/Masks/flat1.png (256x256)
You got the shotgun!
Picked up a medikit.
LoadImage: Data/Graphics/Painflash.png (512x256)
You got the shotgun!
LoadImage: Data/Graphics/Painflash.png (512x256)
LoadImage: Data/Graphics/Deaddrip.png (1024x256)</code>

Our marine has made it to map02, and appears to have met with an untimely death to the minions of hell. Lets not have his death in vain and see what new information is in his report.

Our marine appears to have taken a teleporter ride. This would have been a smother ride had the teleporter been precached. Now, while a teleporter mobj does not exist on the map, the map data clearly indicates a teleporter exists, so <strong>we should use map data to precache mobj that will be created in game</strong>
Lets send another marine in to confirm those findings

<code>Precaching took 0.08 seconds.
S_StartMusic: stalks.</code>

<code>Level 2: Underhalls
Author: id Software</code>

<code>Picked up a clip.
Picked up a clip.
Picked up a clip.
Picked up a clip.
You got the shotgun!
Picked up 4 shotgun shells.
Picked up an armor bonus.
LoadImage: Data/Graphics/Painflash.png (512x256)
You got the shotgun!
Picked up a medikit.
Picked up an armor bonus.
LoadImage: Data/Graphics/Painflash.png (512x256)
Picked up a clip.
You got the shotgun!
Picked up an armor bonus.
Picked up an armor bonus.
Picked up an armor bonus.
LoadImage: Data/jDoom/Shinemaps/Masks/comptall.png (256x128)
Picked up a clip.
Picked up a clip.
Picked up a clip.
Picked up a stimpack.
You got the shotgun!
Picked up a clip.
Picked up a clip.
Picked up a clip.
You got the super shotgun!
Picked up a clip.
You got the shotgun!
You got the shotgun!
Picked up a clip.
LoadImage: data/jdoom/Models/Decor/B-SpinalColumn/spinalcolumn.pcx (64x64)
LoadImage: data/jdoom/Models/Decor/B-BloodPool/bloodpool.tga (128x128)
Picked up a clip.
LoadImage: md2/jdoom/hud/v_dssg/hud_ssg_mf1.pcx (128x128)
LoadImage: md2/jdoom/hud/v_dssg/hud_ssg_mf0.pcx (128x128)
LoadImage: md2/jdoom/hud/v_dssg/hud_ssg_mf2.pcx (128x128)
Picked up a clip.
Picked up a clip.
LoadImage: Data/Graphics/Painflash.png (512x256)
You got the shotgun!
You got the shotgun!
Picked up an armor bonus.
Picked up an armor bonus.
You got the shotgun!
You got the shotgun!
You got the shotgun!
You got the shotgun!
You got the shotgun!
Picked up a health bonus.
Picked up a health bonus.
Picked up a health bonus.
Picked up a health bonus.
You got the shotgun!
You got the shotgun!
You've found a secret area!
You got the shotgun!
You got the shotgun!
Picked up the MegaArmor!
Picked up a red keycard.
You got the shotgun!
You got the shotgun!
Picked up a clip.
You got the shotgun!
You got the shotgun!
You got the shotgun!
You got the shotgun!
You got the shotgun!
Picked up a clip.
Picked up a clip.
Picked up a clip.
LoadImage: data/jdoom/models/decor/T-Barrel/Particles/Barrel_Bits.png (256x256)
Picked up a clip.
You got the shotgun!
LoadImage: Data/Graphics/Painflash.png (512x256)
LoadImage: Data/Graphics/Painflash.png (512x256)
You got the shotgun!
You got the shotgun!
Picked up a stimpack.
You got the shotgun!
You got the shotgun!
You got the shotgun!
You got the shotgun!
Picked up a blue keycard.
LoadImage: data/jdoom/Patches/BKEYA0-hud.png (120x120)
You got the shotgun!
LoadImage: Data/Graphics/Painflash.png (512x256)
You got the shotgun!
You got the shotgun!
Picked up a health bonus.
Picked up a health bonus.
Picked up a health bonus.
Picked up a stimpack.
You got the shotgun!
You got the shotgun!
You got the shotgun!
S_StartMusic: dm2int.
</code>

The only new things reported by our second marine is that not all the decor was not cached, even though it is in the mapdata, and that not all states of the decor is cached, so our last recommendation for now is <strong>precache all decor and it's states on the level.</strong>

By implementing these changes, many marines can be saved, and in our war on hell, we need every marine we can get.

Comments

  • Nice analysis. IIRC, the precaching system fails to take into account any game-specific relationships with data, like which projectiles enemies will be using. I think precaching is definitely something that should be addressed in 1.9.0 (I have added a note into the 1.9.0-beta5 release page).
  • Agreed.

    One thing we should do is to rectify the handling of XImages in Infine. We really shouldn't be loading them each time they are used but how to detect when they should be cached?

    Currently I am using State->Exectute to run Infine animations for various effects such as the pain flash when the player is damaged which uses a nice pain graphic. These images are pretty big so we definetly need to do something here.
  • One sufficient solution would be introduce "precache" commands (I think Quake C had something like them) so that the addon/mod author would have the responsibility of precaching stuff. It gets awfully complicated if the engine has to figure out all of the precached resources itself. Particularly with InFine, where the scripts aren't parsed in any fashion prior to execution.
  • That sounds like a good solution for InFine. After precaching we must not upload the graphic upon each use also.
  • <i>This comment was posted by dengDevs user <b>scandalon</b>.</i>

    So...what, exactly <b>isn't</b> precached then? (And what's the memory footprint of all this? Yes, the size of the datasets used from original doom era are pretty small by today's standards, but if you start adding in high-res textures for, well, everything...) If all your cached data ends up swapped out to VM then it's kinda pointless, no? (I don't know the performance penalty of extracting data from a wad/lump)
Sign In or Register to comment.