Search Unity

Unity RTS Engine

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

  1. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    97
    You said that in the current update the turret problem where it didn’t react was solved but I'm trying to define a basic building with an attack component and I obtain no reaction from the turret against my coming units.

    How I can solve this or verify what I need ?

    Edited : Problem solved

    I finally managed to find the issue.
    In the attack component when we define a building as attacker, three parameters are missing.
    We need to modify the attack editor to restore : attack in range/search range/search delay
    Without this, the building doesn't pass the test to search around for nearby enemies.

    Full fonctionnal deadly turrets on the way now :cool:
     
    Last edited: Aug 6, 2018
  2. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    97
    I have also a question concernant the auto rotation of units in the Unit.cs script.

    I was a bit surprised by the behaviors of turrets on units which were a bit useless since the units are always rotating to the target and the turret doesn't really have the time to rotate.

    I have neutralized these lines in the script:

    if (LookAt != Vector3.zero)
    {
    //Quaternion NewRot = Quaternion.LookRotation(LookAt);
    //transform.rotation = Quaternion.Slerp(transform.rotation, NewRot, Time.deltaTime * RotationDamping);
    }


    And I get two interesting things:
    - when we move several units, they stop to face to the targeted location "in flower" (I don't like to see my units doing a meeting on the battlefield :D)
    - units with turrets have only the turret which rotates when we attack an enemy so the behavior is widely close to the real behavior wanted for turrets

    The bad side is that common units without turrets don't face anymore the target.

    So I think that you should do two things to have the best behavior of units:
    - create a boolean to define if the unit has a turret or not and neutralize the rotation of the main body when she attacks to let the turret faces correctly the target
    - suppress the rotation step when the unit or units are simply moving to a location.

    I have done quickly these two changes in your unit.cs and I can say that this is really enjoyable to get the correct behavior. ;)

    You can see here my test unit with the turret facing the enemy building on the opposite of the front of her body:



    I have just done this by a boolean which neutralizes the two lines if we checked in the unit editor that we have a turret on this unit. So very little modification for a great effect.

    EDIT : Additionnal question :

    Is there a way to have the turret fire only when she faces the target ? Sometimes she fires before being exactly on the line of the target.
    Can LoS help in this case ?

    LoS is applied to turret when the unit has one ?
     
    Last edited: Mar 6, 2019
  3. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    97
    A small question:

    When I build a structure, I have always the beginning of the green bar which is not located exactly to the beginning of the orange bar - this is only the case for this bar, the others in the UI are fine.

    How I can define the good location ? I have compared the green and orange components in the HealthBarCanvas and they are located exactly at the same location.

     
  4. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    There's a missing field in the Unit's component inspector under the movement settings and that is the "Rotate when idle?" toggle field. That allows you to allow the unit to fully rotate to face its target (destination) when it's idle after completing its movements towards that particular target. So yeah, that toggle field actually delivers what you want. I'll add it in the next update (I can also send you the modified version of the Unit component editor so you don't have to wait for the update). I'm also planning to slightly change all custom editors to look like the recent Task Launcher editor so that everything can be broken down into tabs and it won't be overwhelming as it is now.

    In the LoS configurations (on the Attack component), there's a toggle field called "Use Weapon In LoS" which when enabled, will the use the assigned weapon object in the Attack component (in this case, the turret) as the reference for the LoS calculations. While disabled, the main unit object will be used a reference for the LoS.
     
  5. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Yes, that is indeed missing, thanks a lot for pointing this out and as always, it is much appreciated.
     
  6. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Yes, I have been aware of this issue since a few days now and it will be fixed. Will let you know as soon as I have the fix.
     
  7. jobo22

    jobo22

    Joined:
    Dec 1, 2016
    Posts:
    83
    So I just updated to version 1.3.2 and am having a couple issues. First, whenever I build a unit, it removes the animator controller so the units don't animate. Second, the units won't move when I right click on the map, only if I right click on the mini map. Everything worked perfectly before the update. Any ideas? Thanks! :)
     
  8. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    97
    For the movement of your units, the terrain manager has been changed, maybe you need to check if you always have the right layers defined in this manager.
     
    jobo22 likes this.
  9. jobo22

    jobo22

    Joined:
    Dec 1, 2016
    Posts:
    83
    That was the problem, I had to set the ground terrain mask to terrain. Thanks tons!
     
  10. hermolenda

    hermolenda

    Joined:
    Apr 9, 2017
    Posts:
    11
    Hello i got small problem ! i am sure its on me and i forgot somethings.
    I am working on copy of demo scene, I made my buildings prefabs change variables of them in game manager and factions etc but still enemies area building theirs old prefabs from asset. What did i forget about??
     
  11. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    97
    I can wait the next update thank you.
    Just good to know that this behavior will be possible soon.

    I have also a question concerning attack objects :
    They are destroyed each time they enter a collider - right ?
    If I generate a cloud of small objects with colliders on them, the attack object could be detroyed if he hits one of these colliders - right ?
    Or the code limits the interaction only with colliders linked to units and buildings ?
     
    Last edited: Aug 8, 2018
  12. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    97
    Concerning upgrade function - I have several questions:
    - I tried to define an upgrade on my HQ with a version lvl1 without a shield and a version lvl2 with a shield
    I have defined all entries on the lvl1 HQ to upgrade to the lvl2 prefab with a requirement of resources and with or not depending of the test case of another structure (tech center in this case).

    I can see the Upgrade button if I check "directly" in the component but nothing happend when I click on the button.
    In all cases of test even with no condition of resources and buildings the button has no reaction.

    > Is there a problem of a link with the button in the UI maybe ?

    I see this in the button panel :



    I have modified the task button to select the upgrade building task but nothing happend.
    I see a missing entry on the component on top of picture.
    Something linked to this ?

    - Also if the function is functional - how does it work for the AI and the builder:
    > All upgraded buildings are replaced in the buildingsmanager by their new versions ?
    > The builder panel has also new icons linked to the new upgraded prefab?
    > Do we need to list all buildings for the AI in the NPC building component including the upgraded versions or the link is automatically made in-game during the process of update and she knows what she need to use and build after an upgrade?

    - Concerning the upgrade of a building: if we destroy an upgraded building, we can build again the same version or the building available will be the initial version?
     
    Last edited: Aug 8, 2018
  13. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    97
    To help, from what I know and understand, you have the list of buildings in:
    - building manager
    - in each faction manager in the NPC building component

    You have also a component which contains two buttons :
    - update list of spawnable buildings
    - reset list of spawnable buildings
    This component is somewhere in one of the managers - just look at each one by one.

    Maybe this is this one where you need to reset and update the list by clicking on each button since you say that you have already updated the list of prefabs in building and factions components ?
     
  14. hermolenda

    hermolenda

    Joined:
    Apr 9, 2017
    Posts:
    11
    I reset update them still doesnt work. Yes i changed faction list.:
    upload_2018-8-9_11-13-18.png
     
  15. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,945
  16. JackieFPS

    JackieFPS

    Joined:
    Mar 17, 2014
    Posts:
    3
    Why am I getting this error please

    Code (CSharp):
    1. Assets/RTS Engine/CustomEventsExample.cs(31,40): error CS0117: `GameManager' does not contain a definition for `PlayerFactionID'
     
  17. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Hey there, did you setup the buildings in the NPC Building Placement component?

    EDIT:

    You should also have a look at the Border component of your building centers. You can define buildings that a NPC faction must place there as well, so make sure you don't have any old buildings assigned there.
     
    Last edited: Aug 10, 2018
  18. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Not destroyed but hidden and available to be re-used again.

    You can technically assign a collider for each child object and then whenever a child object enters in collision, you simply call the code that assigns damage from the parent object (one that holds the Attack Object component). But yeah, per default the interaction is only linked to the object that has the Attack Object component.
     
  19. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Yes, on the missing entry, assign TaskUI -> OnTaskClick.
    And yes you've correctly fixed the Task Type field in the Task UI component.

    Yes.

    Yes.

    Only the base buildings, not the ones that you get after an upgrade.

    Building upgrades are handled like research, once you've unlock one building upgrade, it simply means that you are now able to place the upgraded building so yeah, if the upgraded building is destroyed, then you can place the same version again.
     
  20. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Hmm, have you modified the Game Manager component? Or the component that produces the error?
     
  21. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Done. Check your inbox.
     
  22. giotta

    giotta

    Joined:
    May 31, 2015
    Posts:
    48
    Hi,can this asset work with isometric camera ?
     
    Last edited: Aug 12, 2018
  23. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Yes, you'll probably have to adjust the camera's movement behavior though.
     
  24. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    97
    How can we manage several turrets on a single unit ?

    Can we add several attack components to a single unit to do this ?
     
  25. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    You have two options:

    1) You want to fire from all turrets from one attack: For this you simply define multiple attack sources in one single Attack component.
    2) You want to switch between turrets for each attack: For this you simply add as much Attack components you need and add the Multiple Attacks component so you can be able to switch between different attack types.
     
  26. KevinVon21

    KevinVon21

    Joined:
    Feb 5, 2017
    Posts:
    2
    Hello, first of all, wonderful work guys.. i am a computer science student and i want to know if i may be able to buy and use your rts engine available in Unity Store as the base for my rts game.. can i modify it by adding my code? And can i add new features to it for my personal game? Thank you
     
  27. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    All source code is available so you can modify it all. While most built-in features can be customized just from the inspector, you can customize them further by modifying the code.

    The asset also comes with custom delegate events that are triggered whenever a major action happens in the game (for example: OnUnitClicked, OnTaskLaunched, OnFactionDefeated, etc...), this makes it easier to extend the engine through your own code.
     
    KevinVon21 likes this.
  28. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    97
    I have found two bugs with the converter component.

    The first one is linked to the two lines below in bold.
    They need to be moved in the if group or we get a null exception error and the unit is not converted.

    //Clear all the pending tasks.
    TaskMgr.TasksQueue.Clear();


    Code (CSharp):
    1.             if (TaskMgr != null)  //if the unit has a task manager
    2.             {
    3.                 //If there are pending tasks, stop them and give the faction back the resources of these tasks:
    4.                 if (TaskMgr.TasksQueue.Count > 0)
    5.                 {
    6.                     int j = 0;
    7.                     while (j < TaskMgr.TasksQueue.Count)
    8.                     {
    9.                         TaskMgr.CancelInProgressTask(TaskMgr.TasksQueue[j].ID);
    10.                     }
    11.                 }
    12.                //Clear all the pending tasks ->>> Moved to the if
    13.                 TaskMgr.TasksQueue.Clear();
    14.             }
    The second one I can not solve by my own is the effect after convert action.
    The unit is converted but the effect is played in loop without end at the initial location of the targeted unit.
    Any idea to suppress the effect after the first run ?

    Code (CSharp):
    1.             //spawn the convertion effect:
    2.             if (Converter.ConvertMgr.ConvertEffect) {
    3.                 Instantiate (Converter.ConvertMgr.ConvertEffect, transform.position, Converter.ConvertMgr.ConvertEffect.transform.rotation);
    4.             }
     
  29. MegaCo

    MegaCo

    Joined:
    Jan 24, 2018
    Posts:
    84
    Is it possible to use the events system to create UI button. I would like military building to have its own selection from the resource buildings.
     

    Attached Files:

  30. II_Spoon_II

    II_Spoon_II

    Joined:
    Jun 16, 2018
    Posts:
    180
    I would like to know more about the Multiplayer mode, how advanced is it? Does it manage everything we need in multiplayer and we can launch it, or still needs networking line codes?
     
  31. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    97
    Can the AI upgrade her buildings or her units?

    I don’t remember if i asked this before.
     
  32. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Thanks a lot for letting me know about this, fix will be available in next version.

    I guess that depends on how you set up the converter effect but that doesn't matter because I need to make the Effect Object Pool component manage this one as well, which will of course be included in the next update.
     
  33. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Are you referring to having sub categories in the building list panel?
     
  34. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    I just answered you per e-mail, check it out and let me know if you still have any more questions
     
  35. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Yes, managing how the AI faction handles its building/unit upgrades can be done through the NPC Resource's component (under Task/Building Upgrade Settings).
     
  36. MegaCo

    MegaCo

    Joined:
    Jan 24, 2018
    Posts:
    84
    Yes
     
  37. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Okay, the asset offers a task panel category feature and this allows you to assign tasks button to be children objects of different parents. Now you can write a component that handles the different task parent objects and have your own buttons to enable/disable these parent objects.
     
  38. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    97
    A target for the release?
     
  39. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Early next week.
     
  40. KevinVon21

    KevinVon21

    Joined:
    Feb 5, 2017
    Posts:
    2
    One more question, how hard is the hard mode AI? Does the Hardmode AI Nation invade?
     
  41. jobo22

    jobo22

    Joined:
    Dec 1, 2016
    Posts:
    83
    Hi, I have a question about the LOS. It works how its set up right now, but I would like to make obstacles that units can't shoot through, such as big rocks or ruins and stuff. Right now the units will shoot through objects that have a collider on them. Could you make it so there is a layer we can put certain objects on that we don't want the units to be able to shoot through? Thanks!
     
  42. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    The AI can be easily configured through three main components: NPC Army (which mainly handles attacking & defending), NPC Building Placement (handles buildings) and NPC Resource (which handles how the NPC faction collects and spends its resources). These three components can be configured from the inspector, you can easily make a NPC faction that can be very challenging by tweaking the fields in the mentioned components.
     
  43. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Yes, currently LOS ignores objects, I've added this in my to-do list. Will let you know as soon as it's available.
     
    jobo22 likes this.
  44. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    97
    One question concerning the map size in the game manager.
    By default this is defined to 150 but 150 is linked to a real parameter?
    In the documentation the value is said to be used for the expansion of AI but how is it considered?

    Is it a ratio between X/Y lengths of the map or something else?
     
  45. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    You simply input the size of the map you have and then assign the percentage that the AI faction aims to have under its territory considering that size. HOWEVER, I would like to change how that works (especially how the AI handles expanding since that's something that I haven't touched since the release of the asset). It's already on my todo list for the next AI update.
     
  46. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    I just submitted v1.3.3 to the store. It should be available in a couple of days. Here's the full update list:
    • New Features:
      • Added a "Rotate While Idle" toggle field in the Unit component inspector that enables/disables the unit's rotation when it's idle.
      • The Attack component for buildings now has the following fields in the inspector: Search In Range (toggle field that enables/disables attacking units in range), Search Range (defines the range where the building searches for enemy units to attack) and Search Reload (attack in range search reload time).
      • The audio clip that's played when a unit is sent to collect resources can now be chosen from each unit's Gather Resource component.
      • You can now create the Faction Type Info asset in the project to create/define a new faction type and then use that same asset files in maps and menus.
      • You can now create the Resource Type Info asset in the project to create/define a new resource type and then use that same asset in different maps.
      • Custom edtiors for both Resource Type Info and Faction Type Info assets.
      • You can now assign a target unit to an attack building (tower for example) by selecting the building and right clicking on the target.
      • Moved Task Components settings from the Unit Manager to the Task Manager component.
      • Added the Attack component task to buildings that have an Attack component: select a building that has the Attack component and an icon will appear on the task panel which allows the player to select a target.
      • You can now choose for each building whether they can be placed outside the faction's borders or not.
      • Added a "Required Buildings" field to the Building component: define a list of buildings that must be spawned & built in order to place a building.
      • The conversion effect is now an Effect Obj and is now handled by the Effect Obj Pool component.
    • Bug Fixes:
      • Fixed the warnings appearing whenever an invalid animator override controller is assigned to a unit.
      • Fixed assigning a target to a converter.
      • Updated and fixed missing fields in the demo and menu scenes.
      • Fixed a bug that triggers the multiple selection box when placing buildings.
      • Fixed hover health bar positioning.
      • Fixed a bug that causes an exception error whenever a building cancels in progress task.
      • The building's selection texture now gets auto-enabled when the building is getting placed.
    As mentioned in earlier replies, in the next update I will focus more on AI behavior.
     
    jobo22 and digiross like this.
  47. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    The newest update is now live on the asset store. Make sure to read the release notes to learn how to use the new features. Feedback is as always appreciated.
     
  48. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    97
    I have just switched to your new version and it seems easy to move to this new version without problem once we have defined the faction and resource assets files and connected them to their manager.

    I have some points to share :) :
    - The documentation is not updated concerning the new terrain manager from previous system;
    - The version 1.3.3 seems to clean all icons (move, attack, collect) etc in the current input manager - we need to add them again
    - The building progress bar is not corrected, we have the green bar not defined on the location of the orange bar like before - due to an existing scene ? How can we solve this ?
    - The IDLE option doesn't solve the turret rotation behavior. As discussed in a previous post, you need to add an option neutralize the rotation when the unit has a turret.
    - Seen in previous version : the collector starts with the drop off model visible - I have used the start function to deactivate the drop off model at the beginning to be sure to start without resource on the model.
    - The upgrading tasks ignore the building requirement list - it works well if the building is built but if we upgrade a building we cannot limit the uprade to the presence of a specific building (example: upgrade the HQ to level 2 only if the player has already built the tech center).

    Special questions concerning the AI:
    - I have seen that the first task of the AI on my scene is to uprade the HQ - this was not the case with the previous version - do you have changed the priority and the management of tasks for AI?

    One request:
    Could it be possible to have a task system which gives feedback for:
    - unit which does an action?
    - unit which receives the action?
    Example: the healer -> we should have an effect like an healing wave or something like this and the unit repaired should also have a visual effect which shows that she's healed.
    This can be applied to converter, builder which repairs, etc...
    We have the animator to show something but this is visualy limited.

    This can be done by scripting of course but since you offer the heal/repair/convert functions as native we should be able to handle this without any new code.

    EDIT:

    I would add also two others items:
    - an effect entry activated when a building is producing a unit;
    - a explicit visual for player for the new bulding requirement function where the icon of the building is grayed or something like this if the requirement is not reached and a red color for the requirement in the text description.

    And one remaining question:
    - The building category parameter seems not used. What is the goal of this entry?
    Any use somewhere?
     
    Last edited: Aug 23, 2018
  49. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    97
    Just found a bug: a unit which can only attack buildings - if she's selected in a group where units can attack units and we order the group to attack units, the unit attacks also the units.
     
  50. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Documentation page for the Terrain Manager has been updated. Thanks for letting me know.

    This can be configured through the Task Manager component now.

    You simply need to move the full health bar as child object of the empty health bar. That'll fix it.

    You're right. The rotation on idle was getting re-enabled when the unit completes its movement which is not supposed to happen. I'm submitting a fix for this soon.

    I just assumed that the drop off model will be turned off by default but I'll make sure to have it turned off in Start () as well.

    Makes sense. What do you think of making the building requirements list a list of lists? For each element you specify a list of buildings that when one of them is available, others are ignored.

    Nothing major has been modified concerning the AI. But I think you have modified something in the Tasks/Buildings Upgrade Settings in the NPC components, can you please confirm if this is the case or not?

    So if I understood this correctly, you want to have a Task Type that affects a target unit/building and that calls custom events and allow you to do anything with the information it provides?

    Effect that appears on the unit when it has been just produced or an effect that appears on the building?

    I like this, on my to-do list!

    The Category parameter for both units and buildings has been previously used in the APC and the Attack components to determine which units/buildings you can attack/allow in the APC (by specifying their categories in the inspector). But now you can only specify their codes. So while there's no current use for that parameter, I think some users have found it useful when they're extending the asset by creating their own components that make use of it or it simply helps users to organize units and buildings.