Page 1 of 3

about optimization

Posted: Tue Jan 08, 2013 2:29 am
by hyteria
hello

i noticed that with all news mods and custom stuff , our dungeons became bigger and more complexe making the game lagging
so i just want to ask if its change something about loading and using ram if i put a script who destroy all complexe model after changing lvl or one who made pop complexe model every time someone enter or leave a room ? well a system who made thing appear or deseaper depend where the player is

well sorry for my english hard for me to explain , i hope you will understand waht i mean

thx

Re: about optimization

Posted: Tue Jan 08, 2013 10:29 am
by antti
The game does not have streaming. What this basically means is that any unused assets will not be unloaded from memory when they cease to exist in the game world. Since that's just how the engine works there's not much you can do about this expect freeing some memory by not using some of the standard assets (which is not something we advice but which might be necessary in extreme cases).

But when it comes to rendering performance (eg. framerate), destroying assets theoretically could help with the framerate in some scenarios but I would say it's not worth the effort, not to mention that there's a huge potential for bugs there! 3D Models themselves usually have a really minuscule impact on performance (environment assets, monsters, items etc.). Lights typically have the biggest impact on rendering performance but they are hidden by the engine if they are not visible. So if they are off screen or behind a wall, they will not be rendered, but note that doors (including secret doors) will not help here: only solid walls do. So the only thing you should care about is that there's not a lot of lights in the same open area.

To put it simply, my "performance optimization tips for modders" would be the following:

1. If there are no issues, don't do anything. :)
2. If framerate is slow, make sure that you don't have a ton of lights visible at the same time.
3. Make sure that you don't have some custom assets that are not made optimally (like a monster with a bazillion polygons or a particle effect that emits a large number of particles that cover a big portion of the screen)
4. If memory is an issue, make sure that custom assets don't use huge textures. Or just generally cut back on the amount of custom assets that you use in the dungeon.

Re: about optimization

Posted: Tue Jan 08, 2013 12:10 pm
by hyteria
many thx antti this will really help and it was a complete awnser !

Re: about optimization

Posted: Tue Jan 08, 2013 12:19 pm
by Leki
...in other words just do your mod simply clever :-)

Re: about optimization

Posted: Tue Jan 08, 2013 1:15 pm
by Komag
good info, thanks!

Re: about optimization

Posted: Tue Jan 08, 2013 7:05 pm
by undeaddemon
2. If framerate is slow, make sure that you don't have a ton of lights visible at the same time.
So uh... do you have any hard numbers related to "a ton"? Are we talkin' 8 or 18 or 28?

:)

Re: about optimization

Posted: Tue Jan 08, 2013 7:37 pm
by odinsballs
try using cff explorer (freeware) to make te game large memory adress aware (handle more than 2 gig mem) .

Re: about optimization

Posted: Tue Jan 08, 2013 11:08 pm
by HaunterV
odinsballs wrote:try using cff explorer (freeware) to make te game large memory adress aware (handle more than 2 gig mem) .
ah! forgot that this is a thing.

Re: about optimization

Posted: Wed Jan 09, 2013 10:42 am
by antti
undeaddemon wrote:
2. If framerate is slow, make sure that you don't have a ton of lights visible at the same time.
So uh... do you have any hard numbers related to "a ton"? Are we talkin' 8 or 18 or 28?

:)
Compared to the original game, 8 is already plenty but of course we were targeting low spec machines as well and mods necessarily don't have to be as accommodating (although that definitely is a good idea)

Re: about optimization

Posted: Wed Jan 09, 2013 4:33 pm
by Phitt
A few things I noticed:

1. Only torches seem to get culled behind walls. Any other light source will not get culled, at least in my case where the light source was above ceiling level (more or less confirmed by devs btw). So light sources other than torches are even worse for performance than torches, make sure you use as few of them as possible for the best effect and don't use huge values for light range.

2. 8 light sources visible at a time will already destroy performance on low end system and cause a very noticeable framerate loss on average systems. I have a pretty good testing system (which means it is far from high end, but not total crap either - ATI 4890 and Core2Duo e8400) and from my experience there shouldn't be more than 3-4 light sources (3 in a highly detailed environment, 4 in a less detailed environment) visible at a time or my framerate will go below 60, which only happens in the prison levels in the original game (prison levels also have a lot of lights that are no torches, framerate goes very slightly below 60). In my mods I try to stay close to the performance of the original game and in my personal opinion that's what every modder should do.

3. If I'm not mistaken the game renders up to 8 tiles ahead and has a pretty large fov (at least 90°). That is the area that is 'visible'.

4. Keep in mind that some monsters also emit light (slimes, Uggardians, Shrakk Torr, Goromorgs and possibly some others), if you plan to have lots of these in an area you can use even less regular lights.