Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Unity RTS Engine

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

  1. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    97
    Have you solved the old pathfinding problems where units go through the others during movements ?
     
  2. Huntah666

    Huntah666

    Joined:
    Aug 23, 2018
    Posts:
    9
    I'm seeing a bit of an issue and wondering if anybody has a solution for me.

    Note I'm using last years version of this engine (I don't know where to see exactly what version it is) but it isn't practical for me to update as I have already completed over half of my game and heavily customized parts of the engine.

    The Issue I'm having is when I select a large amount of troops, lets say 20+ and I tell them to go somewhere, because they are all clumped together they all try to leave at the same time and sometimes 5 or more might just stay where they are and not move. They play the running animation but it's like the other soldiers are blocking them, then once the other soldiers are gone they give up trying to move and just stay put.

    I'm using a custom troop type, it's a mounted knight, it has all the same components as the default units, just with edited values.

    Any ideas? Movement speed? Something about the movement script? The Nav mesh? I'm not sure, any help would be great thanks.
     
  3. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    That issue has to do with Unity's navigation system since when local avoidance is turned on (the feature that allows units to avoid each other when moving), units will basically get stuck, even when the local avoidance is set to low quality.
    Another issue that arises when that's turned on is the fact that the navigation becomes so indeterministic that it affects the multiplayer mode.

    The 1.3.9 update (not the next one, the one after) will be handling unit movement, refactoring the Movement Manager component for better performance and adding movement formations. I will be also attempting to create an integration package for A* which I assume has a better local avoidance than the one built in the nav mesh system in Unity. There's also one last trick that I'd like to try and see if it works out with Unity's nav mesh. I will basically be attempting to use the agent to calculate paths only, then deactivate the nav agent component and activate a nav obstacle component on the unit while it's moving and see how units movement paths react to that.
     
    Last edited: Mar 16, 2019
  4. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    Does it always happen when you attempt to move 20+ units? I just tried moving about 40 units along different paths in the current RTS Engine version and no unit is getting stuck.
     
  5. Huntah666

    Huntah666

    Joined:
    Aug 23, 2018
    Posts:
    9
    Thanks for your reply, I sent a contact message on your website with a video example.
     
  6. Huntah666

    Huntah666

    Joined:
    Aug 23, 2018
    Posts:
    9
    Next Question

    Does follow distance work in the unit attack component work as expected? I have mine set to 10 however If I run away from a unit it will follow me forever, no matter how far away I get from it.
     
  7. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    97
    I’m not concerned by network in my own iteration.
    I can confirm that in this pure solo case, just using the nav mesh with radius and avoidance works perfectly.
    The trick is to have a movement function which never launch two units movements in the same frame.

    For the case where units are penetrated by the others, I only see this when they are stopped and I have solved this issue also by using the nav obstacle only in this state.
    I switch between agent and obstacle when the unit starts and stops.
    But to avoid strange effect the action on each must be done in a separate frame.
     
    OussamaB likes this.
  8. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    I've replied to your e-mail with further questions.
     
  9. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    Just tested it on the demo scene and it seems to be working. When you "no matter how far away", do you mean farther in relationship to the target's initial position when it was attacked? Because if the attacker keeps following the target and keeps distance that's lower or equal to the following distance, it will keep following.
     
  10. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    Yeah but due to the deprecation of UNET, the asset needs a replacement for a high level networking API and hence the Mirror integration.

    I also had something similar in mind but I'd like to just calculate the path using the nav agent component and then turn it off and handle the movement with the calculated path myself while having the navigation obstacle on when the unit is moving so other units avoid it when calculating a path.

    Right after the Mirror update, I'll be working on unit movement and formations so this issue will be hopefully solved.
     
  11. meTonne

    meTonne

    Joined:
    Apr 30, 2016
    Posts:
    52
    Hi all !

    I work on Waypoint system and I need help.
    Units spawn and go on waypoints but they didn't attack and when units dead they continue to move. I tested many things but nothin work ... If someone can help me, my WaypointMove script is inspired by Wander script.

    I have 2 scripts :
    The spawner(on empty in the scene) of unit with waypoint list :
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class Waypoint_Spawner : MonoBehaviour
    6. {
    7.     //Update per second variable
    8.     private int nextUpdate = 1;
    9.  
    10.     public List<Transform> Waypoints = new List<Transform>();
    11.     public GameObject UnitPrefab;
    12.     public Transform SpawnPoint;
    13.     public float UnitPerWave;
    14.     private float UnitSpawn;
    15.     public int TimeBetweenWave;
    16.     private int WaitTime = 1;
    17.  
    18.  
    19.     void Update()
    20.     {
    21.  
    22.         //If the next update is reached
    23.         if (Time.time >= nextUpdate)
    24.         {
    25.             //Debug.Log(Time.time + ">=" + nextUpdate);
    26.             //Change the next update (current second + 1)
    27.             nextUpdate = Mathf.FloorToInt(Time.time) + 1;
    28.             // Check per Second
    29.  
    30.             SpawnUnit();
    31.         }
    32.     }
    33.  
    34.     public void SpawnUnit()
    35.     {
    36.         //Debug.Log("Unit Spawn = " + UnitSpawn);
    37.         //Debug.Log("WaitTime = " + WaitTime);
    38.         //Debug.Log("TimeBetweenWave = " + TimeBetweenWave);
    39.         if (UnitSpawn >= UnitPerWave)
    40.         {
    41.             //StartCoroutine(WaitToNextWave());
    42.             WaitTime = WaitTime + 1;
    43.  
    44.             if (WaitTime == TimeBetweenWave)
    45.             {
    46.                 UnitSpawn = 0;
    47.                 WaitTime = 0;
    48.             }
    49.         }
    50.  
    51.         if (UnitSpawn < UnitPerWave)
    52.         {
    53.             GameObject.Instantiate(UnitPrefab, SpawnPoint.transform.position, Quaternion.identity);
    54.             UnitPrefab.GetComponent<WaypointMove>().ListWaypoints = Waypoints;
    55.             UnitSpawn = UnitSpawn + 1;
    56.         }
    57.     }
    58.  
    59.     IEnumerator WaitToNextWave()
    60.     {
    61.         yield return new WaitForSeconds(1);
    62.         WaitTime = WaitTime + 1;
    63.     }
    64. }
    And the script on unit : Waypoint move :
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using RTSEngine;
    5.  
    6. public class WaypointMove : MonoBehaviour
    7. {
    8.     [HideInInspector]
    9.     public List<Transform> ListWaypoints;
    10.     private Transform targetWaypoint;
    11.     private int targetWaypointIndex = 0;
    12.     private int lastWaypointIndex;
    13.     private float MinDistance = 1.0f;
    14.  
    15.  
    16.     private Unit unit; //the main unit's component
    17.     [SerializeField]
    18.     private bool isActive = false; //is this component active?
    19.     public bool IsActive() { return isActive; }
    20.  
    21.     float timer;
    22.  
    23.     void Start()
    24.     {
    25.         unit = GetComponent<Unit>();
    26.  
    27.         lastWaypointIndex = ListWaypoints.Count - 1;
    28.         targetWaypoint = ListWaypoints[targetWaypointIndex];
    29.  
    30.  
    31.         if (isActive == false) //if the Wandering component is either not enabled or unit can't wander when created
    32.             return; //do not proceed
    33.     }
    34.  
    35.     public void Trigger()
    36.     {
    37.         if (isActive == false) //if this is not enabled
    38.             return; //do not proceed
    39.  
    40.         Debug.Log("Destination" + targetWaypoint);
    41.         //Vector3 targetPosition = MovementManager.GetRandomMovablePosition(targetWaypoint.position, MinDistance, unit, unit.MovementComp.GetAgentAreaMask());
    42.         Vector3 targetPosition = Vector3.MoveTowards(transform.position, targetWaypoint.position, unit.MovementComp.GetAgentAreaMask());
    43.  
    44.         MovementManager.Instance.Move(unit, targetPosition, 0.0f, null, InputTargetMode.None);
    45.  
    46.     }
    47.  
    48.     private void Update()
    49.     {
    50.         float distance = Vector3.Distance(transform.position, targetWaypoint.position);
    51.         CheckDistanceWaypoint(distance);
    52.  
    53.         if (isActive == false || unit.HealthComp.IsDead() == true || (GameManager.MultiplayerGame == true && GameManager.Instance.IsLocalPlayer(gameObject) == false)) //if this is not enabled or this is a multiplayer game where this is not the local player's unit
    54.             return; //do not proceed
    55.  
    56.         Trigger();
    57.     }
    58.  
    59.     public void ChangeWaypointDestination()
    60.     {
    61.         if (targetWaypointIndex > lastWaypointIndex)
    62.         {
    63.             isActive = false;
    64.         }
    65.  
    66.         targetWaypoint = ListWaypoints[targetWaypointIndex];
    67.     }
    68.  
    69.     private void CheckDistanceWaypoint(float currentDistance)
    70.     {
    71.         if (currentDistance <= MinDistance)
    72.         {
    73.             Debug.Log("add 1" + targetWaypoint);
    74.             targetWaypointIndex++;
    75.             ChangeWaypointDestination();
    76.         }
    77.     }
    78. }
    79.  
     
  12. meTonne

    meTonne

    Joined:
    Apr 30, 2016
    Posts:
    52
    Hello,

    New mistake for me :
    All regulator are ok like prefabs. In game Manager I'm all "Limites unit" for Player but no for AI. Player. (same faction).

    NullReferenceException: Object reference not set to an instance of an object
    RTSEngine.NPCManager.GetBuildingRegulatorAsset (RTSEngine.Building building) (at Assets/RTS Engine/AI/Scripts/NPCManager.cs:157)
    RTSEngine.GameManager+FactionInfo.InitNPCMgr () (at Assets/RTS Engine/Game Managers/Scripts/GameManager.cs:118)
    RTSEngine.GameManager.InitFactions () (at Assets/RTS Engine/Game Managers/Scripts/GameManager.cs:507)
    RTSEngine.GameManager.Awake () (at Assets/RTS Engine/Game Managers/Scripts/GameManager.cs:248)
     
  13. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    This seems like either one of the NPC Building Regulators has been removed. Can you go the NPC Manager's inspector and hit the button "Refresh Regulators". Whenever you manually remove NPC Regulators or add new units or buildings, you need to refresh the regulators on the manager using that same button.
     
  14. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    To be completely honest, I don't really know where to begin here. I see that you have copied from stuff from the PlayerWander.cs script but I don't quite understand why you partially did that.

    For example in your Spawner script, I see that the method Trigger() is basically called every frame on Update() when the component is active and the unit is still alive. That same method Trigger() keeps then ordering the unit to move to a target position, so you're basically ordering the unit to move to a target position every frame which shouldn't be happening.

    What I would suggest is the following:
    - Either use colliders to mark the waypoints or save their positions in a list in a class of a component that is attachable to units, let's call it WaypointFollower
    - When the unit is created (<=> the WaypointFollower is initiated on Start() ), set the unit target position to the first waypoint's position and move it towards it using the Move() method from the Movement Manager (the one you've used already above).
    - As soon as the collider triggers the entry of the waypoint collider (using OnTriggerEnter) or as soon as the unit reaches a certain distance from its target position (you can check this on Update()) then you move to the next target position.

    As for attacking, enable the "Engage In Range" feature for the unit and units should be able to spot targets and attack them if they're in a certain range (which can be also defined from the Attack component's inspector).
     
  15. meTonne

    meTonne

    Joined:
    Apr 30, 2016
    Posts:
    52
    Thanks for your fast answers ! :)
     
  16. christian_fischer1988

    christian_fischer1988

    Joined:
    Mar 19, 2019
    Posts:
    2
    Hi,

    First of all I really like your rts engine.
    I was wondering if you could add two small features to the engine:

    - Possability to create player buildings which auto spawn units (with preset target for units, for example spawnpoint of enemy player)
    - Attack move for units (orders selected units to move to a location but attack any enemy within acquisition rangee)

    If you add those features i don´t have to modifiy your engine to build my game. (Which would help me vastly becouse I´d like to stay as close as possible to your scripts etc.)

    Thank you in advance.
     
  17. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    Glad you like the asset! Thanks a lot for your suggestions as well, both are in my to-do list and they will be available as part of the next 2-3 upcoming updates.
     
  18. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    So the Mirror integration update (v1.3.8) has been just submitted to the asset store. Configuring the Mirror multiplayer menu will be as easy as doing it with UNET, I've tried to make it as similar as possible and the way Mirror is built definitely helped.

    Here's the full v1.3.8 update list:
    • Updated minimum Unity version to run RTS Engine to 2018.3.8
    • Fixed a bug that prevented the Area Damage attack from triggering correctly
    • Fixed a bug in generating resources from a building.
    • Fixed a bug that stopped a unit from attacking its target when the follow distance was lower than the attack range.
    • Fixed a bug in placing buildings by default when god mode is enabled
    • Fixed a bug in dropping off resources.
    • Fixed a bug in fetching inactive effect objects.
    • The damage value of an attack entity can be now extracted using the GetDamage method from the AttackDamage class
    • Deprecated UNET support for the multiplayer mode and removed all UNET related networking components.
    • Added support for Mirror (a community networking high level API and a replacement for UNET, using the Telepathy low level transport library).
    As always, full changelog can be found here: http://soumidelrio.com/assets/rts-engine/changelog/

    The Mirror integration will be available as a separate package that's easy to set up: http://soumidelrio.com/docs/unity-rts-engine/multiplayer-mirror/

    There's also a new section in the docs regarding customizing the asset through scripting. Currently this includes a docs of the available custom delegate events and few useful scripting practices (basically how to create units, buildings and resources using one line from your own components, @derekf I guess you'll find this useful): http://soumidelrio.com/docs/unity-rts-engine/scripting/useful-scripting-practices/

    Expect more content to be added in the scripting customization part of the docs in future updates as many here have requested to make it easier to access and modify stuff in the asset through code and I'll keep that in mind for future updates.

    As soon as the update is available, please refer to this guide to help you update smoothly: http://soumidelrio.com/docs/unity-rts-engine/update-helper/v1-3-8/
     
  19. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
  20. GermiyanBey

    GermiyanBey

    Joined:
    Aug 18, 2017
    Posts:
    13
    I wrote you almost a week ago via Contact Form on your Support Website, I haven't received a reply back yet.

    No worries, I write here too, you say:
    • Updated minimum Unity version to run RTS Engine to 2018.3.8
    I have to rely on 2017.4.23 at the moment and I need 2017 support because I purchased your asset when it was supporting 2017.
    And I didn't download RTS Engine a long time (I plan to work on it now), so is it possible for you if you can send me latest 2017 support given version? I think it is 1.3.7 and I purchased this asset and I have invoice. I can send you Invoice number by PM here too, if you can send me a download link for 1.3.7.

    Thanks
     
  21. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    Really sorry for that, the e-mail notification for my website contact form when I updated my website about a week ago.
    By the way, you could always post on the forums or on the discord server!

    I'm not really using exclusive features to 2018.3.8 or higher versions (yet) so the RTS Engine is still functional on 2017.4. However I decided to support 2018.3.8 as the minimum Unity version to run the asset because we're now using Mirror as the main high level networking API and it requires 2018.3.6 or higher.

    That being said, you could install 2018.3.8, import the asset then export it into a unity package which you import in your 2017.4.23. That's way much better than using 1.3.7 which includes some issues fixed in the newest version.
     
  22. GermiyanBey

    GermiyanBey

    Joined:
    Aug 18, 2017
    Posts:
    13
    Thank you for the reply. I tried as you say, downloaded 2018 and imported to 2017.4.23 and tried. Unfortunately there are errors which I had feared.

    Namely, I started with opening DemoMap on 2018.3.12 and everything works great. No errors, flawless.
    When I imported the project from 2018 to a 2017 project (a clean empty project), it throwed many errors (29 errors). Further, I tried DemoMap, many assets become visible, which I have empty game objects in Hierarchy too.
    I can share the errors, but I am sure you can reproduce them when you import a 2018 RTS Engine project to 2017.

    I believe when a 2017 project is imported to 2018 project, probability of issues is very low. Let's say we imported an example project from 2017 to 2018 and it works. Then if we import 2018 back to 2017, it will throw errors like happened in RTS Engine example.

    Therefore, if you can give us an ability to work with 2017 version, that would be great. I have some plugins and assets that will assist me building a good RTS but they are old, so they require me to stay in lower LTS versions unfortunately.
     
  23. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    You need to import the project on 2018.3 or above and then export the RTS Engine folder as a Unity package and import it into a 2017.4 project. You don't open the same project with an older version.

    I just did this now and by the import to Unity 2017, it threw some errors regarding lost connections and regarding prefabs (since the prefab workflow has changed in 2018) but I was able to run the demo scene successfully (although you also need to setup the layers again yourself but that's not a big issue). Some prefab connections in the demo scene are also lost but that's fine since I assume you have your prefabs ready in your 2017.4 project.

    The problem is that I can't keep supporting 2017.4 as a minimum version as Mirror (the networking high level API that the RTS Engine mainly supports) requires 2018.3 to run so be aware that by using 2017.4, you will not have access to multiplayer.
     
  24. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    Just to let you know, the next update is coming real soon. I still have to do some testing and update the docs accordingly before the submission but that shouldn't take that long.

    The update mainly handles unit movement as the Movement Manager has been re-written from scratch and we now have soft avoidance regarding units (will no longer be passing through each other all the time), the movement manager also makes sure that path calculations occur at separate frames for each unit and it now includes a second formation that you pick from (see screenshot below). You'll be able to pick a formation for normal movements for attack units, non attack units and for attack movements (when units are moving to attack a target) for each different range type.





    Alongside refactoring on so many different components and the usual bug fixing, I've added the new Unit Group Selection component which allows the player to select units, assign them as group by pressing a combination of keys that you pick from the inspector and then use the same key to instantly select that assigned group, UI messages and audio clips can be also assigned for different situations to keep the player informed.

    I'm also currently considering implementing Unity's job system to handle unit movement on a multi-threaded level. I will be testing this on the weekend and will let you know how it goes.
     
    meTonne likes this.
  25. MegaCo

    MegaCo

    Joined:
    Jan 24, 2018
    Posts:
    59
    I seem to have a problem,
     

    Attached Files:

  26. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    Something is wrong with the Resources List of the building that the NPC Building is trying to create. Can you show me a screenshot of that list in the building's inspector?
     
  27. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    I've just submitted the 1.3.9 update to the asset store, here's the update list:
    • Fixed the error triggered by the Input Manager when a single player game starts.
    • An air terrain is now required to create flying units. Please refer to this doc page for more information about the air terrain: http://soumidelrio.com/docs/unity-rts-engine/maps-terrain/
    • Fixed the Unity Event "Attack Performed Event" of the Attack Entity component so that it is invoked when the attacker performs the attack (when the attack object is launched for example) and not when damage is dealt.
    • Added a new Unity Event "Attack Damage Dealt Event" for the Attack Entity component that is invoked when the attacker deals damage to its target.
    • Added the Unit Selection Group component which allows the player to select units, assign them as group by pressing a combination of keys that you pick from the inspector and then use the same key to instantly select that assigned group, UI messages and audio clips can be also assigned for different situations to keep the player informed.
    • The Movement Manager component has been re-written from scratch.
    • Soft unit avoidance can be now enabled from the Movement Manager. This makes units that are not moving act like obstacles so that they're avoided by other moving units.
    • Added Movement Formations that define how a group of units pick their target positions. There are currently two types of formations when moving a group of units: Circular and Rectangular. You can assign a different formation for the movement of non-attack units and the movement of attack units (one for when they're idle and one for each range type when they move towards an attack target).
    • The Unit Movement component is now incharge of actually moving the units instead of the Nav Mesh Agent component (which now only serves to calculate the path and feed it to the Unit Movement component).
    • Added an Acceleration field in the Unit Movement component which defines how fast does the unit reach its top speed when it starts moving.
    • NPC Factions can now place their buildings on top of hills and different heights of the terrain since they can now sample the height of the terrain when placing a building.
    As always, you can view the full changelog here: http://soumidelrio.com/assets/rts-engine/changelog/
     
  28. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    The 1.3.9 update is now live on the asset store!
     
    cidiego and digiross like this.
  29. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    v1.3.9.1 has been just submitted. This brings some important fixes regarding the new unit movement system that has been introduced in the previous update. Here's the full update list:
    • Before calculating a path for a moving unit, the movement manager now checks first if it’s not valid or dead before continuing.
    • When a NPC Faction is defeated (when having the defeat condition set to “Destroy Capital”), all of its units/buildings (including pending buildings that are getting placed by the NPC faction) get destroyed and that might cause problems in the NPC Building Placer component (it keeps checking for pending buildings that just got destroyed) before it gets destroyed itself. Therefore, I’ve added some “security” checks to make sure that the NPC Building Placer component does not act if the pending building is invalid (instead it simply discards it).
    • When moving one unit using the Movement Manager, only consider the actual target destination if the offset radius is not null. This fixes the issue where builders do not move directly to construct the building that the player place when they’re selected.
    • The converter and healer units can now use their own stopping distances when moving towards a target.
    • The Movement Manager does not move units into idle mode anymore in the following cases:
      • A unit is asked to launch an attack towards while it can’t change its current target or it no target can be assigned to it and therefore no movement will be initiated.
      • A unit is asked to move towards a target destination while it can’t be moved.
    • Fixed moving units through the minimap camera.
    • Removed the unnecessary Building Drop Off component from some demo scene building prefabs.
     
    meTonne likes this.
  30. sTorrr

    sTorrr

    Joined:
    Oct 28, 2018
    Posts:
    68
    Hi, im interested in making an RTS game and therefore checking out your asset "RTS Engine". However im curious about your plans regarding implementing the new Entety system in Unity in your patching. Think this is nessessary for maximizing performance? Also I wonder if there is included possibility for speeding up and slowing down game and if this would be hard to integrate? Im interested in making game such as WC3 the frozen throne, but also citybuilding game such as City Skyline, Sim City and the old classics by Sierra, Pharaoh and Cesar games
     
  31. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    While not necessary, I believe the ECS will help improve the performance in certain areas. I'm already experimenting with the Job System so that movement and attack tasks can be run on a multi-threaded level. I will keep everyone updated regarding this but I'd say you don't have to worry about it in the near future.

    You can achieve this by modifying the Time.timeScale. Check this doc page: https://docs.unity3d.com/ScriptReference/Time-timeScale.html

    It wouldn't be hard to integrate.

    A game like WC3 is totally possible using the RTS Engine but city building games might require you to modify some stuff yourself.
     
  32. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    So before the v1.3.9.1 update is even accepted by the asset store, I've decided to submit another patch which includes further bug fixes and improvements regarding the unit movement system. So here are the main 1.3.9.2 patch changes:
    • The movement queue in the Movement Manager component now utilizes a LinkedList instead of a Queue/List: Since random access is not required (no need for List) and we need to remove elements inside the list (which Queue disallows and LinkedList allows with constant time).
    • Each unit can keep track of its pending movement task in the Movement Manager and it can remove/update it in case it decides to change its movement while still in the movement queue.
    • The Unit Movement component now separates between the current speed and the max allowed speed.
    • Added methods to get and set the max speed of each unit during runtime.
    • Updated the GetRandomMovablePosition method of the Movement Manager component to sample the correct height when picking a random direction.
    As always, full changelog can be found here: http://soumidelrio.com/assets/rts-engine/changelog/
     
  33. sTorrr

    sTorrr

    Joined:
    Oct 28, 2018
    Posts:
    68
    Im interested in integrating systems for economics, moods, weather, level/stats, equipment wear etc.

    Indicator, like a clock, showing season cycle, weather forecast prediction (maybe to some degree random), day cycle, such as the one seen in "Dont Starve" games.

    agro, like in wow, where negative level differece provide larger agro circle so that its impossible to enter some areas too early.

    My goal is to make an RPG/RTS combination, kind of like in WC3.

    Thanks for your suport
     
  34. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    I appreciate all the suggestions but what I'm trying to do with this asset is to be provide the fundamental features that each RTS game requires and open the way for users to customize the asset further. So this means that implementing features that are very specific for some RTS games but not the majority will not be given priority.

    I'm however giving the idea of creating a sim-city like template for a similar asset, will provide details in this thread in case it becomes official.
     
  35. sTorrr

    sTorrr

    Joined:
    Oct 28, 2018
    Posts:
    68
    Ok, I understand. ill be exited to see the resuly. I think City Skyline was made in Unity. So anything is possible. Woul love to see what they did :D
     
  36. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    The 1.3.9.2 patch is now available on the asset store!
     
  37. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    v1.4.0 is now live on the asset with huge improvements:
    • Fixed a bug where the building’s rallypoint model is visible even if the rallypoint is set to a building/resource.
    • Fixed a bug where units can’t move to the “Goto Position” of a APC or a portal after leaving the APC or teleporting through a portal.
    • Fixed a bug where attack entities are still able to engage units in a rare occasion even if that’s disabled for them.
    • Fixed a bug where attack objects do not face their targets correctly when they’re created in delay mode.
    • Fixed an issue with the Unit Attack, Attack Entity and Attack LOS components to only allow that an attack starts in any case if the source has its target in its line of sight (if line of sight is enabled of course).
    • Fixed playing the movement order audio clip in the Movement Manager component.
    • Fixed an issue in the Movement Manager that didn’t allow units to re-calculate their movement paths if they were unsuccessful to do so in the first attempt.
    • Fixed a bug in the Faction Entity Health component which triggered the building destruction effect when a building gets upgraded
    • Fixed enabling/disabling the correct animator override controllers and drop off object in the Resource Collector components.
    • Fixed a bug where the reload time of a newly added task in the Task Launcher component is not set correctly.
    • Fixed a bug in the Mirror integration package where faction lobby slots of players who left the room before the game started didn’t get cleared.
    • Fixed a bug where the Movement Manager doesn’t take into consideration an attack unit’s range distance when moving a single unit towards its attack target.
    • Fixed a bug with the attack weapon rotation.
    • Fixed a bug that didn’t update the builder(s) task panel properly when placing a building that just reached its faction type limit while god mode is enabled.
    • Fixed the resource drop off bug that occurs when a unit is assigned to collect a resource when it’s already dropping off another resource.
    • Fixed an issue with free buildings that made them un-selectable.
    • Building Health component:
      • Updated the building states system to be simpler and easier to use.
      • Added the field “Construction Complete State” which allows to define child objects of the building that get enabled/disabled when the building’s construction is complete.
    • Selecting a free unit now triggers playing its selection audio clip.
    • All camera movement logic is now done in FixedUpdate which makes the movement smoother.
    • Added the option to toggle displaying the selected unit’s population slots count in the selection description.
    • Added the option to show a UI message when an attack warning is triggered in the minimap to inform the player that their unit(s)/building(s) are under attack.
    • Added the option to only allow a unit to move/continue its movement on its path if it faces its next destination in the path with a certain angle.
    • Updated the Game Manager faction slots randomization system and enabled that feature in both singleplayer and multiplayer modes.
    • Exposed both the unit and building regulator asset lists on the inspector so they can be edited those manually.
    • The building upgrade effect is now spawned for every building instance that gets upgraded in the game instead of the instance that initiated the upgrade.
    • Updated the Building Placer’s component collision check when placing a building.
    • Added deceleration for unit movement.
    • The Current Speed field is now accessible for other components as property (read only)
    • Switching an attack through the Multiple Attack Manager component now toggles the weapon object if it’s assigned.
    • Cancelling all unit jobs now include cancelling an on-going drop off process if there is any for units with the Resource Collector component
    • Added the option to set a secondary model and secondary selection object for resources: if assigned, they’re enabled as soon as the resource is collected for the first time.
    • Updated the Damage over Time system to enable having multiple instances of DoT running at the same time for one unit/building.
    • Added the “NPC Only” field in the Escape On Attack component which when enabled, escaping on attack can only be active if the unit belongs to a NPC faction.
    • The movement queue in the Movement Manager component now utilizes a LinkedList instead of a Queue/List.
    • Added a reference Movement Task field in the Unit Movement component so that each unit can keep track of its pending movement task in the Movement Manager and it can remove/update it in case it decides to change its movement while still in the movement queue.
    • The hover health bar is disabled for units and buildings when they’re marked as dead but not yet destroyed.
    • The Builder, Resource Collector, Healer and Converter components now include two new Effect Object fields. When assigned, one is enabled on the source unit and another on the target unit when the component is active.
    • Converters and Healers can now use their own stopping distances when moving towards a target unit
    • Effect Object:
      • The Effect Obj Pool no longer uses pre-defined effect object types but instead a dictonary that allows to store each effect object type as a single entry with the value being a queue of all inactive instances of that effect object type which allows constant time in terms of expected time of retrieval of effect objects.
      • Updated the Effect Object component to have three different states: inactive, running and disabling.
      • Added a disable time field for effect objects which allows to smooth out disabling them.
      • Effect Objects can now trigger events when they’re enabled/disbaledAdded two UnityEvent fields for the EffectObj component to allow it to invoke events when the effect object is enabled/disabled.
    • Rotating Buildings:
      • Added the option to allow the player to rotate to-be-placed buildings using two keys (one for positive rotation and another for negative rotation).
      • Added the option in the NPC Building Regulator to allow NPC Factions to rotate buildings towards the center object that they’re placing a building around.
    • Speed Modifier:
      • Added a speed modifier field in the Game Manager which allows to speed up the game in terms of: unit movement speed, unit movement acceleration, task reload timers, resource collection time, building construction time and more.
      • Added a speed modifier field in the Single Player Manager where you can pre-define speed modifier values that can be selected by the player using a drop down menu.
      • Added a speed modifier field in the Mirror’s multiplayer menu integration package where you can pre-define speed modifier values that can only be selected by the host player in the lobby.
    • Defeat/Win Condition:
      • Added a defeat condition field in the Single Player Manager where you can pre-define sdefeat conditions to be used in the target map that can be selected by the player using a drop down menu.
      • Added a defeat condition field in the Mirror’s multiplayer menu integration package where you can pre-define a list of defeat conditions to be used in the target map that can only be chosen by the host player in the lobby.
    • Attack Object component:
      • Added an obstacle layer mask specified which defines the object layers for which a collision means disabling the effect object.
      • Added the “Child On Damage” field which makes the attack object a child of the faction entity/obstacle that it damages/collides with.
      • Added the option to create a new attack object from the RTS Engine menu items.
      • Added an Effect Object field (Hit Effect) for the attack object component that is triggered when the attack object deals damage to a target
      • Added an Audio Clip field (Hit Audio) in the Attack Object component that is played when the attack object deals damage to a target or when it collides with an obstacle.
    • Task Manager:
      • Added the ability to use a custom cursor in the game instead of the default OS cursor.
      • Added a field to allow to override the cursor’s hotspot when using custom cursor textures.
    • Mirror Integration Package:
      • The host now must also mark himself as ready in order to start the game.
      • Starting the game from the lobby will trigger sending a faction slot indexes shuffled list to be used in the game scene to randomize the player faction slots (if that is enabled in the target map).
    • Demo Game:
      • Added several audio clips to be used in the demo game.
      • Added two new units for the demo: Catapult and Spacecraft which can be both created from the Barrack building.
      • Added a drop off object for the villager demo unit.
      • Added several animation clips for different demo units in different states.
      • Updated the faction type info assets for the demo to use different population buildings.
      • Added a building construction effect for demo buildings which makes use of the RTS Engine delegate events (as an example on how to use the custom delegate events).
      • Added a unit ragdoll effect which is enabled using the RTS Engine custom delegate events when units are dead.
      • Added several particle effects for the demo map.

    Since the showcase video from v1.3.0 is pretty outdated now (it was actually released around this time last year), I've made a new one to display the latest features of the asset.

     
    meTonne, THORONGlL and digiross like this.
  38. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    The RTS Engine is now on sale!

    Get it now for 50% off!
     
    mcchief and THORONGlL like this.
  39. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    v1.4.1 has been submitted. Here's the update list:
    • Fixed a bug where units couldn’t start constructing a building when they’re dropping off resources.
    • Fixed playing the death animation for units.
    • Added the option to choose faction entity codes or categories when assigning the list of targets that an attack entity can engage (or not engage).
    • Added the option to choose faction entity codes or categories when assigning the list of units that an APC can add (or not add).
    • A map is now playable with one faction only.
    • NPC Factions now recognize all units and buildings as valid targets when the game defeat condition is set to eliminate all entities. They prioritize target buildings that they have assigned in the NPCAttackManager inspector as usual.
    • The task system (mainly the Task Manager and Task Launcher components) has been re-written from scratch where a lot of earlier minor issues have been fixed. It’s now more modular, more simple and user-friendly. Please check this update guide: http://soumidelrio.com/docs/unity-rts-engine/update-helper/v1-4-1/ to walk you through updating to the new task system.
    • The UI Manager has been re-written from scratch to be more performant and modular.
    • Multiple unit selection task: if player clicks on one of the multiple unit selection tasks:
      • Multiple selection key (assigned in the Selection Manager component) is held down -> deselect unit from group
      • Otherwise -> select that unit only
     
  40. JessieK

    JessieK

    Joined:
    Feb 4, 2014
    Posts:
    148
    Hello any chance of putting in "attack move" like most modern RTS games have:
    (A good explanation of how it works in starcraft 2)

    Starcraft 2 being the one that leaps to mind, basically you click A for "attack" and then click on the map where you want the unit to go and that unit will attack any enemy units it comes across on its way towards that area.

    It makes combat way more quick and smooth, rather than clicking to attack each small unit you can just attack move and handle the units in bulk.
     
  41. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    Attack move will be added in either the next update or the one after it. Thanks a lot for the suggestion!
     
    JessieK and Gatskop_Software like this.
  42. JessieK

    JessieK

    Joined:
    Feb 4, 2014
    Posts:
    148
    Hello, I replaced the models ONLY for all of the models in the RTS engine, I set them up so they spawn right but now the houses complete but don't give me any population and I get this error:

    NullReferenceException
    RTSEngine.BuildingHealth+State.Toggle (System.Boolean enable) (at Assets/RTS Engine/Buildings/Scripts/BuildingHealth.cs:33)
    RTSEngine.BuildingHealth.ActivateState (RTSEngine.BuildingHealth+State newState) (at Assets/RTS Engine/Buildings/Scripts/BuildingHealth.cs:178)
    RTSEngine.BuildingHealth.CompleteConstruction () (at Assets/RTS Engine/Buildings/Scripts/BuildingHealth.cs:132)
    RTSEngine.BuildingHealth.OnMaxHealthReached (System.Int32 value, RTSEngine.FactionEntity source) (at Assets/RTS Engine/Buildings/Scripts/BuildingHealth.cs:82)
    RTSEngine.FactionEntityHealth.AddHealthLocal (System.Int32 value, RTSEngine.FactionEntity source) (at Assets/RTS Engine/Faction Entity/Scripts/FactionEntityHealth.cs:113)
    RTSEngine.FactionEntityHealth.AddHealth (System.Int32 value, RTSEngine.FactionEntity source) (at Assets/RTS Engine/Faction Entity/Scripts/FactionEntityHealth.cs:85)
    RTSEngine.Builder.OnInProgress () (at Assets/RTS Engine/Units/Scripts/Builder.cs:51)
    RTSEngine.UnitComponent`1[E].OnActiveUpdate (System.Single reloadTime, RTSEngine.UnitAnimState activeAnimState, UnityEngine.AudioClip[] inProgressAudio, System.Boolean breakCondition, System.Boolean inProgressEnableCondition, System.Boolean inProgressCondition) (at Assets/RTS Engine/Units/Scripts/UnitComponent.cs:129)
    RTSEngine.Builder.OnActiveUpdate (System.Single reloadTime, RTSEngine.UnitAnimState activeAnimState, UnityEngine.AudioClip[] inProgressAudio, System.Boolean breakCondition, System.Boolean inProgressEnableCondition, System.Boolean inProgressCondition) (at Assets/RTS Engine/Units/Scripts/Builder.cs:31)
    RTSEngine.UnitComponent`1[E].Update () (at Assets/RTS Engine/Units/Scripts/UnitComponent.cs:105)
     
    Last edited: May 27, 2019
  43. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    It seems like you've forgot to update the "Faction Color Renderers" array in the Building component's inspector. As you might've seen, some parts of the demo buildings get colored to represent their faction colors. And since you've removed the building models without updating this array, you're getting null reference exceptions.
     

    Attached Files:

  44. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    v1.4.2 is now live on the asset store. New selection system that performs way better and is easier to customize!

    Here's the update list:
    • Fixed an issue in the Task Launcher Editor component that is triggerd when a task is added/removed.
    • Fixed a bug that led to removing the capital status of the capital building when it is upgraded.
    • Removed the Flat Terrain field from the Terrain Manager component. Having a flat terrain for each map is no longer required.
    • Fixed the creation of the attack object’s trigger effect.
    • Fixed an issue in the hover health bar UI that led to not displaying the source’s health correctly.
    • Fixed a bug in the Mirror integration package that caused a player’s faction to remain undestroyed if their game is interrupted (unexpected disconnection).
    • Rewrote the selection system (Selection Manager, Selection Entity, etc..) from scratch:
    • Resources, buildings and units can now be multiply selected.
    • Added selection options which allows to define whether resources, buildings and units can be multiply/exclusively selected or not.
    • Updated the selection box to be more performant without causing any performance issues when attempting to select a large amount of units.
    • Idle units can now be selected using a key that can be defined from the Selection Manager inspector.
    • Added the ErrorMessageHandler component which is a dedicated component that is used to report errors/messages during the game and display them in UI player messages.
    Full changelog can be found as always in this page: http://soumidelrio.com/assets/rts-engine/changelog/
     
  45. greene_tea92

    greene_tea92

    Joined:
    Jun 26, 2017
    Posts:
    14
    Hey there, bought this asset awhile and had a few questions.

    1. How does custom terrain work with the terrain manager? I just need to place my custom terrain a little above (or below) a plane the terrain manager makes? I read the docs and am still a little confused, any additional details you could spare would help greatly.

    2. Which script controls the game options manager (the scene where the player picks the difficulties, number of factions ect).

    3. Finally, any way I'd be able to set up a scene where the player already has a castle? Like, they load into the level and already have a few walls built for them.

    Any help would be greatly appreciated, thanks!
     
  46. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    I believe I have answered you on Discord, please correct me if I'm wrong.
     
  47. unity_KbyTpRlJOWZuWg

    unity_KbyTpRlJOWZuWg

    Joined:
    Mar 28, 2019
    Posts:
    7
    Hi,

    Something is missing from the multiplayer tutorial. I have tried with a complete clean setup and nothing happens when pressing the button. I can see in the console log that the error has something to do with the function startGame. (I think). Please! BR / Emanuel
     
  48. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    Can you show me the error you're getting?
     
  49. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,242
    Just submitted a small patch to fix some issues that appeared in the last update:
    • Fixed selecting a single unit from the multiple selection panel.
    • Fixed the building upgrade field in the Task Manager custom editor.
    • Fixed adding units to a unit APC.
    • Remove all SetDirty calls on the custom inspector editor components since that triggers an autosave in prefab mode in Unity 2019.
     
    Last edited: May 30, 2019
  50. unity_KbyTpRlJOWZuWg

    unity_KbyTpRlJOWZuWg

    Joined:
    Mar 28, 2019
    Posts:
    7
    OussamaB see attached image
     

    Attached Files: