I am pretty new to programming and gamemaking, and I’m currently working on an rts (along the lines of starcraft II) – but obviously no where near it yet. The pretty normal top down (perspective view I think) general rts style game.
The goal, of course, is to have smooth gameplay with lots of units on the screen. My goal is to be able to have 600 - 800 units in my game (so in a two player game, each player has about 300-400 units maximum).
I’m currently working with one model that has 1,112 triangles / 856 vertices. I’m quickly finding out that I can only have about 110-125 units of this particular model on the screen (with full animation) without getting any “framerate skipping”. So the game plays smoothly at about 110 units using a model with 1,100 triangles and using animations. If I turn the animations off, I can use about 200-300 units with smooth gameplay, but that’s without animations. I know that many other factors affect the framerate, such as scenery and terrain and how my game is built etc…
I do not have unity pro, so I don’t have access to the profiler. I am using the free version.
My question really is, is this normal? Is this to be expected?
I have many other questions like:
Should I spend time (or money paying a 3d artist) to make models with about 500-800 triangles/polygons? What is the normal model polygon count on an rts game like Starcraft II (with a max 200 units per player)? Is it really the polygon count, or could it be too complicated animations? Is it my scripting? etc…
125 * 1112 = 139 000 triangles. This is not too much. Modern computers can render something around 1 000 000 triangles. Ofcourse many factors affect on FPS, but triangles count is not your problem.in this case.
Maybe units AI is to heavy? Try to disable all scripts for a test.
And how mush Draw Calls do you have?
Your models can have as more triangles, as you want. According to style of your game. Just use a LoD system if you want. In the RTS LoD system is not necessary, but if you want to magnify your camera to unit, you can use it.
Ok thanks Artaani, this will help me pinpoint it I think.
When I have all of my 125 units clumped together on screen the most draw calls I’m seeing is 368 drawcalls (with ~186k triangles). It’s hard to tell if I see the “framerate lag” when I’m in the Unity Editor. The game runs much smoother in actual builds of course.
I tested it with editing out some portions of script I thought might be causing it, but it didn’t eliminate the frame lag entirely.
Here’s what is interesting, when I turn off animations completely, the game runs smooth – the problem is gone. It seems like animations are causing it. Any advice on animations? I did not make these models myself…if the animations are too long or too “extensive” would that be that hard on the fps?
The animations in the models are like this:
Standby,10,60 (frames 10 to 60)
walk,65,107 (frames 65 to 107)
run,113,147 (frames 113 to 147)
etc…
368 Draw Calls is not too much. So not a problem.
Editor have a little bit smaller FPS then build versison, yes. Also many Debug.Log can dramatically lower your FPS in editor
But what about animations, I am not sure.
Maybe for the animations there is some method to batch it into several similar group. For example like in the Total War. I sure that computer cannot draw all animations for all these Units in Total War, and sure, that there is some trick. But this is only my assumption, so I am don’t know.
Also you can try to change Blend Weights in quality setting of your project. May be it helps.