Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

RTS Toolkit

Discussion in 'Assets and Asset Store' started by chanfort, Jun 6, 2014.

?

Which phase of RTS Battle Simulator need improvements?

  1. search

    40.0%
  2. approach

    31.4%
  3. attack

    57.1%
  4. self-heal

    22.9%
  5. death

    14.3%
  6. rot (sink)

    22.9%
Multiple votes are allowed.
  1. Don-Megel

    Don-Megel

    Joined:
    Dec 4, 2016
    Posts:
    16
    I was thinking of rifles. I fear that rendering the projectile would be a waste of resources, would it be better to just check to see if the bullet hit and then inflict damage?

    Great about Gaia, do you think an abundance of trees would cause an issue with the pathfinder? Like a forrest
     
  2. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    Oh, if it's bullets you may not need projectiles at all. You can try straight lines, i.e. rays from the rifle to target. Then you can check which targets are close to that line (I think there is basic detection in selection manager for click selection). Finally for these targets, which are close to the line you can add MeshCollider just for a single Update frame to do more precise check through ray casting if bullet hits the target, and finally remove MeshCollider.

    I think if it causes problems with trees for pathfinding, you can try to reduce avoidance radii for trees to leave more walkable space around.
     
  3. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    uRTS version 5.3 has just been released. All the following features and fixes are now live:
    - Renderer upgrade (fixed flickering and improved performance)
    - Updated unit models
    - Added procedural rock placer and in-game falling rocks
    - Improved birds flying AI
    - Environment sounds now are placed on all generated terrains
    - Added player in game controls for RTS and RPG cameras, Graphics settings and Notifications
     
  4. Don-Megel

    Don-Megel

    Joined:
    Dec 4, 2016
    Posts:
    16
    How much would it hurt performance to have some random objects attached to some of the infantry to make them look less like clones? Say, different hats, different swords, different textures, different sash, etc.
     
  5. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    I think it depends how large is your variety. If you have 10 different hats and 100 infantry units, on average 10 of each unit will wear the same hat. So you would probably still benefit from instancing. Another way could be to use hats, swords, etc as separate objects - then they could be instanced or batched separately from the character. One way or another, performance scales down with increasing variety of objects with the worst case scenario when all objects are unique and there is nothing to instance/batch. But I guess it's hard to get to that point, as you would need to have hundreds of variations. So there is probably in most cases some level of benefits from instancing/batching.
     
  6. Don-Megel

    Don-Megel

    Joined:
    Dec 4, 2016
    Posts:
    16
    I was thinking maybe two or three hats per unity type (So all Knights are one unit type, for example). What about different textures?
     
  7. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    I guess it depends what texture actually represents. If it's the whole UV map of the character, then you can use the same characters with different materials, which uses different UV maps. If the texture is a small detail of the character (i.e. cloth, flag in the hands, etc.) then I would use the same object but also with different materials - in that case you could also benefit from instancing/batching.
     
  8. Don-Megel

    Don-Megel

    Joined:
    Dec 4, 2016
    Posts:
    16
    I was thinking same character with a different texture, so different looking clothes, face, etc. This wouldn't cause too much of a performance hit?
     
  9. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    Well, in that case use separate materials with different UV maps. It will also scale with increasing number of variations. If you open up Graphics Settings menu in game and tick-untick "Units instanced shader" you can find performance difference between best and worst case scenarios. If textures are not adding additional objects but uses instead just different materials, performance should not go worse than not using "Units instanced shader".
     
  10. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    An update for selection marks and health bars is coming up:

     
  11. Don-Megel

    Don-Megel

    Joined:
    Dec 4, 2016
    Posts:
    16
    What do you recommend for poly counts for each LOD level? Also, how about texture sizes for infantry?
     
  12. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    It's a piece of art and depends on the purpose of the game. I would keep creating LODs until geometry becomes unrecognizable, i.e. several hundreds to 1000 vertices. It can be several thousands of vertices. I usually keep lower resolution textures, such as 256 and 512 pixels. But I would probably set everything in a way that I could regenerate models and textures easily for higher or lower resolutions if needed.
     
  13. Don-Megel

    Don-Megel

    Joined:
    Dec 4, 2016
    Posts:
    16
    I have purchased your code, thank you. As I read through the documentation I think you mention that animations are resource intensive. Does this mean I need to keep the animations for the units as uniform as possible? So I shouldn't have 3 or 4 idle animations for one unit?

    Forgive me if I am incorrect, I am an artist, not a coder.
     
  14. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    Well, if unit has more animations, more meshes are baked, what makes that more memory is taken to store meshes. Another thing is how many frames are baked per animation, i.e. good number can be 20-30 for simple animation cycles of 2-4 seconds. If you have longer animations, i.e. 10-20 seconds, you may want more frames. But each frame is one static mesh baked and stored in memory. So more frames you will have, more meshes are stored in memory.

    You can simply calculate if you have 4 idle, 4 walk, 4 attack and 4 death animations in total it will be 16 animations on unit. If each animation has 20 frames, there will be created 20x16=320 meshes in memory. If there are 5 different types of units in the game, then total number of meshes would be 320x5=1600.

    You can also duplicate RenderMeshModels gameObject and have multiple versions, i.e. one for units with just one animation and another for the same units but with several animations. And then you can flip between one or another to see how performance is changing (You should have only one RenderMeshModels gameObject active in the scene - another one should be disabled).
     
  15. Don-Megel

    Don-Megel

    Joined:
    Dec 4, 2016
    Posts:
    16
    When you say frames stored in memory, your talking about the 3d sprites?
     
  16. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    No, it's 3d mesh also being baked as static mesh for each frame and stored in memory.
     
  17. Don-Megel

    Don-Megel

    Joined:
    Dec 4, 2016
    Posts:
    16
    Oh my, ok, so if an infantry unit could have two different styles of rifle, and two different styles of sub machine guns, with 1 idle, fire, and reload, animation for each, that's 12 animations per unit just for weapons? Is there no way to reduce the burden animations place on the engine?
     
  18. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    At the moment it would be like that. It might be possible to set in a better way, i.e. if rifles would be as separate objects. So for example for rifle 1 and 2 could be just 1 fire animation. But if rifles are different, then humanoid animation for fire could be also slightly different, what would make 2 animations instead of 1.
     
  19. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    A new version (2017.1) of uRTS is now released. Now I changed versioning and it will continue as 2017.x. New features includes:
    - Added Journeys mode
    - Multithreaded terrain splatmaps, rivers and sea scripts
    - Added Shuriken based selection marks and health bars
    - Remade splatmap and forest biomes
     
  20. vertigostudios

    vertigostudios

    Joined:
    Oct 1, 2012
    Posts:
    101
    Hi Chanfort, has anyone used it for lets say a ww2 RTS, if so - how well does it handle vehicles with and without weaponry.
     
  21. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    That's a good question. Since now development was centred on medieval styles (i.e. swords and archery). But now I have some plans to make very basic "bullet based" weaponry system. I am not sure if others managed to get there yet.
     
  22. vertigostudios

    vertigostudios

    Joined:
    Oct 1, 2012
    Posts:
    101
    Thanks for the reply, I'll keep a close eye on its development.
     
  23. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    The system might be quite generic and it may only have very basic setup, which could get you started. It's likely that it will not fulfil your needs, so instead of just waiting, you can start doing your own implementation of it.
     
  24. HeadClot88

    HeadClot88

    Joined:
    Jul 3, 2012
    Posts:
    736
    Hey @chanfort - I just purchased your uRTS toolkit. Loving it so far.

    Got a few requests tho -

    1. Would it be possible to make an example / Tutorial showing how to use the procedural generated worlds separate from the uRTS toolkit? I am trying to make an first person RPG with RTS elements - So the players walk around the map in a first person perspective adventuring and such.

    2. Out of the box support for World Streamer would be awesome so we do not have to deal with floating point issues when we get far away from the world origin.

    I do not want to go into too much detail about our project yet. :)
     
  25. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    I am glad to hear that you like the environment. The environment is separate part from RTS already. The easiest way would be to try to put first person camera controls and redirect calls from scripts into that camera instead of RTSCamera. Alternatively you can use RTSCamera but disable "WASD" controls over the camera and use your FPS character instead.

    I am looking forward how to easier implement external environment generators like World Streamer. It's not yet in uRTS but the plan is to make scan option, which would keep regularly scanning for new terrains and putting them into reference lists so that the system could easily "talk" with terrain environment.
     
    Last edited: Feb 2, 2017
  26. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    Long awaited character setup tutorials are finally out. Try to grab some character assets and check how they work for your game:
     
    HeadClot88 likes this.
  27. patodonald

    patodonald

    Joined:
    May 4, 2015
    Posts:
    4
    Does this asset have trading system?
     
  28. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    No, trading is not there. But interesting idea for the future maybe :)
     
  29. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    So I just made "Scan" option, which will allow to scan for terrains generated by external packages. It works nicely with MapMagic, here I made couple of videos:


    It should work with other terrain generators and streamers, but it may need some particular tweaks in each case.
     
    FrozenEmpire and Adrad like this.
  30. SaggitariusStudios

    SaggitariusStudios

    Joined:
    Jun 16, 2016
    Posts:
    1
    hi there i know that my question sounds stupid and yes i know that 20$ ain't that much of money

    but you considering
    a discount will be appreciated

    thanks in advance
     
  31. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    So the next part I am updating is economy:
     
    JBR-games likes this.
  32. Legend458

    Legend458

    Joined:
    Mar 13, 2016
    Posts:
    190
    Hey, this kit looks interesting. I just have a couple of questions.

    1.What if there are multiple players that go online? How would they connect to the different servers? The video you posted didn't seem to have any customisation for the multiplayer aspect? Like if there was a server list that would be cool.

    2. Is it easy to add your own buildings and soliders etc?
     
  33. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641

    Ok, here could be some answers:

    1. At the moment I am using Unity's UNET multiplayer setup. However, there may appear some bugs as I looked into multiplayer long time ago. It uses default Unity servers. The idea is that each player would get its own nation and economy as well.

    2. This is much easier than (1.) - you just register your unit prefabs in RTSMaster list of rtsUnitTypePrefabs. The behaviour of the unit is set through UnitPars (it's unified for all types of units, i.e. buildings and soldiers).
     
  34. b15h09

    b15h09

    Joined:
    Apr 22, 2013
    Posts:
    4
    Loving this asset. Thanks so much for putting it together. Just curious if are there plans to update it for A* Pathfinding Pro 4.x? It worked well with 3.8.6, but since upgrading, I'm getting errors about "The nested type `NavmeshTile' does not exist in the type `Pathfinding.RecastGraph'" with AStarCompiler.cs
     
  35. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    Hi, yep, I am working on A* 4.x these days, so hopefully this week or the week after I should have it updated...
     
  36. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    Prepare for VR! Just made a 360 video for YouTube "Travelling East":
     
    JBR-games likes this.
  37. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    So the new version is now live with update to support A* Pathfinding Project Pro 4.x. I tested it on version 4.0.6. Both RecastGraph and GridGraph should be working now. Let me know if you find some bugs :)
     
    b15h09 likes this.
  38. sentar

    sentar

    Joined:
    Feb 27, 2017
    Posts:
    44
    Hi Chanfort,

    I'm a new game developer, and I have become very interested in your asset. Maybe this is related to another post. I just recently imported your asset to test it out, and see if I can use it.

    A problem I am getting maybe similar to b15h09. Do I need to import other assets to get these errors to go away? I was following along with this tutorial:



    : and after 8 mins into the video all these errors started to occur after hiding some UI, Camera etc. stuff seen in the video.

    Edit: The main purpose I am looking for at the moment, is to learn, and use your battle simulator. I am close to my end project and want the satisfaction of having decent size battles in my project :) (Which is huuugee art/resources to perform).

    Also, I cannot click on your drobox link to see your documentation :(.
    Have a great one!

    Sincerely,
    Sentar
     

    Attached Files:

    Last edited: Jul 6, 2017
  39. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    That's great. Congratulations on your project!

    These errors in your picture are coming from A* Pathfinding Project extension. It is probably because one the packages has non-compatible version. Which versions of Unity, A* Project Pro and uRTS Toolkit are you using?

    You should have the recent documentation in your package when importing in Unity. It is directly in Assets/uRTS directory. You can find in this documentation which version of uRTS you have currently imported.
     
    Last edited: Jul 6, 2017
  40. sentar

    sentar

    Joined:
    Feb 27, 2017
    Posts:
    44
    Hi Chanfort,

    Truth be told I do not own the asset A* Project Pro. and for uRTS Toolkit it is 2017.4 Do I need to import A* Project Pro to use your asset? or is there a way around it?
     
  41. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    Ok, so you probably miss clicked in the inspector on "AStarCompiler" gameObject "Use A Star" component the tick "Use AStar". Take a look at this.

    If this is ticked, untick it. Then go to Edit > Project Settings > Player > Other Settings and find the field Scripting Define Symbols. There should be ASTAR typed in there.

    Let me know if any of these would not be present...

    P.S. I also updated the link to documentation, so it should be working now.
     
    Last edited: Jul 8, 2017
  42. sentar

    sentar

    Joined:
    Feb 27, 2017
    Posts:
    44
    Hi chanfort,

    I made sure that "Use A Star" is unticked (it wasn't), and I deleted ASTAR from the "Scripting Define Symbols" and the error went away! :) I will start learning more and more of your asset! :) Thank You for your help!

    Sincerely,
    Sentar
     
  43. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    Well done! Let me know if there will be any other issues.
     
  44. sentar

    sentar

    Joined:
    Feb 27, 2017
    Posts:
    44
    Hi Chanfort,

    I was able to get the A* pathfinding pro to compliment your asset, and now I got another error message unfortunately..

    Assets/uRTS/scripts/AStarPlugin/AStarCompiler.cs(23,26): error CS0426: The nested type `NavmeshTile' does not exist in the type `Pathfinding.RecastGraph'

    I double checked to make sure the Astar pathfinding project had this C# file and it did not sure what caused this error.

    Version urts: 2017.4
    Version A* pro: 4.0.6
     
  45. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    Hmm, that's a weird one. I just checked this on the project, which I uploaded to the Asset Store, but can't get it on mine. How do you get it? Another thing is why is it looking in `Pathfinding.RecastGraph' class? Can you copy the line from the code (should be line 23 in AStarCompiler.cs) ?
     
  46. sentar

    sentar

    Joined:
    Feb 27, 2017
    Posts:
    44
    Hi Chanfort,

    I made a test project for this and this is why it was coming about.

    It happens when I go to Edit > Project Settings > Player and then I add ASTAR into the Scripting Define Symbols

    upload_2017-7-19_19-0-36.png
     
  47. sentar

    sentar

    Joined:
    Feb 27, 2017
    Posts:
    44
    and the other weird part is your A Star Compiler does not show anything like in your video. upload_2017-7-19_19-2-16.png upload_2017-7-19_19-4-0.png
     
  48. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    So can you copy the line 23 from AStarCompiler.cs file ?
     
  49. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    The new version is out. There are plenty of new features, including new UI, more balanced military units, new models for infantry and cavalry units, fixed bugs in switching between battle phases, major multiplayer upgrade, player AI, minimap, game map and more...
    Screen Shot 2017-10-12 at 20.02.43.png
     
    Last edited: Oct 16, 2017
    JBR-games likes this.
  50. Ragnorum

    Ragnorum

    Joined:
    Aug 12, 2017
    Posts:
    22
    Hi, I've bought the toolkit and I'm thinking of making a game out of it, but I havn't found anything in the documentation about upgrades to buildings or units?