I’m making maps for a game (not making the game). The dev is using an old version of Unity 2017 5.6.2 and I’ve been banging my head on this problem now for almost 2 months trying to learn/RTFM rather than ask easily found/solved questions on a forum.
I’m trying to make a dense realistic forest and I’ve tried every occlusion trick I could find/figure out, LOD transitions, my realistic models versus crappy sprite based. The only thing that seems to work is 100% sprite based trees which looks idiotic. Not even cartoony low poly models seem to work.
Terrain size has been reduced to 1000x1000. Valley setting with only sporadic Fir placements up high and the dense pine area being a “narrow” valley floor.
I’m unsure if this performance problem is the old version of Unity, the terrible code of the gave dev, my models, or everything together.
-Yes I’ve tried the Unity Tree maker. They look terrible, performance is horrid (in editor and in game) and even trying to create them I often had the tree go invisible which would seem to say ‘too many segments/objects/parts’ rather than kicking out a console message a segment limit exceeded.
Are you using actual GameObjects for your trees? GameObjects have a pretty heavy footprint for something that you will be rendering 1000s of.
Lately I’ve been experimenting with using Graphics.DrawMeshInstanced() to performantly draw large numbers of meshes. I’ve seen some pretty good performance gains for my test project using that so far. There’s also DrawMeshInstancedIndirect which supposedly is even better, but I haven’t played around with it yet. Unity - Scripting API: Graphics.DrawMeshInstanced
1 Like
Your question is a tad outside the scope of what I can answer. The dev has given a “crippled” set of tools to make maps with. So basically enough of the game to make maps, not enough to steal/pirate his code/project base.
All I’ve been doing is modeling my trees, dragging them onto the terrain after some tweaks to things to reduce over head lighting wise etc. When I started getting a decent amount of trees on the terrain I started to see my FPS go from 160+ to 40…20…3! So then I tried the Unity Tree maker. Even making a single tree caused horrible lag. Read up on the fast tree maker, sounds like it’s maybe even worse and performance is about as bad as I’m seeing with the built in tree maker and or importing my own models.
Your link looks more code based which brings me back to my initial point. I’m making maps, not the game. So while I could in theory write my own code I have no clue if it would actually import/run/interact or if updates down the line would kill everything and given how it seems like the dev is either incompetent or learning as he goes I’m really not interested in contributing to his code base. I just want to make a few maps that I want to play…and play.
Just to restate though even trying to use the Unity trees which the mass place defaults to 10000 trees the performance is about as crap as my own trees with none of the realism. This makes me think the issue is with the games code base or the old version of Unity but I had hoped there would be something else I could add to the LOD/Occlusion to pull this off. Knowing games like Escape from Tarkov are being developed on Unity I’d expect there would be enough under the hood to pull of a forest of meager size but again, OLD version of Unity and I have no clue how the dev’s coding could be detrimentally affecting things. In my debugging it really seems like the guy is bottle necking the crap out of the game by tying everything to single timer loops but as far as the rendering no clue.
Yeah, sorry I didn’t really get the full context that you’re just making maps and don’t have access to the codebase.
This will indeed create GameObjects, which is not really an efficient way to render a Very Large Number of things in Unity. This isn’t your fault, but the dev really needs to give you better tools that allow you to use more efficient rendering techniques that Unity offers. I guess the dev is trying to create tools for the community to make maps with? If so it doesn’t seem like he’s really succeeded at making a viable set of tools for you, at least not for your use-case of making a large map with a large number of objects.
That being said, if you really want to get to the bottom of the performance issues, your best bet is to use the Unity Profiler: Unity - Manual: Profiler overview
Of course, since you’re not actually the dev, you probably shouldn’t even bother, but that’s the best way to track down performance issues.
1 Like
So far the dev tools are abysmal but Unity is also rather horrible to work in. I tried importing the tools to a current version of Unity (less horrible to work in heh) but it always fails. The dev had also tried adding an in game map maker but it’s far worse, incredibly limited and has prompted an influx of 12 year olds spaming “I MADE A MAP” where they used the terrain raise/lower a few times and flood the workshop with garbage. I’ve been working on realistic settings with weather/atmosphere and a more ARMA like experience but I suspect that’s come to an end of sorts. Sadly I have some large industrial complex maps in the works where my frame rates are high. Massive objects and object counts…yet some trees bring the game to its knees. All the tricks to reduce mesh size, no textures, kill shadows and reflections, occlusion and LOD transitions. Just seems folly.
Trees sound simple, but rendering them is as complex as rendering any other GameObject in Unity. Thousands of space ships, thousands of Finnish snipers, thousands of tanks, same result. The GameObject system is just not intended for dealing with thousands of them. Unity can do it, but not without code. As already mentioned, there are specialized systems in Unity when you need to deal with extremes that the GameObject system doesn’t handle well, but you’re not going to have access to them if all you are trying to produce is an Asset Bundle (which is what it sounds like you’re doing).
Code which I have no access too heh. I know current Unity can do it but I also know the examples by which I know that are being done by people who have access to the entire code base. Sadly I have no confidence the dev will improve or fix these things so I guess that’s that but thanks for the input. I had really hoped there would be something doable with the access I had.
I am tempted to finish the map and release despite the horrid performance. Maybe one day the dev will pull his head from his arse and address the bugs and performance issues…maybe even update the tool kit to facilitate the instancing technique praetorblue noted.
Still kinda boggles my mind though. Yes I know mass numbers can drag performance down, always easier to do one thing than a million. However I just did some winter/blizzard maps and was able to pull out all the stops for crazy whole map particle effects and keep my frame rates up…but this I die on my sword heh.
If the game only lets you make trees and you want tens of thousands of them, yeah, you’re gonna have a bad framerate time.
With computer graphics the big win is always finding ways to NOT draw what the player thinks is actually there.
Modern games use all kinds of tricks to limit draws: occlusion, impostors, LODs, fog, you name it.
If the codebase you’re making maps against doesn’t support or expose that stuff, there’s not much you can do.
1 Like
I’ve got Occlusion, LOD and Fog going…but it’s definitely not enough. However I’d also wonder why the built in tree editor defaults to 10000 and still renders as poorly. I’d think the instancing for those trees would use more advanced techniques and be outside the code base as far as available techniques because it’s built in and designed for in theory high numbers.