Search Unity

Unity RTS Engine

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

  1. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Not really, the asset can be a great starter pack for something like Clash of Clans but it wasn't the inspiration for it. This asset is suited for the creation of a classic RTS (age of empires, warcraft, rise of nations, etc..).
     
  2. jobo22

    jobo22

    Joined:
    Dec 1, 2016
    Posts:
    83
    I found the problem was with the NavMeshAgent, I had to set NavMeshAgent.updateUpAxis to false. Thanks for pointing me in the right direction!
     
    OussamaB likes this.
  3. Ajukili

    Ajukili

    Joined:
    Oct 12, 2018
    Posts:
    1
    Hello,

    Bought this a few days ago, great work! However I can't run a new map.

    So the demo scene works well, but after I create a new map, set up the managers and capitals, I can't get the game to start. Tried both building it and running it from the editor. Essentially the game is frozen. An HP bar appears for a millisecond over the capital and then disappears. I can't click anything, not even the UI. I tried importing managers, castles and functions from the demomap but still nothing. No script changes. Any ideas?
     
  4. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Are you getting any errors/warnings?
     
  5. jobo22

    jobo22

    Joined:
    Dec 1, 2016
    Posts:
    83
    Something I noticed is that my units will select a different target even when I right click on an enemy. So instead of attacking the unit I want it to, it will switch to another target that it wants to attack.
     
  6. Huntah666

    Huntah666

    Joined:
    Aug 23, 2018
    Posts:
    12
    Does anybody here know how to stop task from re-ordering themselves mid-game.

    For example lets say category 0 of a capital makes a worker, a healer and a converter. One time I open it the worker is on the far left, next time someone else is there.

    The same thing happens with building task in a villagers task menu, the building change order as well which can become quite confusing, any help is greatly appreciated.
     
  7. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    97
    Same behavior here, I have seen this since a long time (not linked to last updates) I have a panel which contain more than three tasks.
    The first line of button is shuffled after the first use of an action.
    Sometime the turret move to the last position when se was the first.

    It seems that there is a reorder of the task list which define buttons in some cases.

    Also the action buttons and the tasks buttons share the same first line.
    Maybe there is a conflict of’placement ?
     
  8. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    These are known issues, I will try to fix them for the next update but I really want to finish the NPC faction update first which will be submitted this week (as I need to update the docs first).

    I'll be sharing some info about the new NPC system later today so stay tuned!
     
    jobo22 likes this.
  9. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    As promised, here's some information about the new NPC system:

    - The NPC Army, NPC Building Placment, NPC Resource & NPC Unit Spawner components have been all deprecated.

    - NPC Regulators: a NPC Regulator is responsible for regulating the creation and maintenance of a certain unit/building type. You'll be able to set the ratio of that unit/building type in relation to the max population slots, minimum/maximum allowed amounts, placement options (for buildings only) and a couple more settings using the NPC Building Regulator & NPC Unit Regulator. This component is a scriptable object which can be created from the project tab. I've also added the feature to automatically generate NPC regulators from the available building/unit prefabs in the resource folders so it's faster & easier to create them.

    - A couple of new components will be also introduced to control the behavior of the NPC faction, including:
    * NPC Unit Creator: responsible for the creation of units.
    * NPC Building Creator: responsible for the creation of buildings.
    * NPC Building Placer: responsible fort the placement of buildings.
    * NPC Building Constructor: responsible for the construction of buildings.
    * NPC Resource Manager: manages resources inside the territory of the NPC faction.
    * NPC Resource Collector: responsible for the collection of resources.
    * NPC Territory Manager: responsible for expanding the NPC faction's territory.
    * NPC Attack Manager: targets another faction & decides when to attack it.
    * NPC Army Creator: responsible for the creation of army units.
    * NPC Defense Manager: activated when the faction is attacked, responsible to defend the NPC faction's territory.
    * NPC Population Manager: manages the NPC faction's population.
    * NPC Task Manager: manages urgent tasks that need to be executed by the NPC faction (only a lite version of this component will be submitted in the next update but it will extended in the upcoming updates).

    - The new NPC components aren't referenced in other components as I wanted to separate both logics so that it becomes easier to add NPC factions in the future. NPC components use Custom Events in order to track the progress of the NPC faction. With that being said, a couple of new custom events will be also introduced in the next update.

    - More NPC components are planned for future updates, including a component that manages upgrades which is planned for v1.3.5 where the focus will be to create a new unit/building upgrade system.
     
  10. Huntah666

    Huntah666

    Joined:
    Aug 23, 2018
    Posts:
    12
    Looks like some good updates coming :)

    I have a question about units not properly facing their targets, this goes for villagers facing buildings they are building, resources they are collecting and military units attacking others.

    I have the units in question set to rotate when idle, is there a certain setting I need to play around with to make my units correctly face their targets?

    Oh one more question while I'm here, how can I set the range of a ranged troop? Lets say I want an archer to be able to shoot up to 100 meters, but I only want a crossbowman to shoot 50, I mucked around with the LOS stuff but didn't really understand the results.

    Thanks for any answers :)
     
  11. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    This is a weird one, does this happen with the demo units as well? And what version are you using?

    You would simply define different range type on the Attack Manager component.
     
  12. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    So I'm done adding new documentation for the new NPC components. I also had a look at the other documentation and updated what needed to be updated.

    The update will be submitted to the Asset Store tomorrow and will be mostly available by next Monday.

    The next update (v1.3.5) will tackle the issue of unit/building upgrades: the goal is to simplify upgrading units/buildings and allow NPC factions to handle the upgrading process better. In addition, Unit and Building related components will be refactored in order to provide better overall performance and have better architecture that will you allow you to modify the code easily.
     
    jobo22 likes this.
  13. Huntah666

    Huntah666

    Joined:
    Aug 23, 2018
    Posts:
    12
    I'm using different assets, your assets are facing the targets. There must be some option I'm missing somewhere or a setting your units have that mine don't, ill figure it out.

    Thanks, didn't see that option there lol

    Looking forward to the update!
     
  14. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
  15. Ajukilibodin

    Ajukilibodin

    Joined:
    Apr 4, 2015
    Posts:
    1
    It fixed itself after re-importing and recreating the map.

    Another question though: any way to make the minimap circular? Or does it have to be a rectangle by design?
     
  16. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
  17. NCP722

    NCP722

    Joined:
    Oct 9, 2018
    Posts:
    1
    I'm fairly very new to unity, i am a senior at my High School, What advise would you give me to create new units, like i read the documentation over creating new units, but how do i design my own 3d models for units. Do i use blender? and does anyone have any links teaching me how to use blender or any other software best fit for this?
     
  18. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    I don't think this is the right thread to ask for 3d modelling advice. Sorry.
     
  19. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Hey guys, the new update is now available in the store, there has been a lot of changes so if something doesn't work anymore then please have a look at the documentation as it has been also fully updated. Let me know if you have any further questions.

    I have already started working on the next update which will mainly focus on bringing a new upgrade system for units and buildings + refactoring the unit & building related components to improve overall performance.
     
    digiross likes this.
  20. meTonne

    meTonne

    Joined:
    Apr 30, 2016
    Posts:
    70
    Hi ! I do update and I've a problem with the AI.
    I make all like the documentation and demo scene and I don't know where is the problem.
    The error message when AI want to place building :

    NullReferenceException: Object reference not set to an instance of an object
    RTSEngine.Building.IsBuildingInRange () (at Assets/RTS Engine/Buildings/Scripts/Building.cs:1319)
    RTSEngine.Building.CheckBuildingPos () (at Assets/RTS Engine/Buildings/Scripts/Building.cs:507)
    RTSEngine.NPCBuildingPlacer.Update () (at Assets/RTS Engine/AI/Scripts/NPCBuildingPlacer.cs:124)

    The border component is correct like demo scene... :/
    If you can help me thanks you.
     
  21. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    97
    Have you modify the behavior of units when the player gave orders and the unit followed the local AI script jamming the action of the player ?
     
  22. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    97
    I'm trying to move to the new version but it seems that I have a problem to get the RTS engine menu working.

    After the update, the menu is not showed.
    Maybe I had already faced this problem in the past but I don't find a way to show the menu.

    Any idea to restore the menu in an existing scene ?

    EDIT : Maybe a link to this which prevent the menu to be shown ?

     
    Last edited: Oct 29, 2018
  23. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Yes, it has been fixed.

    It seems like the Range class is missing, are you sure you haven't deleted the "Scripting" folder in the RTS Engine's folder?
     
  24. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    It seems like there's a problem with the Border component of the building center where the NPC is trying to place the new building. Can you check if the center building has a valid border component and that it doesn't get somehow destroyed?
     
  25. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    97
    Good tip - no more all of these lines but others errors :

    Assets/RTS Engine/Scripting/CustomEvents.cs(7,15): error CS0101: The namespace `RTSEngine' already contains a definition for `CustomEvents'

    Assets/RTS Engine/Scripting/CustomEventsExample.cs(6,14): error CS0101: The namespace `global::' already contains a definition for `CustomEventsExample'
     
  26. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Please do remove the CustomEvents.cs and CustomEventsExample.cs scripts that are placed in the RTS Engine folder as they are replaced by the ones inside the "Scripting" folder. Thanks for pointing this out, thought Unity would track the files and move them automatically but apparently that doesn't always happen.
     
  27. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    97
    Others errors after this fix :

    Assets/RTS Engine/AI/Scripts/NPCBuildingCreator.cs(275,33): error CS1501: No overload for method `CheckResources' takes `2' arguments

    Assets/RTS Engine/AI/Scripts/NPCBuildingCreator.cs(298,84): error CS0117: `RTSEngine.ResourceManager' does not contain a definition for `FilterResourceList'

    I don't see the RTS Engine menu so I cannot create NPC parts.
    A link ?

    I see that all of my managers are down : "the associate script can not be loaded"
     
  28. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    It seems like the Resource Manager component you have hasn't been updated correctly here. When importing the new version, did you uncheck some components in the import menu in order to not update them?

    EDIT: Also how did the "Scripting" was deleted in the first place?
     
  29. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    97
    I tried to reimport the whole package on a previous version and the manager are saved this time but the menu is not shown.

    The bad thing is that each time I did this without any problem in order to save my changes.
    It seems that the content is really too different this time to support an update of an existing scene.
     
  30. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    There has been definitely some major changes but I don't think you'll have to worry about everything from the ground up. I'd advise this: Have a look at the demo scene, update the managers in your existing scene accordingly and continue from there.
     
  31. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    I just submitted patch 1.3.4.1 which fixes some issues that appeared within the last major update, here's the update list:
    • Fixed created new units and buildings in a multiplayer game.
    • Fixed an issue that appears when a faction is defeated in a multiplayer game.
    • The main camera will now have its view initially at the faction's capital when the game starts from a multiplayer/singleplayer game.
    • Fixed issues in the single player and multiplayer menu settings.
    • Moved the RangeDrawer component (property drawer for the Range class) into an Editor folder to avoid build errors.
    Both WebGL and Standalone demos have been also updated.
     
  32. meTonne

    meTonne

    Joined:
    Apr 30, 2016
    Posts:
    70
    Hello !

    You right it was a problem with the border component. My bad.

    Thanks for your answers ! :)
     
    OussamaB likes this.
  33. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Patch 1.3.4.1 has been accepted and is now live on the Asset Store.
     
  34. meTonne

    meTonne

    Joined:
    Apr 30, 2016
    Posts:
    70
    Hi ! Question! ^^

    When I use the building manager with a list of buildings, the AI is build correctly.
    But when I met buildings in the faction type in "specific building" and delete them that building manager (because I've 2 differents faction with 2 specifics buildings faction type), I got an error message :

    Build Around object or Building Center hasn't been specified in the Building Placement Request!
    UnityEngine.Debug:LogError(Object)
    RTSEngine.NPCBuildingPlacer:OnBuildingPlacementRequest(Building, GameObject, Building, Single) (at Assets/RTS Engine/AI/Scripts/NPCBuildingPlacer.cs:46)
    RTSEngine.NPCBuildingCreator:OnCreateBuildingRequest(NPCBuildingRegulator, Boolean, Building, Boolean) (at Assets/RTS Engine/AI/Scripts/NPCBuildingCreator.cs:324)
    RTSEngine.NPCBuildingCreator:Update() (at Assets/RTS Engine/AI/Scripts/NPCBuildingCreator.cs:220)

    And when AI build building :
    NullReferenceException: Object reference not set to an instance of an object
    RTSEngine.Building.CheckBuildingPos () (at Assets/RTS Engine/Buildings/Scripts/Building.cs:499)
    RTSEngine.NPCBuildingPlacer.Update () (at Assets/RTS Engine/AI/Scripts/NPCBuildingPlacer.cs:124)

    All regulator are correct, border are correct too.
    I don't understand where I've failed. When building are in building manager all be good but when they are in faction type building specific didn't work ...

    I tested with buildings in building manager and specific building but I've buildings in double... :/
     
  35. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Did you refresh the regulators in the NPC Manager after creating then new buildings?
    Also, what do you mean by "when buildings are in building manager, all is good"? Because NPC factions aren't supposed to use the buildings list from the Building Placement component as that's only for the local player.
     
  36. meTonne

    meTonne

    Joined:
    Apr 30, 2016
    Posts:
    70
    Hi, With a bad manipulation of Unity I've lost my projet ... So I need to make it again. My post isn't actualy now. Thanks for your answers.
     
  37. generalhak

    generalhak

    Joined:
    Apr 20, 2014
    Posts:
    28
    hi,
    is still units overlap when moving in this asset ?
    also , can you make some video tutorial on how to start and use this asset ?(it seem we can use something like that based on how many questions this topic have !)
     
  38. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    97
    You can easily correct this effect by changing the radius which is defined for each unit in the nav component of each unit.

    This works well. The only limit is when you have long units which not really fit a circle. You get too many space during the movvement between each unit to avoid collision.
     
    OussamaB and generalhak like this.
  39. Seling

    Seling

    Joined:
    Apr 26, 2018
    Posts:
    97
    When will you release the version 1.3.5 with the upgrade management component for NPC ? :)
     
  40. generalhak

    generalhak

    Joined:
    Apr 20, 2014
    Posts:
    28
    thanks but i ask this thing before and developer promise to change the behavior so that's why i'm asking again.
    but from what you just say, i can see they change the units movement behavior
    so now in multiplayer if you set a radius for units the act as a physic object ?
    how the multiplayer working ? how about 10,000 units ? its stream of object position or its a deterministic movement ?
     
  41. Caruzo

    Caruzo

    Joined:
    Oct 13, 2014
    Posts:
    5
    Hey,

    I have been keeping an eye on your asset for quite some time now and the time to ask a few question has come.

    I have a game prototype, which currently utilizes the following things:

    - Choosing a faction (race) once the game has started. Every player has 10 seconds to choose a race. Once both players (as it is 1v1 game) chose their factions, then the game officially starts.
    - Buildings can be built only when the builder NPC is next to the building
    - Upon building completion, it automatically start spawning one unit after another after fixed interval.
    - Each unit follows a waypath, until it detects an enemy in a fixed radius, when it goes to attack it and goes back to follow its waypath after no enemies are in range.


    I was wondering if these things can be replicated with your framework. My game is multiplayer game and synchronization of smooth NPC movement and buildings states and etc. must be done (which I found out to be a hard part).

    Also, can your framework be incorporated into Photon Network rather than UNet?

    Thank you for taking your time to read and perhaps answer this.
     
  42. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Unfortunately yes, Unity Nav Mesh have a very bad crowd control and local avoidance system and the only way to ensure that no units get stuck is that they overlap sometimes. A* pathfinding pro will be supported soon so that will be an alternative for a better pathfinding system for the asset.

    Yes, video tutorials are scheduled for early 2019 where the asset will be in a stable state.
     
  43. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    It's scheduled to be submitted in 5-6 days. A new upgrade system for units and buildings and of course the NPC Upgrade Manager component to handle that the upgrading process for NPC factions.
     
  44. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Can be easily implemented in the multiplayer menu.

    Can you elaborate? Builders are already required to head to buildings and construct them.

    You can have a custom script that triggers unit creation for this one.

    Hmm, this sounds like a tower defense game, no?

    If units are supposed to follow pre-defined paths then this makes it easier for the whole multiplayer part. Building states, unit states and basically anything that needs to be shared among players in a multiplayer game is handled by the RTS Engine.

    Yes, would require you to hook up Photon but since all the multiplayer code is separated from the main asset's code, this shouldn't be that hard.
     
  45. mcchief

    mcchief

    Joined:
    Feb 10, 2013
    Posts:
    8
    Hi there,

    I just bought this asset and so far it looks great. Quick question... Is there a way to add a "free look" function to the camera? Specifically a 180 degree straight angle tilt, so that the camera can tilt looking straight up into the sky and straight down looking in the ground. Would it be difficult to add a Tilt function like that into the Camera Movement? This of course, could be turned off and on as needed per someone's project.

    Great work!
     
  46. mcchief

    mcchief

    Joined:
    Feb 10, 2013
    Posts:
    8
    Actually, after playing around a bit this weekend. I think the best thing to do would be to attach the FreeLookCam script, that is included in the Standard Assets package to a button (like middle mouse button as an example), so that when you hold it down, you have the full freelook ability. Would that be hard to implement?

    Thank you.
     
  47. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    I admit that the camera is still very basic and doesn't currently offer what you're looking for in terms of free movement, however, the Camera Movement component is fairly easy to modify. It wouldn't be hard to add or change the camera's existing functionality so what you're describing above is doable. Let me know if you run into any issues and I'll be more than happy to assist.

    And by the way, we will have a better camera movement in the future, just some patience guys.
     
  48. jobo22

    jobo22

    Joined:
    Dec 1, 2016
    Posts:
    83
    Hi, I'm having a problem with the minimap. I want to have a UI border around the minimap, but when I change the screen aspect ratio it doesn't stay inside the border. I have tried making it a child of the border, giving it a rect transform, and some other stuff but none of it has worked. If I display the minimap with a render texture and raw image, I can get it to stay inside the border because its a UI object, but clicking on the minimap to move the main camera doesn't work properly like that. I looked at your camera movement script and tried calling the minimap functions in one of my own scripts where I was detecting a click on the raw image, but I can't get that to work either. Is there some way you can make the minimap camera part of the UI so that it scales properly with different aspect ratios, and is still clickable? Thanks! :)
     
  49. Kuoin

    Kuoin

    Joined:
    Feb 3, 2017
    Posts:
    6
    I've noticed on the demomap if the units are standing in a slope they wont / can't attack. Or is it just me?
    They also spasm out like crazy if standing on the edge going up \
     
  50. Caruzo

    Caruzo

    Joined:
    Oct 13, 2014
    Posts:
    5
    Thank you for your quick response, @OussamaB

    I was wondering how do you achieve perfect synchronization over the network with a navigation system (& pathfinding) such as the built-in Nav Mesh and Pathfinding of Unity as it is not deterministic?