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. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    I recently find out how to use Unity terrain trees instead of 3d Sprites, what brings more optimised solution. They also don't have darkened area effects like we seen in 3dSprites trees. Here I used some of trees with shadows. It seems like performance is still quite good:
    aa.png
     
  2. technotdc

    technotdc

    Joined:
    Oct 21, 2011
    Posts:
    60

    How ???????
     
  3. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    Just use tree GameObjects as terrain tree instances. I implemented everything in code, so it should be more or less things automatic in uRTS. Next - possibility to chop trees and collect resources.
     
  4. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    I am excited to announce that uRTS v2 is now available on Asset Store. There are also 5 videos, covering main updates, which uRTS v2 brings to us:




     
  5. Skyfly

    Skyfly

    Joined:
    Jan 25, 2014
    Posts:
    110
    Does the system fully work with normal 3D objects or is the 3Dsprite thing too integrated? I will have maybe 30-100 units.
     
  6. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    it should work perfectly fine with just 30-100 units used as skinned mesh renderers with all animations. However, if you try above 300 you will start seeing performance drop. To use just regular 3D objects you may need to comment some lines in code, where are calls to SpriteLoader made if you will get errors.

    I am looking forward how to implement that both algorithms would work and user could choose what he wants to use.
     
  7. secondsight_

    secondsight_

    Joined:
    Mar 2, 2014
    Posts:
    163
    Hey,

    I´ve updated to Version: 2.0.1 (Jan 23, 2015).
    Since then Unity can´t decompress the package while importing.
     
  8. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    you mean you can't import and run default scene of v2.0.1 ?
     
  9. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    Great news for those ones who are looking how to use 3d units with uRTS. Now there will be possible to use together 3dSprites and skinned (animated) meshes for the same objects. It is done in terms of billboarding distance. For objects, which are close to camera, meshes are used, while more distant objects uses 3dSprites.

    Here is a video how this feature looks like and how to use it:
     
  10. titifluki

    titifluki

    Joined:
    Jan 9, 2015
    Posts:
    23
    Amazing ¡¡¡¡
     
  11. Skyfly

    Skyfly

    Joined:
    Jan 25, 2014
    Posts:
    110
    That looks awesome! Can you give some insights, if the 50 fps is normal? Cause There doesn'tseem to be much on screen, I expected that scene to come in at >100fps?
     
  12. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
  13. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    Hi elias_t again. I think I starting to find out that particle systems might get more expensive than using current 3dSprites. Here we discussed a bit about this question:
    http://answers.unity3d.com/questions/887583/forcing-particle-to-follow-gameobject.html
    It seems that heavy part can be to use SetParticles and GetParticles by feeding large arrays as GameObjects are moving along their curved paths. So I guess the best what could come would be to keep optimising SpriteManager scripts for better performance. Or maybe you had something more specific in mind with that?
     
  14. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Hi Chanfort.
    Very nice update with the 3d animated characters!

    I haven't done any tests since we spoke last time.
    But I will at some point and will get back with benchmark numbers.

    Keep up the good work.
     
  15. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    Great to hear from you elias_t. I will look forward what you will find and may do also some tests myself...
     
  16. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    Finally, after so long time I am happy to introduce grouping system in uRTS:


    Updated demo is available here.
     
    Last edited: Feb 9, 2015
    elias_t likes this.
  17. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    Recently I just added free edition of uRTS into Asset Store. Forum discussions also have separate thread for it.

    So now everyone, who was unable previously to afford uRTS can now use free edition for free. That free edition is based on v1.1 of uRTS.

    Full edition contains all advanced features, which has been added since v1.1. Active development will be ongoing for full edition, while free edition will get mainly just some small bug fixes.

    The aim of free edition is to open access to developers, who can't afford full edition, as well as learning purposes, i.e. YouTube tutorials, where we can go deeper into source code.

    The aim of full edition is to bring most of RTS genre games elements into single better organised asset and to ease RTS game development processes.
     
  18. titifluki

    titifluki

    Joined:
    Jan 9, 2015
    Posts:
    23
    any news to new update ?????
     
  19. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    Yep, there are coming better organised and more clear scene advanced set up, gameplay speed adjustments and... levelling system. It should come in upcoming 1-2 weeks.
     
  20. Imillionaire

    Imillionaire

    Joined:
    Dec 14, 2012
    Posts:
    60
    I followed the tutorials and when implementing spawners in my own scene, they dont spawn anything. but im not getting a single error code or anything in the console.

    In the scene i have:
    Terrain with Battle System attached
    RTS Master GO with script attached
    Barracks with spawner for swordsman
    nothing happens
     
  21. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    hi imillionaire, it can be anything from the following things: spawning number set to 0, spawning models don't render, etc. The best think would be to check if gameObject, named "yourModel(Clone)" appear in inspector after you click "Pause". If so, check what are their positions, if they are close to barracks, or somewhere else. And finally check if these swordsman have SpritesLoader script attached. You can also try to use cube meshes for debugging purposes before using your own sprites (if that's the case).

    If it still does not answer the question, let me know more details.
     
  22. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    As Unity 5 is here, I am happy to tell, that uRTS is fully working with it and you can quite easily upgrade existing version to work with Unity 5. However, there are a few areas, where care should be taken: NavMesh needs to be rebaked and skybox textures fixed.

    Bad side is that it may take a while while I will check if everything works really well there, as well as start to adopt recent Unity 5 features. This may push next update of uRTS probably not in 1-2 weeks, as I mentioned before, but more likely 3 weeks or a month.
     
  23. Imillionaire

    Imillionaire

    Joined:
    Dec 14, 2012
    Posts:
    60
    So ive made some modifications to the package for my own needs. I'm having one (hopefully last) major issue. Let me explain the current scenario, and how i'd prefer it to turn out.

    at the moment if a unit(A) finds a target(B) that is far away, he(A) will approach it, and ignore all other targets(C) until he's(A) either killed, or killed the target(B). the problem then being that other units (C) will approach (A) on his approach there, but they:
    1. wont pursue (A). they will approach him till melee range, then stop - as (A) continues walking towards (B).
    2.unit(A) won't research targets and switch to a newer target (C).

    what'd i'd like to happen is either make it so units will periodically (every second or so) search for new targets, while theyre approaching their current target (so if they encounter a new target that is closer, on their way to their original target, they'll switch and defend themselves).

    Also it would be great if i could make units chase and pursue their targets, rather than stopping the first time they reach them, but not chasing them if their target moves out of range. (all though i hope this issue would be solved by the previous amendment).

    I'm pretty decent at editting code, so if you could help point me in the right direction that would be great. i imagine all i might have to do is set a invoking a repeating function that simply reruns the search field every second or so, unless currently attacking someone.
     
  24. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    Hi Imillionaire, very interesting thoughts. At the time when I was writing search and approach coroutines I used search calls at lowest priority, as it was quite heavy to run this kdtree and find neighbours. So this ended up to reduce search calls as much as possible. At the moment there is only one check to reset target - if distance between target and attacker is not decreasing in approach phase for critical amount of counts, attacker is moved back to search phase. This helped me to get stuck units "unstuck" really quickly.

    Now in Unity 5 it seems like kdtree searches are not so heavy as NavMesh (I can see things in Profiler, as it is free now). So it might be worth to add some additional searches for those units, which are on approach phase. In that case you can have two search lists - original searchers list (for those who don't have targets / killed their targets) and those ones, who are approaching their targets. Target list would be global list and used for both searchers lists. This second searchers list would allow to run searches without breaking original setup and you can decide then, which set up you can use better :).

    In fact I was thinking to implement another kdtree, like this one:
    https://code.google.com/p/kd-sharp/
    where I may gain more performance from its dynamical functionalities, like add or delete individual items to the tree, search for k-th neighbour, etc. This would save a lot of time as I would not need to rebuild kdtree so frequently and I could spread attackers more efficiently to their targets.
     
  25. Imillionaire

    Imillionaire

    Joined:
    Dec 14, 2012
    Posts:
    60
    that sounds great, do you have any idea when this may be released for the Unity 5 update? your asset is great and has so far done what 3 other packages ive purchased cannot. this is what i believe to be the final obstacle before i have my core gameplay ironed out.
     
  26. markb123

    markb123

    Joined:
    Mar 1, 2015
    Posts:
    8
    really like both versions - support is really good too - i was going to reply to lmillionaire as its the navmesh bake that was stopping the units spawning -anyway keep it up :)
     
  27. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    I am still not sure when I will put update on Asset Store, but I think it can be somewhere in 3 weeks. At the moment I was polishing UI and reorganising scene set up with possibility to set uRTS on empty scene. However, I can't fully promise that I will implement this secondary search coroutine for approachers in this update, but I will keep it in mind - this should be definitely implemented when I will do BattleSystem.cs revamp.

    You can also leave feedback on Asset Store page, to make sure, that others, who are coming to look at what is uRTS would find also your record :)
     
  28. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    I just updated the Asset now, so it is compatible with Unity 5. There are also some new features, like RTS compiler, levelling system and game speed adjustment in game (they are not well described in documentation, so I will keep you to experience them yourself for a while :) ). There will be some tutorials coming up about these new features soon as well.
     
  29. titifluki

    titifluki

    Joined:
    Jan 9, 2015
    Posts:
    23
    Nice update ¡¡¡
     
  30. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    Thanks. Here are videos, introducing new uRTS features:


     
  31. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    There was recently actively arising some questions about how to integrate uRTS setup and when documentation will be revamped. At the moment I am giving top priority for organising script linking information, which is automatically done when running RTS Compiler. Until this unified system is not approached, I will keep updating documentation with adding just key features and how to use them. I am also open to answer your more specific questions while this development phase is ongoing.

    P.S. Documentation is "open source", and everyone who are interested to contribute in updating it are welcome.
     
  32. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    Just started to work on town development AI. Here is the timelapse of first results:
     
  33. titifluki

    titifluki

    Joined:
    Jan 9, 2015
    Posts:
    23
    wow ¡¡¡¡¡

    very good point , AI can now build own town ....amazing ¡¡¡¡


    and I have a question .......

    so with the new RTS compiler
    you can start a clean scene with some buildings / units less ?????
    (eg. only with castle, barracks and only swordman,archer)

    then I have to also edit the ID number in the prefabs ?

    thanks
     
  34. Cartoon-Mania

    Cartoon-Mania

    Joined:
    Mar 23, 2015
    Posts:
    320
    In the mobile game The trend these days is a city builder game
    i think You seem to have the ability to make it
    are three any chance to make 3D City builder game template?
     
  35. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    To titifluki: Thanks. Well, at this time RTS Compiler is just a startup point when you want to integrate uRTS into your scene. However, if you want to exclude several buildings, I think it wouldn't work very well, as there are some scripts, which are accessing these buildings during runtime. The easiest way at the moment would be to prevent player to make these buildings. But I should find out eventually how to set up things that you would be able to exclude unwanted units, buildings and scripts which you don't need.

    To Cartoon Mania: I guess it depends on the game you are looking at. I am currently doing this AI with the purpose that at the beginning nations will have like a few houses, they will collect resources and grow up their towns by building new buildings and creating more new workers, and larger troops. What will come next we will see :)
     
  36. x_ming_x

    x_ming_x

    Joined:
    Jan 1, 2013
    Posts:
    46
    Hi there
    nice addon, i bought a copy and im trying to get it to work in unity 4 pro, ( i bought it whilst in the unity 5 demo )
    should it work with latest unity 4 pro im gettin compile errors ?
     
  37. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    You probably should "downgrade" NavMesh and change all shaders from new standard one into these legacy ones, which in 4.x cycle was used as diffuse or something similar. Check also what does these errors say and as a first step you can google them :) . You can also check previous versions archives, which I included as zip files. Future updates will not guarantee to work with Unity 4.x cycle as I am eventually optimising everything for Unity 5.
     
  38. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    Recently I worked with revamping search phase and could say, that I implemented resets option while units are on search phase. Firstly, I rewrote Search coroutine from scratch into separate BattleAI class, which will also have more realistic functions for military decisions in future. This reset approachers phase at the moment looks quite heavy, as there are quite a lot of approachers on the terrain moving while they reach their targets. I implemented job system, which takes units from the pool and uses only those ones, which are longest not reseted. With this I am getting about 100-200 units per 0.6 s at 40 - 60 FPS rates. These loads gives also quite good comparison with NavMeshAgents performance. However, larger loads starts to affect FPS quite heavily. There seems to be still space for optimisations, so it should look quite good. I noticed, that it doesn't solve some issues, as there are cases, that units starts scattering between several targets as they become more close than original ones they are attacking. This leads to lower killing rates, but in fact this approach gives probably larger efficiency than without reseting.

    I should compile new timelapse and demo these days, so you will be able to check yourself how it's working.
     
  39. titifluki

    titifluki

    Joined:
    Jan 9, 2015
    Posts:
    23

    any news ?
     
  40. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    Yep, mainly working with AI's these days (mainly 3 of them - diplomacy, search and town development AI's), as they are very time consuming.

    It's getting closer to what I keep in mind, so once I finish it, documentation should get also updated.

    So next update should come within the month or so.
     
  41. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    ToER is getting unified score system implemented. Here is very rough scheme of that:
    TOeR scores.png
     
  42. titifluki

    titifluki

    Joined:
    Jan 9, 2015
    Posts:
    23
    wow ¡¡¡¡¡¡
     
  43. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    Here are some tips how to combine uRTS with other projects:
     
  44. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    uRTS just got Retro version released!
    https://www.assetstore.unity3d.com/en/#!/content/35084

    This version is designed for Unity 4.x cycle users. It is based on uRTS v2, which stability was monitored for a long time before Unity 5 was released. So now everybody, who has their projects working with Unity 4.x cycle can now use uRTS Toolkit Retro. Note that this asset is completely separated from the main uRTS Toolkit for Unity 5.
     
  45. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    So recently the main work is ongoing on AIs. It appears that there are needed at least 4 AIs in order to get things working properly and scenes looking more naturally: BattleAI, WondererAI, Town development AI and Diplomacy AI. Here is a short view what each of them does:
    BattleAI. This AI is replacing old Search phase in BattleSystem.cs. It includes betters searching functionalities, i.e. distributing attackers over group of targets, refreshing approachers for new targets if old ones are getting to far, etc.
    WondererAI sets units to visit neighbour nations. Each nation is sending small amount of it's military units in order to see what neighbours are doing and better prepare for war if threat is upon the sending nation.
    Town development AI is responsible for what buildings and how many of them are built in the town. It also controls what units and how much of them are being spawned from barracks. This AI also controls workers in order to collect resources needed for development.
    Diplomacy AI decides when to declare a war, to beg for mercy or to enslave neighbour nations.

    All 4 AI's are closely linked, for example when Diplomacy AI decides that it is time for war, Wonderer AI navigates units towards safe spots and finally when it is collected enough military power, all units are leaded into enemy's town and Battle AI is driving the war.

    It seems that system is working quite well at the moment, but there are still some unwanted behaviour appearing in Wonderer and Diplomacy AI's. So to it will take a bit more time in order to release higher quality update.
     
  46. ElusiveJacob

    ElusiveJacob

    Joined:
    Mar 10, 2014
    Posts:
    7
    Hi, Chanfort!

    I am super interested in getting your system, and the battle AI changes seem to be very interesting going forward.

    I Was looking around for an RTS AI That could handle a large amount of units, and yours seems to be starting in the right direction.

    The design i have in mind however has little to no spawning involved, and will be heavily based around formations of units set up at the start of a battle.

    Are formations something you are considering when making the upcoming update?

    PS: Right now if i have the agents in the scene as it starts up, and manually add them to the unit buffer, they pick only the static targets in the back. EG:



    What would be the best way to approach handling a static start amount with your system?
     
  47. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    Hi ArachinidJacob, I keep formations in mind, but they will probably be a bit later, as with the next update there will be mainly updates for these AIs. By the way, what exactly would you be interested about formations?

    I am not quite sure if I understand correctly, but it should be updating that targets would not be static - it assigns static destination point to move, but as targets moving around the map, points should get refreshed quite frequently in approach phase. Do I miss something here?
     
  48. ElusiveJacob

    ElusiveJacob

    Joined:
    Mar 10, 2014
    Posts:
    7
    It looks like the points are not getting refreshed, its a very basic setup, dragged and dropped the cubes and tris from the project folder, put the battlescript on the plane after giving it a navmesh, and manually added them to the buffer list, and hit play. They only seem to target the "enemies" that dont move (the gray ones) and they dont pick new targets until the first ones are dead.

    I'd like the ability to have the soldiers "tethered" to a formation, similar to how units in Cossacks, Age of empires and other games of that genre move. I'd like the ability for units to have skirmishing and charge AI as well.

    The game im going for is for setting up formations on both sides at the start,(similar to total war) then starting a battle and have them go at each other automatically.
     
  49. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    641
    Oh, that's weird - are you using uRTS toolkit free ? Did you checked if it's the same in default scene (which is included in the project)?

    P.S. Are you using 2D or 3D terrains?
     
  50. ElusiveJacob

    ElusiveJacob

    Joined:
    Mar 10, 2014
    Posts:
    7
    Yeah im testing the free toolkit, and its a 3D plane, its not in the default scene (that one works fine)