Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

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
    The UnitStopCollecting event is supposed to be called when the unit stops collecting the resource completely and not just when it's dropping it off. I'll be adding events dedicated for dropping off resources (OnDropOffStart, OnDropOffComplete for example).

    Buildings and resources have a component under the name WorkerManager which manages builders and resource collectors, you can access this component from the Building and Resource component from the "WorkerMgr" property. That component should provide you with the current and max amounts of workers.
     
  2. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Have you already defined the resources that the AI can collect in the NPC Resource Collector component of the AI?
     
  3. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Well it seems like you've removed the hills from the map and you haven't re-baked the navigation mesh. I can only suggest that because I see you left the portal building hanging mid air.
     
  4. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    S-Inventory has been deprecated from the asset store, this is not really the thread to ask for it though.
     
  5. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    All the assignments in the inspector on the easy and hard Npc AI prefabs were not assigned.
    What caused those to go blank? Does it clear when I hit the Refresh Regulators button? Maybe I deleted all the regulators and hit refresh and thats why. Which makes sense.
     
  6. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    Seems to be a massive bug with regulators
    Here is a video showing it.
    Its not saving changes to the prefab correctly.
    Seems to be two states too.
    Clicking on the prefab with out opening the prefab and then double clicking the prefab and opening it.

    Getting a ton of errors now in play mode. Seems all connected to this. Can't really move forward until this first thing is fixed first I think. Then I can go from there.
    Using Unity 2019.1.14

     
  7. spktools_com

    spktools_com

    Joined:
    Mar 28, 2019
    Posts:
    15
    That's correct. Thanks!
     
  8. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Thanks for reporting this. It happened with Unity 2019 due to some changes to how assigning fields and saving them in a custom editor works. I'll be fixing this for the next update as well.
     
  9. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    Thanks man you are awesome. You are pushing your self up to being one of my top 10 favorite developers.
     
  10. spktools_com

    spktools_com

    Joined:
    Mar 28, 2019
    Posts:
    15
    Maybe a stupid question, but how can I move a unit by code? I tried hooking UnitMoveAttempt but it's never triggered. I also tried: RTSEngine.MovementManager.instance.Move(unit, target.transform.position, 0.0f, target.gameObject, RTSEngine.InputMode.movement, false); //move the unit towards the target unit
    but nothing happens. Is there a MoveTo(); function or similar?
     
  11. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    I haven't tried to do this yet. Isn't there a component called movement or something like that on every unit?
     
  12. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    You should be using the Move() method from the Movement Manager yes. However this looks like you're using an older version of the RTS Engine, I suggest upgrading to the latest one. If nothing happens, then the movement was invalid.
     
  13. pouya_omidi

    pouya_omidi

    Joined:
    Jul 11, 2018
    Posts:
    1
    hi
    i got some problems in this package.In battles between two units the attack animation doesnt play even in demo scene.can anyone just help me???
     
  14. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Have you modified something? The attack animations in the demo scene are working on my end. Any more information you can provide?
     
  15. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    This was my reply to a similar comment you posted about 10 days ago (link: https://forum.unity.com/threads/unity-rts-engine.455283/page-27#post-4999220)


    This user also posted a false review on the asset store which has been removed, but now, decides to re-post the same review again, which has been reported again.
     
  16. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    So I just submitted v1.4.9, this update is all about bug fixes and mainly, a new camera controller. Here's the update list:
    • Fixed an issue that makes a selected unit move when the player cancels placing a building.
    • Fixed stopping the unit movement audio when it is destroyed.
    • Fixed triggering error messages in the Movement Manager component.
    • Fixed an issue where selected entities get deselected when moving the camera with the Minimap.
    • Fixed an issue that occurs when updating NPC faction resources when they get a building center destroyed.
    • Fixed an issue that occurs when a player unexpectedly leaves a multiplayer game.
    • Fixed NPC Manager Editor component for not saving changes.
    • Fixed triggering the take damage animation for units.
    • Fixed hiding the source and target effect objects when a unit is dropping off their collected resources.
    • Fixed sending unit group movement input commands in a multiplayer game.
    • Fixed creating buildings with no given centers in multiplayer games.
    • Fixed an issue with forcing building placement to be in range of resource types.
    • Refactored the MinimapIconManager and MinimapIcon components and made them optional to use: Both now use the EffectObjPool component to pool minimap icon instances.
    • Refactored the AttackWarningManager and AttackWarning components and made them optional to use: Both now use the EffectObjPool component to pool attack warning instances.
    • Added the UnitDropOffStart and UnitDropOffComplete custom events.
    • Updated the attack related components to allow units to attack even if they can't move.
    • Updated Building Placement by adding a field that determines how far the building needs to be from the ground terrain in order to be placed.
    • Deprecated the Camera Movement component and replaced it with a new Camera Controller component (for the main camera) and a Minimap Camera Controller component (for the Minimap):
      • Camera zooming doesn't rely on changing the field of view value but rather the height of the camera.
      • Added camera rotation with keyboard keys, mouse wheel and options to keep a fixed rotation when panning the camera.
      • Added the option to the move the main camera when the player is dragging the mouse on the Minimap.
      • Added new camera entity follow system that can iterate through the list of selected entities.
    • Update the Fog of War asset integration package to make it work with the new camera controllers.
    • Make sure to follow this guide to update: http://soumidelrio.com/docs/unity-rts-engine/update-helper/v1-4-9/
    As always, full changelog can be found at: http://soumidelrio.com/assets/rts-engine/changelog/
     
    Shadowing likes this.
  17. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    @OussamaB did you get to the AI prefab thing I mention last week in this update. Was a Unity 2019 issue? I don't see it in the list. just curious. Maybe you forgot to mention it if not no worries i'll wait for next update.

    Keep up the good work @OussamaB excellent RTS engine.
     
    OussamaB likes this.
  18. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Yes, I re-wrote some parts of the NPC Manager Editor so changes you make to the AI prefabs should be saved with the newest version.
     
    Shadowing likes this.
  19. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    The 1.4.9 update is now available on the asset store, I just did a small re-upload to add another small bug fix to it.
    Make sure to go through the update helper guide: I just did a small re-upload to add another small bug fix to it.
     
  20. Candac59

    Candac59

    Joined:
    Sep 18, 2015
    Posts:
    106
    Hello Oussama,

    I am having a problem with the placement of the buildings. Indeed, I can build buildings on each other. The box collider does not seem to work. I am using Unity 2019.3.0b4

    The box collider component of each building seems to set correctly. Here are 3 screens:

    cordially

    PS: Thank you for your remarkable work!
     

    Attached Files:

  21. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    hey on the placement manager adjust the height offset setting.
    I notice its super picky what that is set too. If its set to anything other than the default then building placement doesn't seem to work. I think default worked can't remember what setting im using.
     
  22. Candac59

    Candac59

    Joined:
    Sep 18, 2015
    Posts:
    106
    I will try like that! Thanks Shadowing!

    Unfortunately, I will not be able to try right away. I just updated RTS Engine (for the reupload due to bugs) but I'm full of error that I do not understand!
     

    Attached Files:

  23. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    Ahh ya. Most of them seem like fow issues. I'm not using fow yet. I haven't updated yet either.
    Probably wait now though since you are getting issues
     
  24. Candac59

    Candac59

    Joined:
    Sep 18, 2015
    Posts:
    106
    me too i don't use FOW ahah
    I wanted to go too fast!

    EDIT: I found the problem. Updating RTS Engine add some line in this filed (project settings / player). Just remove and done !
     

    Attached Files:

    • bug2.png
      bug2.png
      File size:
      319.7 KB
      Views:
      448
    Last edited: Oct 9, 2019
  25. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    I just tested the asset with this version of Unity and it seems like the problem exists there. It doesn't happen on lower versions of Unity though, this is also a beta version so issues like this might be expected. I advise to use 2019.1 or 2019.2 now which are way more stable while I look for the source of this problem.

    I'm sorry for this inconvenience, the first update upload included some scripting define symbols which shouldn't have been there but the asset has been re-uploaded and everything should be fine by now.
     
  26. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    I found the problem, apparently on Unity 2019.3.0b4, having the collider trigger feature enabled dis-allowes it from detecting other colliders. I've update the building placement process by disabling the trigger aspect of the building's collider when it's getting placed and then activating it again once the building is placed.
    This will be part of the next patch which should be submitted this weekend but if you want the fix now, please PM me your invoice number and e-mail.
     
  27. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    I would never use a beta unless there is some feature in it that you absolutely need and can't wait for it.
    Other wise you are going to have a bad time. Cause the amount of bugs that will exist will be a ton. will probably slow you down.
     
  28. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Apparently Mirror's developers updated their package and changed the names of some the components which makes the integration package break. I've updated the integration package to make it work with Mirror v4.0.7, you can find it here: http://soumidelrio.com/docs/unity-rts-engine/multiplayer-mirror/

    Please make sure to have the latest Mirror version before using the new integration package
     
  29. Darrkbeast

    Darrkbeast

    Joined:
    Mar 26, 2013
    Posts:
    125
    Hi, question about the factions, I have a new scene with just one faction and a capital that allows for one type of unit. I have a new unit which I can spawn no problems, and it will go where I tell it to. However when I added a free unit, the zombie one included or one I create I get the two errors below. Now whats weird is if I change my faction to one the default ones everything works fine. My building is set up just like the main capital too. I did create my building from scratch with the building tool, so I will try duplicating default one, however is there anything else I need to know about factions. I read the documents and its the same. Do I need to update any code myself?

    NullReferenceException: Object reference not set to an instance of an object
    RTSEngine.UnitAttack.CanEngage () (at Assets/RTS Engine/Attack Behavior/Scripts/UnitAttack.cs:40)
    RTSEngine.AttackEntity.FixedUpdate () (at Assets/RTS Engine/Attack Behavior/Scripts/A

    NullReferenceException: Object reference not set to an instance of an object
    RTSEngine.UnitMovement.FixedUpdate () (at Assets/RTS Engine/Units/Scripts/UnitMovement.cs:151)
     
  30. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    It seems like you haven't added the pre-spawned free units to the Free Units list in the Unit Manager. Only this way will they be able to initialize correctly.
     
  31. Darrkbeast

    Darrkbeast

    Joined:
    Mar 26, 2013
    Posts:
    125
    Thats the weird part, I do have them added and if I use your capital it works, but if I use my building it doesn't. I tried creating my new capital from scratch and by duplicating one of yours, and that wont work either. I will continue to mess around with it, maybe I missed a step.
     
  32. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Correctly initializing free units (that do not belong to any faction) doesn't really require a capital building to be set up correctly. They just need to be added to the free units list in the Unit Manager component's inspector. Maybe you're mixing up free units and pre-spawned faction entities (which include units and buildings that are pre-spawned in the map scene but do belong to factions)?
     
  33. Darrkbeast

    Darrkbeast

    Joined:
    Mar 26, 2013
    Posts:
    125
    I wish I was mixing the two up, however I was using free units, I even grabbed the little ork from the demo scene and even it would not work with my faction. But I have started a new project and I just duplicated the demo scene and I am duplicating the buildings and factions and just updating them. So far that has been working, got my new capital, faction, villager and free agents working.

    Not sure why the one's I created from scratch did not work, maybe I will look at that later. I do think there is massive amounts of info in the documents, but it's really not well suited for new starts (not that it was meant to). It would be cool if there was a dedicated tutorial that walked one through creating what you did in the demo from scratch. I think maybe I just did something out of order or missed something going through the documents. In any case I appreciate the support, if I had to chose the tutorial or live help I would take the live help.

    Thanks again.
     
  34. Candac59

    Candac59

    Joined:
    Sep 18, 2015
    Posts:
    106
    Hi Oussama,

    Thanks for the support ! For now i can wait for official update.


    I take this opportunity to ask another question: I would like to have different models of building when the player builds a house for example. To not have a city with always the same style of building but rather variants chosen randomly from a predefined list. This is it possible easily? Same question for units.

    I would have also wished to be able to use the rotation of the camera under all the axes. cordially
     
  35. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Alright, I advise that you use another version of Unity for now though. That version is still in alpha and a lot can change when it's officially released since this collider issue can be actually fixed in the official release.

    For units, you can already do this by having different prefabs with different models and then having all of those unit prefabs assigned to the unit creation task.
    As for buildings, there's currently no plug-n-play feature to enable that but you can create a component that manages setting the building's model when it is built since you have access to all of that.

    However, thinking about this now, I think I can make a better and easier system that allows to have different models for units and buildings and only enable one when the unit/building is created. Added to my to-do list.
     
    Candac59 likes this.
  36. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    If you don't mind, you can share the project where the problem occurs and I'll try to find a solution for that. I'm sure it's just a missing configuration.

    I'm planning to add a couple of short video tutorials that showcase how you start using the asset and do the basic stuff (creating factions, maps, resource types, units, buildings, AI and more to create a more basic version of the current demo scene). There's more things I want to add as updates before this happens though (so I don't have to redo the tutorials because of a small change).
     
    Candac59 likes this.
  37. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    I have refunded users in the past but it's because they prove that they just bought the asset (sometimes they didn't even download it) and have valid reasons to ask for a refund. In Cryover's case, he had the asset since July, I spent countless hours supporting him, he wasn't reporting issues correctly (he would just post a screenshot of an error with no context), he was spamming the discord server and insulted other users on discord when they attempted to help him.
    At this point, his only wish is to try to sabotage my sales (which he threatened to do when I refused to refund him, so yeah).

    Thanks a lot for the kind words guys, this is probably the most important thing that keeps me going at this point.
     
    Last edited by a moderator: Oct 16, 2019
    Candac59 likes this.
  38. BrendonV

    BrendonV

    Joined:
    Jun 30, 2019
    Posts:
    1
    Hi Oussama,
    Thank you for a great asset. Got a simple concept demo up and running in no time at all and the documentation on your website was detailed enough for a great understanding of the engine. One thing I am struggling with (probably because of my lack of understanding in unity) is how to position and resize the mini map exactly where i want it on the screen space. Is this possible?

    Thanks again
     
  39. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    The minimap is simply a camera, so you should be modifying the "Viewport Rect" field of the camera component to re-position the camera on the screen.
     
  40. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    I have submitted patch 1.4.9.1 which mainly brings bug fixes to the issues that have been reported recently. Here's the full update list:
    • Fixed an issue in changing the attack source of a faction entity using the MultipleAttackManager component when the source doesn’t have a weapon object assigned.
    • Fixed updating the attack weapon idle rotation.
    • Fixed placing buildings on Unity 2019.3.04b.
    • Updated Mirror asset to v4.0.7 and updated the integration package accordingly.
    • Fixed triggering the death animation for units when they have the “take damage” animation already active.
    • Fixed destroying the target position collider for units when they are converted.
    • Fixed updating the free units list when a free unit is converted.
    • Updated Attack Object component by spawning the trigger effect (if assigned) using its original rotation.
    • Fixed issue where units that can not move do not reset their attack target even when it gets out of range.
    • Fixed issue that disallows entities with an Attack component to launch their attacks when they do not require a target.
    • Fixed initializing units and buildings with multiple attack components.
    • Added “Attack Duration” field for UnitAttack and BuildingAttack components which determines the time where the unit is blocked (can not move) when it’s launching its attack.
    • Added the option to have a different animator override controller for each unit attack type.
    • Added option to use field of view of main camera when zooming in/out.
    • Added inversion option for the mouse scroll wheel main camera zooming.
    • Added the option to have a different drop off object and drop off animator override controller per resource type for resource collector units.
    As always, full changelog can be found at: http://soumidelrio.com/assets/rts-engine/changelog/
     
    Candac59 likes this.
  41. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    By the way, v1.4.9.1 is now available on the asset store. Another patch/update will follow soon with more bug fixes and performance improvements!
     
  42. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Just submitted a new update, v1.5.0 is all about bug fixes, giving more options for the unit movement (including an option to enable the movement using the built-in NavAgent component) and smoothing animation triggering. Here's the main update list:
    • Deprecated the “Attack Duration” field from the Attack component (“General” tab) as the attack duration is now detected using the assigned attack animation.
    • Fixed a bug that triggers tooltips for inactive tasks on the task panel.
    • Fixed a bug that interrupts triggering the death animation of a unit.
    • Fixed a bug that occurs when a unit is moving to enter an APC while the APC is changing its position, the unit now detects the APC position change and recalculates its path until it reaches the APC.
    • Fixed an issue with creating units that should not affect their faction’s population but still decrease the population slots when they are destroyed.
    • Fixed sending units to their target position when they spawn.
    • Added “Force Ground Position” field to the APC component which forces the APC’s interaction position to be on a ground level always, which is useful if the APC is supposed to be an air unit and it can store ground units.
    • Added the option to enable unit movement using the Unity built-in NavAgent component instead of the RTS Engine UnitMovement component.
    • Added the “Min Corner Distance” field to the Unit Movement component: allows to define the minimum distance between two consecutive corners of the movement path. This avoids having two consecutive corners that are too close to each other which is generated quite often by the Unity built-in navigation solution.
    • Added “APC Slots” field in the Unit component which defines how many slots of the APC’s capacity a unit will occupy when it enters the APC.
    • Updated NPC regulator assets to be creatable from the project tab.
    • Updated the Attack component to consider both enemy units and buildings when automatically searching for a target.
    • Updated the unit movement by only allowing the unit to move when it’s in its movement animator state and updated the animator by smoothing transitions between animator states.
    As always, full changelog can be found at: http://soumidelrio.com/assets/rts-engine/changelog/
     
  43. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    By the way, v1.5.0 is now available on the asset store. I just submitted it again to include additional small fixes, should be live on the store by tomorrow.
     
  44. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    I am bit confused after reading the reviews. Some reviewers say this is a complete game, others say it is just a kit. Could you clarify this? By the way, I already own this asset, but I am only beginning to study it.
     
  45. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    I built the RTS Engine to allow users to import their models for units, buildings, resource, etc so that they can add components to those models and build an RTS game with them. For example, you might have a model of a unit. To make the RTS Engine recognize it's a unit, you add the "Unit" component to it. To make it movable, you add the "UnitMovement" component to it, to make it able to collect resources, you add the "ResourceCollector" component to it and etc..

    This is basically the workflow that the RTS Engine offers you. And within each component, you have different options to customize each behavior a component is responsible for through modifying fields in the inspector. If you want to customize it even further, the asset offers various delegate events that are triggered whenever an action occurs in the game (a unit is created, a unit is dead, a building finished construction, a resource is empty, etc..) and which provide the entities that participated in that action as parameters.

    I recommend you go through the whole documentation (http://soumidelrio.com/docs/unity-rts-engine/) at least once so you know what components and features are there that you can use. A lot of new users also start with modifying the demo game that comes with the asset to get familiar with how everything works. Let me know if you need any assistance.
     
    wood333 likes this.
  46. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,227
    I haven't used this in a while since I have another project I'm working on currently, but does this support changing factions from an NPC one to a player controlled one? I think that was my issue when I last used it ages ago.
     
  47. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    If you mean switching to a NPC faction while the game is running then this is unfortunately not possible. However I added it to my to-do list as this seems like a fun feature to play with.
    If I misunderstood your question, please let me know.
     
  48. CPTANT

    CPTANT

    Joined:
    Mar 31, 2016
    Posts:
    80
    Perhaps a stupid question but why do units placed on the map have to be added manually to the default faction entities list? Since the units already contain faction information why not just let them subscribe themselves to the list?
     
  49. islesofurth

    islesofurth

    Joined:
    Oct 10, 2018
    Posts:
    6
    Hi,
    Just purchased the asset & been reading thru it & I can see this asset has a lot of potential.
    There are a few features i would like to request if they are not already on your to-do list.

    1) Regarding the "Units_HealerComponent" If there was something like a custom text component here that could be linked to custom made health bars etc, then users could easily create healers for shields, mana & other custom systems.


    2) The "NPC Attack Manager" is very basic & it cheats.

    > There is no option to require the NPC to have seen any other faction (fog of war).

    > There is also no options for acquiring random targets or the strongest target. (depending on the RTS, it makes more sense to target the strongest player than the weakest player)

    > I also assume that faction power is determined by population, however this is not mentioned.
    If possible, a more versatile approach is to make it a resource so it can be attached to buildings, items, objects, etc.


    3) I noticed that there isn't really anything for custom effects. (at least the in-game side of them)
    I expected there to be a section like the "Effect Objects" section but for the in-game effect not the visual.
    Is this section planned to be expanded on in a big way in the future, or are you able to add an section for the in-game side of the effects.
     
  50. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    There's a couple of reasons actually.

    - It helps you to keep track of the units and the buildings that you have by default in the demo.
    - It allows me to completely control the order for which different components are initialized.
    - It's also computationally cheaper to have the references for the default buildings and units when the game starts than to make each unit look for its faction slot or faction manager instance and then be initialized, which was how things worked before.

    The "Faction ID" field in the Unit or a Building component might be hidden from the inspector in a future update.