1. We've introduced thread tags, search within a thread and similar thread search. Read more here.
    Dismiss Notice
  2. We've released our first Timeline Experimental Preview, our new tool for creating cutscenes and more! To check it out click here.
    Dismiss Notice
  3. All Unity Pro perpetual license customers: your special offer to subscribe is ready! Click here.
    Dismiss Notice
  4. Unity 5.5 is now released.
    Dismiss Notice
  5. Check out all the fixes for 5.5 in patch releases 1 & 2.
    Dismiss Notice
  6. Unity 5.6 beta is now available for download.
    Dismiss Notice
  7. Get prepared for the Tizen Mobile App Incentive Program! Read more about the upcoming program here.
    Dismiss Notice
  8. Enter the Microsoft Developer Challenge for a chance to win prizes. Read more about it here.
    Dismiss Notice

uRTS: toolkit

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

?

Which phase of RTS Battle Simulator need improvements?

  1. search

    47.6%
  2. approach

    33.3%
  3. attack

    57.1%
  4. self-heal

    23.8%
  5. death

    19.0%
  6. rot (sink)

    23.8%
Multiple votes are allowed.
  1. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    | Asset Store | YouTube | Twiter | Facebook (ToER) |
    Screen Shot 2016-05-01 at 15.07.28 copy.png
    This thread contains discussions of uRTS: Battle Simulator, available here:
    https://www.assetstore.unity3d.com/en/#!/content/17660

    Documentation is available here:
    https://dl.dropboxusercontent.com/u/248943005/documentation.pdf

    uRTS: Battle Simulator is allowing to simulate RTS battles with 6 phases: searching targets, approaching targets, attacking targets, damaged units self-healing, dying phase, and sinking phase.

    Different phases are used only for suitable objects and full script is attached just to one object in entire game (for example, terrain). This allows the simulation to perform calculations and set parameters for all objects very quickly. Nearest neighbour search, used to find nearest targets coordinates is using kdtree.cs class (with heapsort algorithm for vectors), written by A Stark at 2009 and available here:
    http://forum.unity3d.com/threads/29923-Point-nearest-neighbour-search-class

    WaitForSeconds used for long loops allows to increase performance even further. In general, script is optimised to run with O(n log n) time assumptions. Performance analysis (which is performed in this script too) shows that only 3 - 10 % of time is spent for calculations inside loops of all time with WaitForSeconds.

    Each unit has their individual movement, set by the script, which is independent from other units and makes battles more realistic.

    There are two examples with 4000 units and 12000 units used in scene respectively (click "F" in keyboard to start war):
    https://dl.dropboxusercontent.com/u/248943005/1a.html
    https://dl.dropboxusercontent.com/u/248943005/2a.html

    Less optimised old version is free as demo version:
    http://forum.unity3d.com/threads/3-9k-units-battle-system.223334/

     
    Last edited: Jul 16, 2016
  2. TMPxyz

    TMPxyz

    Joined:
    Jul 20, 2012
    Messages:
    689
    Hi, chanfort,

    I have just checked out the 1a demo, but I haven't quite found out the main idea of this demo.
    I have seen many units on the map, but the distance between them are too huge, and can hardly see the interaction.
    Though I can control the cam movement, but I cannot figure out how to control the units.

    Could you describe what interactions we can do with it and what can we see from that?

    Thanks.
     
  3. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    Currently units control by player is not implemented, but it is on my priority list and I will include it into next release. Battles created by this simulator demo are now more like between two AI, instead of AI-Player battles.

    Scales, which were used in simulator demo are created based on more realistic idea, that units may need to go many kilometers before they reach their targets. I want to check how battles are getting distributed and evolve into such large scales. If you want to shrink scales lets say onto 4 times smaller map, you can set up initially smaller size of map, bake on it Unity navmesh and modify SpawnPoint parameters, that units would be randomly distributed on smaller scales.

    I included documentation link at the first thread, please take a look for more details.
     
    Last edited: Jun 7, 2014
  4. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    New version was just released. It includes many bug fixes as well as these new features:

    1. Basic diplomacy options;
    2. Units selection and control;
    3. Updated demos (available through the same links);
    4. YouTube tutorials.
     
  5. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    I just implemented new realistic archery and diplomacy update to have more than 2 nations in the map. YouTube announcement is available here and demo version with these changes is here. These updates will go live into the asset with next version 1.3 update.
     
  6. primus88

    primus88

    Joined:
    May 14, 2013
    Messages:
    611
    I like this asset. I'm curious if anyone tried to add real units to it (animated soldiers). I think it would be really epic.
    Btw, right now, I guess that the animations are not controlled by the system no?
     
  7. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    Hi primus88, I am thinking to release some first games with animated models at some point with Unity 4.6 GUI, as there will be much easier to make menus and more friendly controllable games.

    At the moment I tried free Spartan King model, but it works well with only few hundred models placed on the scene. I need to make some of my low poly models for this game, but I am terrible at modelling myself :)

    No, at the moment animations would not run, but there are like 10 places in code, where I can easily put
    animation.Play() instead of changing colours, so this part will be easy.
     
  8. primus88

    primus88

    Joined:
    May 14, 2013
    Messages:
    611
    I guess that LOD levels are mandatory for a game of that size :)
    I think you will easy manage to cram together thousands of units with a proper LOD system.

    In my view, next thin you should focus on is to make it more hands-on. Meaning that I want too see that I have more control over the units. That I can identify each of the units (melee, archers, cavalry etc) and give them movement orders / interactions.
     
  9. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    Definitely that LOD will be needed - I am thinking to create like 5-6 versions of models with different number of polys and keep switching them based on distance from camera. However at the moment I am not sure if dynamically switching models in 5-6 radii will not move down performance a lot.

    Oh, yea, these controls will come up together with Unity 4.6 GUI updates applied to my game.
     
    Last edited: Jul 18, 2014
  10. primus88

    primus88

    Joined:
    May 14, 2013
    Messages:
    611
    I recommend the last LOD being a simple billboard. That will make the system ultra optimized :)
    Who knows? Maybe you have the next Total War engine there :D
     
  11. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    Well, I guess I may start with my own LOD (even not very well optimised) at the beginning, as I want to keep my package compatible with Unity Free. This will also make sure that I will know how my LOD will work (it would be not a black box for me at least). I think it is still very far away till Total War engine, but who knows :)
     
    Johny100 likes this.
  12. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    Big improvements are just made in the horizon of having large amounts animated object: 3dSprites are here. Here is the demo how the scene looks like with these sprite models. Videos, showing how this sprites system works are here.
     
    Last edited: Aug 28, 2014
  13. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    Recent updates with 3dSprites and coroutines performance self-regulation brings unseen almost 10k battles with all animations playing at 10 FPS:
    [​IMG]
     
  14. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    Just added simplest demo to Facebook:

    https://apps.facebook.com/urts_demo

    At the moment this is for demo purposes, but if the aim is to use Facebook features then Facebook SDK integration is needed. Good news is that it is working and further steps should include Facebook SDK as well.
     
    Last edited: Sep 4, 2014
  15. technotdc

    technotdc

    Joined:
    Oct 21, 2011
    Messages:
    60
    Hi.....
    I'm thinking of buying this asset .......but I do not like very much 3dsprites results.......I tried the demo and very many soldiers disappear from the screen for a moment

    ¿why in the demo video / webplayer the 3Dsprites become invisible for a moment?
     
  16. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    Hi technotdc, thanks for a message. Yes, this appearing - disappearing issue was staying for a few weeks. I just found the solution a few days ago. The issue was that sprite mesh was not updating. Current version does not have this bug fixed, which will be included in next release. These ones, who already have this asset can tick "Update Mesh" in Linked Sprite Manager attached to prefab.

    Facebook demo is updated - 3dSprites are working without disappearing now.
     
    Last edited: Sep 8, 2014
  17. technotdc

    technotdc

    Joined:
    Oct 21, 2011
    Messages:
    60
    Nice ......thanks
     
  18. technotdc

    technotdc

    Joined:
    Oct 21, 2011
    Messages:
    60
    Hi Chanfort......

    I buy the asset today........¿how can i fixed the appearing - disappearing 3dsprites ?


    thanks
     
  19. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    In folder "uRTS/prefabs/spriteManager" there is "SpriteManagerPrefab" with attached "Linked Sprite Manager" script. Place a tick on "Auto Update Bounds", save the scene and everything should work.
     
  20. technotdc

    technotdc

    Joined:
    Oct 21, 2011
    Messages:
    60
    Hi chanfort.......

    i have 2 questions ,please

    1- it is possible to put two or more different 3dsprites in screen ??????
    (one different x nation )??????


    2- it is possible to add atack animations 3dsprites when they are in attackPhase ????
    (only with 3dsprites because in 1.3 version, with models i have already changed )



    thanks

    PD-I like this great asset ,because in my old PC i have a good framerate with hundreds soldiers ;-)
     
    Last edited: Sep 19, 2014
  21. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    Hi, technotdc, yes, these things will be possible to make in the next release (they are already in, but at some point I need to submit the update). There will be these features:
    1. Included knight and archer models;
    2. Initially they will play idle animation, if you will ask to move, they will play walk animations and when they will reach targets, they will play attack animation.
    3. In any script you can change animations just by changing the name of "modelName" and "animName" for "SpriteLoader" script, attached to gameobject, which you want to change.
    4. I made some camera updates as well to make easier to navigate.

    Facebook demo have these changes now included.
     
    Last edited: Sep 20, 2014
  22. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    Just updated Facebook demo with these features:

    1. A bit more friendly graphical environment
    2. Added some statistics (how many units defeated, damage made/got, etc. during battles). Now it's possible to switch between statistic tables with "T" key in keyboard (there is also mode, which hides all statistics).
     
  23. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    Recently I was working on L-Systems a bit to bring realistic trees to Unity. And I got some results. Here is the first view how things looks like for uRTS with my L-Systems:
    Screen Shot 2014-10-19 at 03.40.06.png
    uRTS also has a bit renewed graphical view. You can also take a look at my recent posts about L-Systems. Even if L-Systems will go as another asset, it will be primarily included to uRTS for free (anyone who got uRTS will also get L-Systems automatically on the next update).
     
  24. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    Today I made a small update - selection marks and health bars will be live in upcoming uRTS updates. Press "H" while in game to switch between selection mark and health bar modes. Facebook demo is updated now with this and everyone can check how it looks like.
    Screen Shot 2014-10-20 at 01.03.41.png Screen Shot 2014-10-20 at 01.04.12.png
     
  25. technotdc

    technotdc

    Joined:
    Oct 21, 2011
    Messages:
    60
    cant wait for next update chanfort...................:):):)
     
  26. Johnny-Casual

    Johnny-Casual

    Joined:
    Oct 7, 2014
    Messages:
    15
    Hi Chanfort, just played the Facebook demo, and had a great experience. Was meaning to ask you, will you implement or consider implementing a squad mechanic, putting units into squads or something like that?
     
  27. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    Hi Johnny. Thanks for message. Well, I guess answer would depend what you really would like to get from squads and what they would represent? Would squad represent a group of units, which you would like to keep and easily select/deselect or something else?
     
  28. KaiLiao

    KaiLiao

    Joined:
    Sep 27, 2014
    Messages:
    4
    hi, chanfort I just bought your uRTS
    and I'm using the new version, but it's different from your documentation
    I didn't see the spawnPointBCube and spawnPointBTetra prefabs
    can you tell me how to set up the Battle Simulator system with new version...
     
  29. technotdc

    technotdc

    Joined:
    Oct 21, 2011
    Messages:
    60
    inside he package are 1.3 version project (file zip) the same as documentation
     
  30. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    Oh, I forgetting to update old chapters of documentation, but I will try to do it at some time, that it would not be outdated. By the way, like technetdc said, you can trace things at the moment by looking at the history from zip files
     
  31. KaiLiao

    KaiLiao

    Joined:
    Sep 27, 2014
    Messages:
    4
    but as you said, old version is less optimized
    is it worse if I use old version?
     
  32. technotdc

    technotdc

    Joined:
    Oct 21, 2011
    Messages:
    60
    1- will not be worse if you use version 1.3 (without 3dsprites)......Is perfectly optimized.Might start to begin with this, where the documentation is the same

    2- If you want to use new version, then open the scene "4nations" and looks like this created (It is very easy)
     
  33. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    Yes, exactly. In uRTS/scenes is "4nations" scene. Just double click it and everything is already set up there.
     
  34. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    uRTS update 1.6 is now live. New features are:

    - uRTS: Battle simulator is renamed now as uRTS toolkit, as it is more than simple battle simulator now.
    - uRTS category is now changed from "scripting" to "complete projects".

    - Updated graphical environment
    - Included L-Systems to create trees
    - Selection marks and health bars are now in the asset
     
  35. KaiLiao

    KaiLiao

    Joined:
    Sep 27, 2014
    Messages:
    4
    well done, chanfort! your uRTS system is getting great!
    I really like your asset, it help me a lot with my RTS game, thank you so much!!
    and here is some suggestion that you can do in your next version :

    1. I think Johnny Casual said the "squad" is a good idea, let player can select some units and press a key, then they will become a squad (group), as they have become a squad, you can easily select an squad by clicking on any one of unit and the whole squad will be selected.

    2. the "Formation", once you command an squad to go to somewhere, they will form into a special formation automatically so they will not look messy, and you can make some form for that, e.g. rectangle, one line, arc (for archers)

    I think there hasn't be a War Simulation System in Unity Store like you did, so if you can do this well, that will be awesome, hope someday I can try your Total War Engine:)

    and I hope you can make new version documentation, thanks.
     
  36. Johnny-Casual

    Johnny-Casual

    Joined:
    Oct 7, 2014
    Messages:
    15
    Well I was thinking something like in the total war games. You have lets say a battalion that consist of a 100 men, so i would be able to click on that battalion and all would be selected and then i could give the orders to move in some sort of formation, for example.
     
  37. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    Squads looks interesting in that case. I will try to find out how it would be the best way to put units on squads and dismantle them when player wants. I may also take a look at shapes how units can be distributed when they approaches final point. I think it could be interesting to allow player to chose what form battalion should take and how they rearrange (i.e. knights in the front, archers behind).

    However I am currently waiting for Unity 4.6, as GUI can come any time soon.
     
  38. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    I just updated documentation.pdf simple set-up section to fit recent content. However, I am not sure about "manual set-up" section in pages 3-7. I was thinking if this section is useful at all, as it mainly talks about how to insert gameobjects, bake navmesh and some other simple Unity functions. Did somebody find it helpful, or should I remove it and add some other more advanced content instead of that?
     
  39. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
  40. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Messages:
    693
    nice i have add in wisp list
    in demo i can't select and move unit
    question is as been tested on mobile ?
    have not see why add L-system but why not lol
    any compatibility with Tech tree can be amazing :)
     
  41. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    well, I do not know currently about mobile. If somebody tested what numbers of units are reasonable in mobile, it would be interesting to know. I suspect that you can only detect selection from LMB. However, at some points I may take a look at touch devices too.

    L-Systems will be now as another project, but their trees will play important role in future uRTS releases. The point here is that trees are one of the main components for environment. In other words - what kind or RTS game would be in empty field, without any trees :)
     
  42. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Messages:
    888
    Hi chanfrot.

    Is there any specific reason for using one material/texture per animation pose and not a texture atlas?
     
  43. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    you mean in 3dSprites?
     
  44. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Messages:
    888
    Yes. Wouldn't it be faster to use a texture atlas to pack the poses?
     
  45. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    Maybe. But I am not sure if I understand correctly your question. I was just using SpriteManager:
    http://wiki.unity3d.com/index.php?title=SpriteManager

    where I didn't modified a lot how sprites are displayed. Do I miss something here?
     
  46. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Messages:
    888
    Sorry for the confusion. I am about to buy your system and haven't seen the code. I just saw on the asset store how many materials are beeing used(?).

    I never used sprite manager for this job.

    But I will buy the system anyway because you already have done a good job.

    I would be interested in formations too.
     
  47. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    Well, if you will find something about speeding up maybe with texture atlases, let me know. It might be that there are plenty of channels how I can optimise for further versions.
     
  48. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Messages:
    888
    Alright I bought the package and I must say it is well designed.

    Some first observations:

    I notice some flickering on the sprites from time to time.

    I attach 2 images of the profiler. There is an issue with a lot of garbage collection though.
    I have to investigate more on how the sprite manager works to see if there is room for more optimization.

    And one request: could you make an example also with the real animated meshes?

    edit: I believe that the most overhead comes from having to check every single soldier.
    If it can be done using formations the performance will increase dramatically.
     

    Attached Files:

    Last edited: Nov 19, 2014
  49. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Messages:
    454
    These are very interesting results. I noticed even without profiler (I don't have Unity Pro) that heavy part at the moment is Search phase in Battle simulator. So the first thing which I am looking forward is to optimise searches. There are still issues like making copies of arrays or accessing components through <GetComponent> inside loops, which I noticed is very heavy. At some point I will deal with these things.

    Flickering can be because I am using WaitForSeconds pauses. There I am arranging pauses to FPS rate, so when FPS drops, coroutines are spending more time in pauses. On the other hand when FPS rises, time spend in pauses to time spend in calculations ratio is smaller (more resources are used for updating sprites more frequently). It can be possible that I can smooth out somehow these peaks.

    I think I did some checks with animated meshes, but there was not possible to get more than about 100 meshes with reasonable FPS. They might be useful to use for units which are close to camera, but I didn't found the answer how to optimise that.

    I am still not sure if I understand well how formations work and how they could help here. If you have any clues, let me know.
     
  50. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Messages:
    2,032
    I might consider this for a game I'll be working on next year, The Battle of Gettysburg. Can I use low poly models with this and not sprites? Can I control the movement of units as a group and direct them to areas of battle? Is it easy to customize the weapon, i.e. into an older style 1800's era rifle with a long reload time?