- Home /
Optimization of Procedurally Generated Game
Hi. I've been making a rougelike arcade-style fps that generates each level at runtime.
What I've noticed is that lots of the optimizations that I can normally do on my levels, such as occlusion culling, don't work on these levels as they are randomly generated at runtime.
Smaller levels run fine, but if I crank up the settings and generate larger ones -there is a significant performance hit.
So I was wondering... What are some ways that you can optimize levels and objects that are instantiated at runtime? LOD systems seem to work just fine, but my meshes don't have much detail anyway.
I'm looking for alternatives to the built-in lightmapping and occlusion culling systems. If possible. I have seen many solutions on the asset store, but I'm on a $0 budget here.
Also... does static batching still work the same way on objects instantiated at runtime? and is there a preferred type of rendering I should use for this type of game? I'm currently using Deferred rendering due to the number of lights generated in each level, but would one of the other types be more suitable?
Some things that might help:
My game consists of rooms, corridors, and junctions separating segments of the level. Some segments are divided by doors, concealing the next segment.
My game is from a first person perspective, with an overhead orthographic camera rending the radar.
Each room contains randomly generated lighting, enemies, and objects instantiated from pre-set points within it.
Thanks! All help is greatly appreciated!
-Louis
I think this is a common problem (we've certainly faced it too), not helped by the fact that Unity's batching requirements are somewhat arcane!
Static batching will work however the objects were created so long as they don't move. You can also explicitly call $$anonymous$$esh.Combine$$anonymous$$eshes to merge your modular objects together. Not sure if you're using object pooling to re-use objects if the level is created dynamically as the player moves around the level, but this caused us many headaches. Obviously dynamic batching works fine too.
The inabilty to bake lightmaps was our biggest problem - you might need to do clever things with light probes.
What assets did you find? I didn't even come across any paid assets that would help...
I found a free occlusion culling system called $$anonymous$$2H Culling, which seems to do dynamic occlusion culling. Unfortunately, the asset wouldn't update to the latest Unity version properly.
Thanks for the detailed answer, though.