Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

RTS Skin Renderer question.

Discussion in 'General Discussion' started by N1warhead, Dec 30, 2014.

  1. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    Hey guys, I'm making a game like an RTS but in first person (same concept) just first person instead of Overhead camera.

    I'm quickly realizing (Even with Overhead Camera) or FPS Camera.

    That lets say I have 50 people on the map, it bogs out like a M'F'er lol.

    So how exactly can I get lets say 50 (Animated) characters on a map (Like C&C Generals).
    There has to be a way to do this, otherwise how is any RTS game possible on Unity.

    I've look this up for 12 hours now and I have gotten know where.
     
  2. CaoMengde777

    CaoMengde777

    Joined:
    Nov 5, 2013
    Posts:
    813
    how many polys do the characters have?? ... or you having problems with cubes/capsules ??

    lower polys, lower res textures, texture atlases, lower draw calls ... how many draw calls do you have? ... use LOD

    how many bones per armature of the characters? .. i got rid of fingerbones because its just unnecessary, for my use anyway..

    i was making a rts game, and i made it up so that the soldiers have different equipment, armor, boots, helmet... and it DIES by having too many draw calls :(


    i guess i havent yet tried all so many dudes animated yet.. i guess the literatures say to have only 1 skinned mesh renderer per character .. like, my soldiers would have a few, for armor,

    ....
    i guess networked RTS is hard to do in Unity, correctly, huge bummer to me.. they say to use lockstep .. i didnt get that far with my RTS project, got severely demoralized trying to figure out how to do networked RTS .. with the lockstep, gotta use, Not the built in physics, or much of the Mathf stuff ... i guess?? ... seems really lame..
     
  3. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    400 Polys.

    16 bones + root so 17 lol.

    Just necessary bones, no fingers or toes.

    E.G. - (1 spine, 2 bones per arm, 2 leg bones, 1 head bone (for neck and head)., root, and joints to hold the bones realistically at least (so 4 joints) and 1 bone at the end of hand and feet for IK Solvers.

    (I don't have pro) so I can't do lod or anything. Well there are makeshift ways of doing it.
    But I was trying to make a game like Rome Total War, but in FPS view. But I don't think it's going to happen to be honest lol.

    But I was getting 1 draw per person, but I was getting 78 MS for Rendering and Main Thread lol.

    I guess off to the next idea haha.
     
  4. CaoMengde777

    CaoMengde777

    Joined:
    Nov 5, 2013
    Posts:
    813
    http://answers.unity3d.com/questions/383742/skinned-mesh-renderer-vs-mesh-renderer.html

    i guess theyre saying to have less skinned mesh renderers per LOD ...

    sucks how limiting somethings are ... well at least its not atari haha
    .. lol, in a way i was hoping youd have other problems, but it seems you kept it minimal... i mean like, my dudes i made were less optimal than yours
     
  5. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    I just don't get how games like Rome Total War can have 10,000 People running around like a breeze and not have an issue, unless there's something I'm not understanding how they did it.

    I know they travel in Cohorts and stuff (Small armies) of like 50 people (At least on the game).

    But when they start fighting other enemies they break off and start attacking one person at a time.

    So that's 10,000 Mesh Renderers (at least from the way I am seeing it). lol.

    I mean dang, imaging being in FPS Mode fighting 5K vs 5K, that be freaking sweet! lol.


    But perhaps maybe it's my crappy I'Core 3 Dual Core 2.4 lol.

    But still doesn't reason to why RTW can work like a breeze but mine don't.

    I was purposing trying to go for optimal (Voxel looking characters) just for the fact I figured it would help with speed.
    But I beg to differ on that one haha.
     
  6. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    RTW has a team which has total of +50-100 years of game development experience. Their engine is highly customized for specific game type with a lot of different tricks (see their dev talks from some events if you can find em).

    You said you used around 12h so far trying to figure out how to do things but how much of that was actually used for gathering info? there is a lot of info about RTS games, or even RTW clones around net :)

    There's a bunch of things you can do, for starters use skinned mesh instancing. You can do a lod system without pro version, etc.
     
    Ony likes this.
  7. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884

    That is true, I figured they had a customized Engine that suits them very well.
    But didn't think it would be much different as bones are bones, is there a different performance wise way to rig characters?

    I'll look into the dev talks if I can find them.

    I'll look into skinned instancing,
    thanks for the advice!
     
  8. CaoMengde777

    CaoMengde777

    Joined:
    Nov 5, 2013
    Posts:
    813
    in rome total war, alot of the animations were synced to all the units,IIRC.. like the archers all fire in unison...
    but yeah, they do become seperate when like swordsman battle

    LOL maybe do it like medieval total war? :D ... then you just have planes lol... hmm thats actually not TOO bad if you make the art correctly.. like those guys in MTW are like 32 x 64 (guessing) .. so they look crappy, they actually dont look that bad though.. .. >< but yeah howd that work out in first person? LOL!! ... itd be like wolfenstien or doom LOL

    ... they mention in that link, NOT using skinned mesh renderers... i guess not using bones, and animate them without bones?? seems hard lol, but, really when i was learning blender, and i saw bones i was like "whoa noo way bones! thats craazy!!" lol i thought id have to animate the verts i guess lol "Doing separate MeshRenderers for each part" .. hmm i guess arms and legs would be different parts or something?? .. weird...

    ..hmm, i kinda lost knowledge of how good that CPU is vs others.. (havent built a PC in awhile)
    but, i used to have a 9800GTS setup, for the longest time, last april i got a low? end $440 PC and suddenly my "unusable" scene with like 300 soldiers, that had "too many draw calls" (not animated though :( ) they were dropping to 8 fps ... eek .. but after the new cheapy PC it stayed at like 36 fps+ .... my CPU and RAM werent so great before, only 4G ram, now its 12, and i guess alot better CPU, quad core, before just dual .. and like from 2010? .. i guess in someways the 9800gts is better than the gpu i have now but.. yeah idk
     
    Last edited: Dec 30, 2014
  9. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884

    Never played MTW before.
    Haha characters looking like they are from Doom that be funny lol.

    Thousands of sprites running after you :p.


    Yeah I haven't built a PC in awhile. So I'm not really up to date on hardware.
    I just know I'm on the lower end of things, but high enough to make a playable fun game lol.
     
  10. CaoMengde777

    CaoMengde777

    Joined:
    Nov 5, 2013
    Posts:
    813
    MTW is basically screenshots of animated 3d models .. from like 8? (actually maybe like 16?? or something) directions, and put on a plane that always faces the camera, and animates
    ... or i guess thats what it is?? ..

    lol i actually kinda miss the way it looked.. i guess it just looked amusing
    LOL ooh yeah.. one of the arabic horse archers.. sephahi? or something looked like itd dance to the music when shooting arrows haha
     
    Last edited: Dec 31, 2014
  11. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884

    Hahahaha nice!!!!

    It might acctually be a neat idea to have thousands of sprites fighting :).
    (If FPS View).

    It would actually be kinda neat.
     
  12. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    First of all, I'm making an RTS too, and I completely feel your pain! Unity, in general, is a huge pain when it comes to trying to put over about a 100 things on screen at one time.

    However, they've been making some small improvements. But Unity is still no where near close enough to being able to handle "Total War" types of numbers. It can barely do "StarCraft 2" types of numbers "out-of-the-box".

    So here are some things that seemed to help quite a bit:

    1. If you're using mecanim animations, check the "Optimize game object" box in the models "rig" settings. This actually helps tremendously by internalizing the (what seems like hundreds of) bone transforms that come with most models. If you already have a model with only a few bones for a rig, then you may not need to do this, but chances are you will and you should use "Optimize game object".

    2. Use only 1 material for every object. This cuts down on drawcalls. Lowering drawcalls helps a lot. A lot of my models use more than one material and even skinned mesh renderer as well, so sometimes a product from the asset store like "Mesh Baker" helps a lot. This will combine your meshes, and put all of the textures into a texture atlas, so that you get as close to 1 drawcall per model as possible. So if you can do this, you should try. Only drawback is that I think an addon like Mesh Baker, if you use it to combine skinned mesh renderers, breaks your ability to use "Optimize game object" as well, which makes you choose between the two -- still havn't figured out which is better or faster yet.

    3. I still havn't tested this, so take this with a grain of salt, but use the "Use gpu skinning" option in the Player Settings before you build your game. I havn't personally tested this, but I think it helps take the work load off of the cpu for skinning. Might help a lot.

    4. In Unity 5.0, things seem generally faster overall, so that might give you a little boost in performance -- but probably only because of other things like faster physics etc... lol.



    #1 and #2 are my top two "settings or procedures" that I think help me the most. Some other things that I consider having to compromise, but might help are:

    - Simply use less bones for your model's rig, or use less vertices, or both. (i.e. use simpler models). Use Level of detail settings as well, if it's that type of game where you need to.

    - When using an Animator or Animation component, make sure the Animation mode is set to "cull" or "cull completely". This will help a lot with performance when units/characters are not on screen.

    - Lower drawcalls in whatever way you can. Maybe try turning down or off shadows. Combine meshes. Use texture atlases (like above). Use instancing or batching.



    Okay, so that's basically all I can think of right now. I've heard of "skinned instancing" as well, and I looked into it for a little bit, but was never able to implement it myself. So, if you can, please let me know :)

    Good luck!
     
  13. 0tacun

    0tacun

    Joined:
    Jun 23, 2013
    Posts:
    245
    How are you handling the Ai? Is the calculation done in Update()? If so, is it necessary to do it every frame?
     
  14. ensiferum888

    ensiferum888

    Joined:
    May 11, 2013
    Posts:
    317
    I'm making a medieval city building game where each villager is simulated. I have one SMR per villager that has about 900 verts and 15 bones. When the game begins you have 16 people I'm at about 140FPS, then when you reach about 100 people the whole thing drops to 70FPS.

    Without any Mesh Renderer I was able to have 600 villagers being simulated at 100FPS so the AI in Update() doesn't seem to be the bottleneck here.

    I can't use Optimize GameObject because my animations do not use Mecanim and I remember reading that mecanim had some overhead compared to legacy animations so that if you have a lot of them in camera view Legacy will give you better performance (don't quote me on this though)
     
  15. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    628
    This function is your friend:

    http://docs.unity3d.com/ScriptReference/SkinnedMeshRenderer.BakeMesh.html

    With a bit of effort, you can use this to implement Quake1/2-style keyframed animation. Instead of requiring a whole hierarchy of bones (slow), and software skinning (slow), you bake a set of keyframes as static meshes.

    Then to make it animate smoothly (without hundreds of keyframes), you need to do a bit of shader work. In each keyframe, store the differences between this frame and the next frame, and use the shader to blend between the two. You can (ab)use the vertex colour and tangents to pack this extra data into (so long as you don't need to normal map or vertex colour your characters).

    The main downside to this is that you can't blend between animation sequences - so you have to accept some amount of popping. If you're making an RTS, you can get away with it, though.