Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  6. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  7. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  8. 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. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    47
    So I made several tests now since the AI components are working better and I think according to my need but also for most cases of users, the AI behavior needs some strong tweaks.

    The first one is to offer the possibility to have a builder separated to the collector in order to extend the possibilities of gameplay without crippling the actions of the AI.
    I can do this now but for the AI I use the spawn components to be sure that the AI will not be stucked.

    The second one is to help to define build orders like in all RTS.
    You idea to define a behavior which calls the requirements depending of needs is good but I think that it is completely ruined by the fact that :
    - you don't have a tech tree function for a faction to define requirements to build one or another building;
    - the AI just try to put all buildings without taking into account that she wastes all resources in this.
    For this, I have used the border component for each building to define which building will be built after another one with a special timer but this is not comfortable also. It works but this is not the best way to do that.
    In an other hand, the border component is very interesting to design some AI behaviors to place buildings. It is a good tool. I would take this as a sub designer for AI behaviors to put turrets around resources or mines for example to protect a special area. I think that this could be extended to be more usefull.

    One simple way to do this I think :
    Use the NPC building component and in the list of buildings add a timer for each building (with a random factor or not) in order to define exactly the order of production for the AI.
    You can use a list of a list in order to define several build orders picked randomly for each game.

    The main fact is that for example in this case below I have destroyed her factory and the AI doesn't rebuild it. She spams generator which generates a resource not used and she's completely without any defense except with the airfighters (cannon fodder)...
    I really would like that the AI rises the factory as fast as possible.



    Linked to this and discussed before, could you add a tree for buildings dependancy to have several tiers with ou without upgrades of buildings?
    Maybe you can add a tech level variable and a list of requirements for each building component?

    Continuing for AI topic :
    The AI definitely needs several attack groups.
    I would split the NPC army component or create a list of attack groups.
    I saw that she attacks when the common group is filled and strike the HQ, ignoring the players units.
    This is not really fun to counter or play with.
    Balance between fun to play and challenge to survive :rolleyes:

    I have also seen that the local AI of each unit prefer to select its own target over the player choice if something seems to be more relevant and if something is attacking the AI.
    It is fine for the AI side, but this behavior is not acceptable when you are the player since your units don't react to your orders. Bad experience for a RTS player in all cases.
    The player's order should not be modified during an active phase - but we can have automated behaviors in a passive stance.

    I have noted that the option to select several units by a dragged rectangle doesn't work if we cover a part of a building.
    This is annoying.
    I have also seen that sometime the double click only select few units of the same type on the screen and some other are not selected.
    These two points need to be investigating since this reduces the control of player on his army and this is very difficult to do fast actions during a fight.

    I have also a request concerning the AI goto point and maybe this can be applied to the player also : could you are a small area around the goto point where the AI can select a destination in order to avoid the flower of units which look at the same point? Some RTS use with to avoid this effect or create a grid to park the new units.
    The bad thing now is that the AI produce units and if they are several units they are blocked on the entrance of the factory. Sometimes stucked completely.

    An other way to avoid this, used in most RTS, is to define a rally point for the AI only where she locates her army before a strike to avoid this effect. This could be usefull.

    EDIT :
    One additionnal question: if the AI doesn't have a LoS on the target, the AI unit will move to a location with a valide LoS or will she stay passive at its location?
     
    Last edited: Jul 30, 2018
  2. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,056
    On my to-do list.

    So a system that defines buildings that the AI can place with amount required per building center and with priority should solve this issue.

    A tech tree has been previously requested but I believe with the new Task System, it should be easier to add now.

    You're right, this needs to be tweaked.

    In addition to this what do you think about an AI Wandering behavior that makes a certain amount of the army units wander inside the faction's territory?

    It will rotate until the enemy is in its LoS.

    --

    The next update will feature a global faction & resource definer so that you don't have to re-create everything for each map you're configuring. That will be the main theme of the upcoming v1.3.3. However v1.3.4 will only feature AI improvements and I will take into consideration all what you mentioned above, so I ask for some patience for this.
     
  3. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    47
    This could be an interesting behavior to have a more dynamic opponent.
    In a previous modded game, I used something like this to make some patrols around the AI base to avoid attacks from behind.
     
  4. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    47
    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
  5. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    47
    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: Aug 6, 2018
  6. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    47
    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.

     
  7. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,056
    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.
     
  8. OussamaB

    OussamaB

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

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,056
    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.
     
  10. jobo22

    jobo22

    Joined:
    Dec 1, 2016
    Posts:
    58
    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! :)
     
  11. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    47
    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.
  12. jobo22

    jobo22

    Joined:
    Dec 1, 2016
    Posts:
    58
    That was the problem, I had to set the ground terrain mask to terrain. Thanks tons!
     
  13. 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??
     
  14. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    47
    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
  15. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    47
    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
  16. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    47
    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 ?
     
  17. 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
     
  18. AmRafay1

    AmRafay1

    Joined:
    Oct 22, 2013
    Posts:
    631
  19. 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'
     
  20. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,056
    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 at 11:23 PM
  21. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,056
    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.
     
  22. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,056
    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.
     
  23. OussamaB

    OussamaB

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

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,056
    Done. Check your inbox.
     
  25. giotta

    giotta

    Joined:
    May 31, 2015
    Posts:
    36
    Hi,can this asset work with isometric camera ?
     
    Last edited: Aug 12, 2018 at 9:59 AM
  26. OussamaB

    OussamaB

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