Search Unity

  1. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  2. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Participate with students all over the world and build projects to teach people. Join now!
    Dismiss Notice
  5. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Unity RTS Engine

Discussion in 'Assets and Asset Store' started by OussamaB, Feb 7, 2017.

  1. trement

    trement

    Joined:
    Apr 26, 2015
    Posts:
    1
    May seem basic... but I still haven't figured out how to increase playable map size. Could you add the procedure to the terrain docs please? Thanks
     
  2. mustafad

    mustafad

    Joined:
    Apr 18, 2018
    Posts:
    1
    Good Job for the new release mate everything is working perfectly except there are 2 bugs
    1- when you are in a multiplayer game and activate attack in range a weird sync issue happens to the soldiers and then the game crashes

    2- in multiplayer game villagers can build buildings without checking if they are near the building they just start building from any distance they want
     
  3. jobo22

    jobo22

    Joined:
    Dec 1, 2016
    Posts:
    74
    I made a new map but I'm having problems. When I build a unit, they move to their Go To position, but then when I select them I can't move them. And I can't select units with box select, I have to click on them directly. When I try to create a building, it doesn't follow my mouse. Also, the AI player will select a building to build, but they won't ever place it. I tried some of my units in the demo scene and they worked fine, so its the new map that has the issue. I compared it with the demo scene and found the new map didn't have a movement manager, and the "Flat Terrain" plane didn't have a box collider. I added those but that still didn't fix the problem. I deleted the whole RTS Engine from my project and re-imported it so as to not have problems with the old version, but that didn't fix the issue either. I don't get any errors, the units just don't move and the buildings don't follow my my mouse. The other thing that doesn't work is when I click on the minimap camera, it doesn't move the main camera to that position. Any help would be much appreciated! :) Does anyone else have this same problem?
     
    Last edited: May 17, 2018
  4. Tegleg

    Tegleg

    Joined:
    Jun 10, 2013
    Posts:
    55
    hello
    im trying to make this work on a touch screen and wonder if you could point me to the right bit of code.

    when i try to create a new unit, for example,
    touch the building and the units appear on the task panel
    touching the unit i want to create makes the panel empty and no unit is created.

    i notice the tool tip does not appear as there is no mouse hover, is this something to do with it?

    thanks for any tips on where to look and what to change
     
  5. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,154
    That's really simple, do the following:

    - Increase the size of the terrain form the Terrain component's inspector if you are using a Terrain object or simply scale/add the tiles you are using as the map. Make sure to re-size the Flat Terrain object as well.
    - If you are limiting the space that the player can view from the main camera (Screen Limit is enabled in the Camera Movement component) then make sure to modify the minimum and maximum screen limits in the Camera Movement component to suit the new size of the map.
    - Make sure to re-bake the navigation mesh.

    I will add this in the FAQ page of the documentation.
     
  6. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,154
    Thanks for reporting these issues, I'll check them out and provide a fix ASAP.
     
  7. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,154
    A lot has changed in the RTS Engine with the new update and therefore the way maps are set up changed as well, you might be missing a couple of things but you don't actually notice them.
    I would highly suggest to use the RTS Engine menu editor and choose "Configure New Map" when you're about to create a new map and then simply go from there. That will import all required components to create a new map.
     
  8. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,154
    By makes the panel empty do you mean that the building gets de-selected or only the task panel is empty but the building is still selected?

    As for the tool tip, an alternative would be to have a small info icon near each task that triggers the tool tip message everytime the player clicks on it. That's only a suggestion though.
     
  9. jobo22

    jobo22

    Joined:
    Dec 1, 2016
    Posts:
    74
    I created my map with "Configure New Map", that's how I always make my maps. It still had stuff missing compared to the demo map. I will keep looking to see if I can find the problem. Thanks.
     
  10. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,154
    Okay let's break it down one issue at a time.

    You mentioned that you can't move units? Can you check if the units you are trying to move have their Target Position Collider set? (under Unit Components in the inspector).
     
  11. jobo22

    jobo22

    Joined:
    Dec 1, 2016
    Posts:
    74
    Yes my units have it. The demo units don't work in my map either. Also, the MvtTargetObject never gets activated when I right click to move a unit, so I don't see anything flashing either.
     
    Last edited: May 18, 2018
  12. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,154
    Can you show me a screenshot of your Movement Manager component inspector? I would say the problem lays there.
     
  13. jobo22

    jobo22

    Joined:
    Dec 1, 2016
    Posts:
    74
    Here it is. Like I said, when I create the map with "Configure new Map", it doesn't come with the MvtManager, so I had to add it myself.
     

    Attached Files:

  14. Tegleg

    Tegleg

    Joined:
    Jun 10, 2013
    Posts:
    55
    thanks
    yes the building gets deselected.
    as i have a mouse as well for testing purposes, if i position the mouse in the selection box (where the units can be created) then touch the screen (create unit button) the unit gets created.

    is there something that checks if the mouse pointer is over the task panel or something?
     
  15. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,154
    Hmm, okay is the Terrain in your scene properly setup? Do the terrain tiles/objects have the proper layer(s) defined in the Terrain Manager component?
     
  16. jobo22

    jobo22

    Joined:
    Dec 1, 2016
    Posts:
    74
    I have attached pictures of what my terrain settings are set to when I create a new map. I have also tried changing the layer of the flat terrain to default, but that didn't seem to change anything. I also tried changing it to Terrain layer, but that just froze unity when I tried to create a unit. I have also tried using a normal Terrain instead of a plane, which is what I want to end up using anyway, but that didn't work either.

    EDIT: I can move the units if I right click somewhere on the minimap. The units move to the right position, and the flashing thing appears on the map, but not in the right spot. I still can't move my units normally.
     

    Attached Files:

    Last edited: May 20, 2018
  17. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,154
    Looks like your Terrain plane doesn't have a collider which is essential to detect raycasts. Add a collider to it and see if the problem still happens.
     
  18. jobo22

    jobo22

    Joined:
    Dec 1, 2016
    Posts:
    74
    Haha I'm so special, that fixed it thanks! You always give the best support! :) I can place my buildings now also, everything works.
     
  19. cidiego

    cidiego

    Joined:
    Oct 27, 2017
    Posts:
    13
    Excuse my ignorance, but is there a proper way to update my project with the new RTS engine version? I mean, I have downloaded the newest version, then clicked reimport.But now I have lots of errors:

    Assets/RTS Engine/Units/Scripts/AttackObjsPooling.cs(10,14): error CS0246: The type or namespace name `AttackObject' could not be found. Are you missing `RTSEngine' using directive?

    and many other "could not be found" issues. Am I updating it wrong ? Could you please help me ?
     
  20. jobo22

    jobo22

    Joined:
    Dec 1, 2016
    Posts:
    74
    I got quite a few errors as well, I think the best thing to do is delete the old RTS Engine and then import the new version. So you could just delete the whole RTS Engine folder and then re-import the new version. At least that's what I did and it fixed my problems.
     
  21. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,154
    To be honest the best way to avoid any weird issues right now is to start a fresh project. The reasons are the following:

    - So much has changed in the new update and so many components have been deprecated & new ones added.
    - The whole multiplayer code has been re-written from scratch.
    - Movement system has been re-written from scratch.

    I'm really sorry if this has caused any convenience but in order to improve the asset I had to do major changes.
     
    cidiego likes this.
  22. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,154
    I would to also point out that I'm currently working on v1.3.1 which will mainly fix some of the issues that were reported with v1.3.0 and add a couple of small new features.
     
  23. cidiego

    cidiego

    Joined:
    Oct 27, 2017
    Posts:
    13
    No, don't get me wrong. You are doing such a great work! You have got to keep it up :) Im just trying to learn.
    Thanks for your help!
     
  24. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,154
    Thanks for the kind words, let me know if you have any further issues.
     
  25. cidiego

    cidiego

    Joined:
    Oct 27, 2017
    Posts:
    13
    I actually have two things to comment in an attempt to contribute:

    Being able to set a building rally flag over a resource ( thus making the workers automatically go and take them) would be very convenient. This is a standard feature in many RTS games.

    Moreover, moving the arrow next to the border wont move the screen if that border has the minimap canvas nearby. I find it kind of frustrating.

    I have to say that the new version is much cleaner and easier to understand from a noob's perspective. (At least the new demo map) Very good work!
     
    Last edited: May 23, 2018
  26. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,154
    Will be added in the next update.

    Hmm, this shouldn't be happening, looking into it!
     
  27. jobo22

    jobo22

    Joined:
    Dec 1, 2016
    Posts:
    74
    So there are a few things that I think should be fixed. First, I have a couple buildings that I checked "Place Near Resource", so they can only be placed next to a certain resource. It works fine for me, but the AI players don't place it next to the resource, they just place it wherever. Second, when the AI builds units, they get built on top of each other so sometimes it looks like there is only one unit there when really there are more. I noticed that the AI player doesn't use the "Go To" position, I think activating that would solve the problem (assuming you made it in a different spot than the spawn position). Or just move a unit if it's in the way of a unit that needs to spawn. And lastly, the area damage doesn't work. I have a unit that does area damage, and I can see the damage effects, but the enemy units don't lose any health. So hopefully that can be fixed easily.

    Oh and one other thing is that the units rotation damping doesn't seem to do anything when you command them to move. They will rotate with the proper speed if they are just sitting there and are turning to attack, but if you order them to move they will turn around super fast.

    P.S. Could you make a custom delegate for when units collide with each other? I want to make it so that my tanks can squish infantry like in the old C&C Red Alert game haha. And with that, would there be a way so that if I command a tank to move through an infantry, my tank won't try to move around it? Thanks! Sorry for all the questions! :)
     
    Last edited: May 27, 2018
  28. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,154
    Really sorry that you're having these problems and thanks a lot for reporting them.

    These issues, except the area range attack bug, will however be fixed in the next update since I already submitted v1.3.1. I would ask you to ignore those for the moment as they are not game-breaking issues and in two weeks or so when v1.3.2 is available, they'll be fixed (should be also fairly easy to fix). The delegate event will also be included in 1.3.2.
     
    jobo22 likes this.
  29. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,154
    Update v1.3.1 has been recently submitted and should be available in the beginning of this week, here's the update list:
    • Bug Fixes:
      • Fixed a bug when double clicking on units.
      • Fixed a bug that registers a pre-placed building in the map twice.
      • Fixed a bug that deselects selected units after placing a building.
      • Fixed a bug in the Input Manager that makes the Input Manager fail to recongize dead units/buildings.
      • Fixed a bug that stops the unit from triggering the attack animation when the unit has more than one Attack component attached to it.
      • Fixed a bug in area range attacks in multiplayer.
      • Fixed a bug that blocks builders from moving towards the buildings to construct them.
      • Fixed units’ rotation on movement.
      • Fixed creating new maps from the RTS Engine menu editor.
    • New Features:
      • Added Destroy Time for buildings.
      • Free Buildings in the map now must have Placed By Ddefault enabled in order to spawn fully built, otherwise they will only spawn in construction mode.
      • Added an option in the Builder component to allow builders to construct free buildings.
      • Minimap cursor now changes its position after doubling click on a teleport to highlight the camera position change.
      • Added a field in the Selection Obj component for units and buildings only that, when enabled, allows only the unit/building owner to select that unit/building.
      • APC:
        • Instead of a listing the units that aren’t allowed to enter an APC, it’s now possible list unit codes and choose either to accept those units only or to accept units except the listed ones.
        • Added the options to allow the APC to eject all units with one task, eject one unit only each or have both options enabled at the same time.
      • Instead of a listing the units and buildings that can’t attacked by a unit/building, it’s now possible to list unit/building codes and choose either to allow the attacker to attack those units/buildings only or to attack all units /buildings except the listed ones.
      • Added a field in the Unit component that, when enabled, makes the unit invincible and allows it to avoid damage.
      • Added an audio clip trigger that is played when the unit is moving.
      • Added the ability to set the a building rally flag over a resource/building (thus making the workers automatically go and collect the resource/construct the building).
    For the full list of changelog, please visit: http://soumidelrio.com/assets/rts-engine/changelog/
     
    jobo22 likes this.
  30. jobo22

    jobo22

    Joined:
    Dec 1, 2016
    Posts:
    74
    Ok thanks! And yes they are not game breaking bugs so it's definitely not a rush! The new update looks great! And thanks for adding the collider custom delegate in the next update for me. :)
     
  31. jobo22

    jobo22

    Joined:
    Dec 1, 2016
    Posts:
    74
    So a couple more things I'm having issues with...First the attack component isn't working on my building, I have the "attacker" set to building and everything else is set up like I have it for the units, which attack just fine. I don't get any errors, the attack weapon doesn't rotate at all, and the building never shoots. Second, I'm just wondering if there is a way to keep the buildings rotation when you place it. I set my buildings prefab to be rotated about -145 degrees on the y axis so that they face the camera, but when I try to place them they always just place at 0 degrees on the y axis. I can change the models rotation and it will keep it when I place it, but then the buildings model won't match up with the colliders on the model. I looked through the code of the "Building Placement" script and think I found where the buildings rotation is set when placing, it was set to Quaternion.identity, I tried changing it to a new Quaternion (0, -145, 0, 0), but then when I tried placing the building it was always set to 180 degrees on the y axis for some reason. I tried changing the -145 to other numbers but it always was 180 when I tried to place it. Thanks! :)
     
  32. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,154
    I will look into it and provide an answer ASAP.

    Are you setting the transform.rotation to (0, -145, 0)? if yes that's not really valid. You should change the transform.eulerAngles to (0, -145, 0) instead.

    Check this out: https://docs.unity3d.com/ScriptReference/Transform-eulerAngles.html

    Thanks yet again for pointing out the bugs. A lot has changed with the 1.3.0 update and therefore some unexpected issues have appeared. Thanks to everyone for their patience and their continuous support for the asset.
     
    jobo22 likes this.
  33. jobo22

    jobo22

    Joined:
    Dec 1, 2016
    Posts:
    74
    Yes I was using transform.rotation, I looked at link you sent and changed it to that and now it works great! Thanks for all the hard work you put into this! :)
     
    OussamaB likes this.
  34. generalhak

    generalhak

    Joined:
    Apr 20, 2014
    Posts:
    25
    hi, nice asset and really good work , i played the demo :
    1- knowledge building dosn't give any knowledge !
    2- there is no local avoidance so units pass through each other ! (this one really keep me from buying this asset)
     
  35. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,154
    Will be fixed in the next update.

    Since Unity's pathfinding local avoidance isn't really that good and it has created a lot of problems in the past, the new approach for moving units now is to let them move through each others when crossing paths but rest assured, two units will never occupy the same final position.This is of course alwqys subject for improvement.
     
  36. generalhak

    generalhak

    Joined:
    Apr 20, 2014
    Posts:
    25
    wow thanks for the fast answer !
    i know that and that's good but in a real strategy game local avoidance is necessary
    units have to never pass through or overlaps with buildings and other units
    in the demo maby this is fine but if you replace the humans with tanks and big units then it will be really annoying and unrealistic , i know local avoidance with lockstep is really hard to code ,but its the only thing this asset don't have.
    because with that this asset will be perfect. so please add this, thanks
     
  37. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,154
    I know, it's really something that I want to add to the asset as well but I unfortunately cannot give an exact at when this feature will be added so yeah, thanks for the kind words.
     
  38. jobo22

    jobo22

    Joined:
    Dec 1, 2016
    Posts:
    74
    Hi, is there some way I can make it so that my units can have different movement speeds? So like sneak, move normal, and move fast? I would like to be able to choose which speed I want the unit to move at from the task panel. Right now there is a move task, but how could I make two more move tasks, one for sneak, and one for move fast? I know this is fairly game specific and you probably won't implement this yourself, but if you could point me in the right direction on how to add it myself, I would very much appreciated it. Thanks! :)
     
  39. Mientas

    Mientas

    Joined:
    Jun 1, 2018
    Posts:
    1
    How old are u mate :D ??
     
  40. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,154
    You should be able to have access to both the "Speed" attribute in the Unit component and the speed in the Nav Mesh Agent component attached to the unit. That way you can manipulate the speed to your lickings.

    Regarding adding tasks, I recommend you to go through the UI Manager component and follow how built in tasks are created and then go from there. Start by checking the "UpdateUnitTaskst()" function and build from there.

    I was considering adding a way to allow you to build your own tasks and I guess it's going to happen soon.

    I guess this is not really related to the RTS Engine, so yeah.
     
    jobo22 likes this.
  41. jobo22

    jobo22

    Joined:
    Dec 1, 2016
    Posts:
    74
    Ok thanks!
     
  42. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    95
    This point should be your priority since this is a really issue when you move your army and a single shot of an artillery can kill all units in the smallest AoE.

    This behavior is a really hard point for balance.
    It is impossible to consider any unit using a weapon with AoE in this case.
     
  43. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,154
    Sorry for the late reply but could elaborate how would that exactly presents a problem in this case? I'd like to tackle this problem and go from there.
     
  44. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    95
    When you move your army, all units can be merged on a same location according to the path. There is no collision detection with your solution.

    If a unit with a AoE strikes the units at this moment, all of the units are dead or heavily damaged.
    The AoE units are overpowered, even with a small radius.

    In all RTS a group of units move according to their collision box, so no merge effect and if a AoE strike occurs on the group, only some units are damaged.
    This is a way for a large group to survive of a battery strike with a quick assault.
    If the group is too small, artilleries win.

    In your case, artilleries always win.
    With flame thrower it is even worse if they ambush a moving group.
     
    OussamaB likes this.
  45. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,154
    Got it, I will at least look for a temporary solution to avoid this issue by the next update and will soon start working on my own deterministic pathfinding solution but that'll take some time. Thanks a lot for taking the time and explaining this!
     
  46. jobo22

    jobo22

    Joined:
    Dec 1, 2016
    Posts:
    74
    Hi, so I have a couple questions/requests. First, in the changelog you say you fixed units rotation on movement, but my units still rotate very quickly when I order them to move. Not sure if the bug fix you did was for that problem or another rotation bug. Second, you also say in the changelog that you added a audio clip for when the unit is moving, but I don't see anywhere for me to put one. For one request I was wondering if you could add a destruction object and audio clip for units just like you have them for buildings. My other request, could you make it so there is the option to only let a unit shoot if it or its weapon object is looking at the target unit. So for my tanks, they would only shoot if their turret was aimed at the target, that way they don't shoot when they aren't facing the target and the bullet goes sideways towards the target. Thanks!
     
  47. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,154
    Before the fix in the latest update, units were rotating quickly on movement but once they reached their destination they rotate back to the default rotation. And that was the thing I fixed, I'm really sorry if you expecting a fix to the the issues you mentioned but this can modified from the Nav Mesh Agent component of each using along with the movement acceleration and other settings. Let me know if modifying the rotation acceleration fixes your problem.

    Assigning the audio clip isn't visible from the Unit inspector because the Unit Editor hasn't been updated, PM me your e-mail and invoice number and I'll send you the fix which will be of course included in the next update.

    Awesome suggestions as always, thanks a lot, you'll see those implemented soon.
     
  48. jobo22

    jobo22

    Joined:
    Dec 1, 2016
    Posts:
    74
    Ok thanks for clarifying the rotation you fixed, that was a great fix anyway. I changed the values in the navmesh component and was able to get the rotation pretty much how I want it. I had to comment out a couple lines in the Unit script that was automatically setting the angular speed and acceleration to very high values automatically, but that was very easy to do. Thanks for helping me figure it out. Also, don't worry about sending me the movement audio clip, I can just wait for the next update, but thanks for offering. And I'm glad you like my suggestions, I couldn't come close to what I'm trying to make without this asset! Thanks very much! :)
     
    OussamaB likes this.
  49. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    95
    What is the best way to build a second map?

    Should I duplicate the first one and modify the environment or there is a way to hide the first one and only work with the second one or something like that?

    Secondary question: we can only define one building for resource collection or each resource can have its specific building?
    I only see one entry for the resource building in the Capital faction manager.

    Edit : I have an additional question also :
    When I look at the demo scene, I don't see any units or buildings except the capital of each faction.
    And in the tree of objects, I don't see any references to units and buildings and also how to define which building needs another etc...
    Where and how (with an option?) all buildings and units are hidden?

    On my scene I have each time the version of a unit and/or a building to define it.
     
    Last edited: Jun 14, 2018
  50. jobo22

    jobo22

    Joined:
    Dec 1, 2016
    Posts:
    74
    Hi, is there some way I could make an accuracy setting so that sometimes the bullets will miss? I tried adding to the target position a randomness but the bullet still always went straight at the target. Then I tried adding some force to the rigidbody on the bullet to make it go a little off target but it also went straight at the target. I know most RTS games don't have it, but my game is a little different and I would like the bullets to miss the target sometimes, especially the farther away they are. Also, could you make it so that if there is multiple attack components, both can shoot at the same time. I noticed if I enable the "Multiple Attacks" component while I'm playing, then they both shoot at the same time. But if I have it enabled and then go into play mode only one will shoot. And I couldn't use multiples sources on the same attack component because one of my bullets reloads much quicker than the other, so I had to have two attack components so I could have two different reload times. And what about making it so that there can be a burst, like 5 shots in a row and then reload? Sorry for all the questions! Thanks! :)

    EDIT: I actually got the accuracy to work with the rigidbody by adding forces, I just had to uncheck freeze positions.
     
    Last edited: Jun 16, 2018