Hello just curious,
currently making a 30 level mod. And wondering if there is a limit to the amount of objects (or nummeric id's) in a level or map,
Does placing alot of game object in anyway slow down performance ? And are there any other optimisation tips out there for making a good mod? -- eg. not using to many dynamic lights? or ....
In other words, what kind of stuff really hits performance (load times, fps, etc)
Would like to know
is there a limit to object in the game
Re: is there a limit to object in the game
viewtopic.php?f=21&t=9357#p90447
For performance:
- make sure that all the objects that need occluders have them (a missing or incorrect occluder on just 1 wall could totally wreck performance while looking at it, if there's a lot of stuff behind it)
- if you have a high-triangle count mesh that is used a lot, go into the model and rename the regular mesh to "lod0_mesh" and make a low detail mesh named "lod1_mesh". Then use the dissolveStart and dissolveEnd fields in the ModelComponent definition to define start and end distances for fading to the low detail mesh. This is used on most of the pillars, trees, and rocky walls in the original game since there are often dozens of trees or pillars in view at once. You can also use dissolveStart and dissolveEnd without a lod1_mesh to fade to nothing at all; this is used for grass and heather in the original game (in this case mesh name doesn't matter).
- in environments with dense fog you can decrease fogRange[2] to occlude anything further away, but this is not really a good way to optimize because low draw distance is very annoying from a player perspective. (Keelbreach Bog and the Cemetery have fogRange of {0,30}).
- the greater the range of a light source, the more it will hurt performance, and shadow casting and increased shadow map size will increase this. You can disable light casting in some directions with LightComponent:setClipDistance(); this is used for forest_lantern. Also, if you set the fillLight field to true, the light won't be used in low render quality mode.
- when using water, resist the temptation to mark the entire level for reflection, but be careful to still mark everything that does need to be reflected. It's helpful to open the original campaign in the editor and look at how much is painted for reflection.
- DO NOT ALLOW PROJECTILES TO LEAVE THE MAP. This should be blindingly obvious, yet I've already seen it happen in several mods! If you allow a fireball to leave the map then it will never get destroyed and its LightComponent, ProjectileComponent, etc. will have to be updated for the rest of the entire game!
For performance:
- make sure that all the objects that need occluders have them (a missing or incorrect occluder on just 1 wall could totally wreck performance while looking at it, if there's a lot of stuff behind it)
- if you have a high-triangle count mesh that is used a lot, go into the model and rename the regular mesh to "lod0_mesh" and make a low detail mesh named "lod1_mesh". Then use the dissolveStart and dissolveEnd fields in the ModelComponent definition to define start and end distances for fading to the low detail mesh. This is used on most of the pillars, trees, and rocky walls in the original game since there are often dozens of trees or pillars in view at once. You can also use dissolveStart and dissolveEnd without a lod1_mesh to fade to nothing at all; this is used for grass and heather in the original game (in this case mesh name doesn't matter).
- in environments with dense fog you can decrease fogRange[2] to occlude anything further away, but this is not really a good way to optimize because low draw distance is very annoying from a player perspective. (Keelbreach Bog and the Cemetery have fogRange of {0,30}).
- the greater the range of a light source, the more it will hurt performance, and shadow casting and increased shadow map size will increase this. You can disable light casting in some directions with LightComponent:setClipDistance(); this is used for forest_lantern. Also, if you set the fillLight field to true, the light won't be used in low render quality mode.
- when using water, resist the temptation to mark the entire level for reflection, but be careful to still mark everything that does need to be reflected. It's helpful to open the original campaign in the editor and look at how much is painted for reflection.
- DO NOT ALLOW PROJECTILES TO LEAVE THE MAP. This should be blindingly obvious, yet I've already seen it happen in several mods! If you allow a fireball to leave the map then it will never get destroyed and its LightComponent, ProjectileComponent, etc. will have to be updated for the rest of the entire game!
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
- David Ward
- Posts: 103
- Joined: Wed Jan 07, 2015 11:44 pm
- Location: Vancouver, BC, Canada
Re: is there a limit to object in the game
One thing my friend and I found in our first project attempt was that outdoor environments seemed to have a higher impact on memory, and even exporting and loading the game (.dat) file, especially if there were lots of tree tiles placed.
One reason for that was because every single tile on a 32x32 map was being used...but having many tree tiles placed seemed to raise that even more. Underground maps, because they are "walled in", and don't use every tile on a 32 x 32 map, seem a lot lighter on performance.
One reason for that was because every single tile on a 32x32 map was being used...but having many tree tiles placed seemed to raise that even more. Underground maps, because they are "walled in", and don't use every tile on a 32 x 32 map, seem a lot lighter on performance.
Re: is there a limit to object in the game
Trees are expensive compared to flat walls and pillars. An oak cluster has around 4500 double-sided triangles at close distances and 2000 at longer distances, along with 30 bones to animate if it's nearby. Combine that with the fact that outdoor environments have (unavoidably) piss-poor occlusion, lots of other animated plants, and often water, and it's no surprise that they use a lot of (video) memory and GPU/CPU compared to indoor environments.
However, if you aren't on the same level as that outdoor environment then the triangles, plant animations, water, etc. are totally irrelevant. The game still has to update the components on the level every few frames (depending on your distance from it) but this generally won't be significantly more expensive than an indoor level of the same size.
However, if you aren't on the same level as that outdoor environment then the triangles, plant animations, water, etc. are totally irrelevant. The game still has to update the components on the level every few frames (depending on your distance from it) but this generally won't be significantly more expensive than an indoor level of the same size.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: is there a limit to object in the game
thanks, these answers helped me alot