Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    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,423
    According to the line you sent me, it can either be the Building instance or the WorkerManager instance placed on the building that is causing the null reference issue. Since both are clearly there and properly initialized, I am not really sure what the issue is. But this is definitely assuming that you are using the latest version of the RTS Engine. If not then let me know which version you are using.
    If you can send the building's prefab via e-mail or private message, I can take a look at it and see what the problem is.
     
  2. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,423
    UPDATE AVAILABLE: v1.5.3

    The Asset Store overlords have finally blessed us with accepting the update, only 23 days after the original submission. The whole asset upload process seemed to be broken for a lot of publishers but hopefully this sort of issues will be easily avoidable in the future.

    You can go through the changelogs here: http://soumidelrio.com/assets/rts-engine/changelog/
    And please make sure you go through the update helper guide before updating your project to the new version: http://soumidelrio.com/docs/unity-rts-engine/update-helper/v1-5-3/
     
  3. cidiego

    cidiego

    Joined:
    Oct 27, 2017
    Posts:
    17
    Hello guys,
    Sorry I am very new. But I have a simple question.
    As I begin the tutortial on your Documentation page, I got stuck at the first step :(

    Your tutorial says: Creating a new map using the RTS Engine menu will spawn a pre-made terrain where you can paint textures on it, raise it or lower it and customize it to fit the RTS game you’re creating.

    When I configured a new map, I can't paint the terrain. I try to add a component Miscelaneous> Terrain. But the painting options are grayed out. It says Terrain Asset Missing.

    I have also tried using other assets like Gaia and other terrain creating assets but they throw a bunch of errors related to FoW.

    Can you please help me? I am using unity 2018.4.18f1

    I wish we had a video tutorial or anything for the first steps.

    Thank you for your time.
     
    Last edited: Mar 28, 2020
  4. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,423
    The new map configuration prefab actually spawns a simple plane instead of a terrain. I was inaccurate in this part of the docs and I am going to change it now.

    However, you can choose any object type including a terrain for your map. Check this page here to learn how to create and edit terrains in Unity: https://docs.unity3d.com/Manual/terrain-UsingTerrains.html

    Make sure to clear the RTSENGINE_FOW from the scripting define symbols in order to get rid of the FoW related compilation errors. The scripting define symbols were mistakenly uploaded in the last update.

    --

    The new update is getting tested by some users of the RTS Engine right now and should be uploaded to the store by tomorrow if everything goes according to plan.
     
    cidiego likes this.
  5. TIMTAN_DRM

    TIMTAN_DRM

    Joined:
    Nov 29, 2017
    Posts:
    3
    Darling, when will mobile one go alive, or do we have any plan? I want to play it on Android....:D
     
  6. cidiego

    cidiego

    Joined:
    Oct 27, 2017
    Posts:
    17
    Hello again. Thanks for helping me.

    Here I come again with another noob question :oops:
    I created a new map with RTS Engline > Configure new map. Then I dropped a villager and a Capital building from your Resources>Prefab. I click play, but in game I can't select any of them. They have applied the option of "Can select" in Unit Selection (script). The prefabs include the SelectionObj. The managers include SelectionManager, as it was created throgh "Configure new map". What am I doing wrong?

    I could really use a tutorial video :(
    Thank you soo much for your time and patience.
     
  7. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,423
    It is still going to take some time quite honestly. The next 3 updates are already planned and none of them include plans to support mobile (for now).

    I'll be sharing my Trello board soon so you can know what to expect in future updates.
     
  8. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,423
    Have you baked the navigation mesh for your new map scene? Check this page for more info: http://soumidelrio.com/docs/unity-rts-engine/maps-terrain/
    I suggest going through the doc pages at least once (especially the manager components).
     
  9. cidiego

    cidiego

    Joined:
    Oct 27, 2017
    Posts:
    17
    I have gone through the doc pages twice. But I can't finde the solution. On the page Selection Manager of the doc, it says to use Ray Layer Mask on ground terrain, unit, building and resource. I have done it. I haven even tried the Everything option but it just won't select.
    I have also baked the navigation mesh.

    I will tell you the few steps I took. This will probably make it simpler.

    New scene > Removed "Main camera" and "Directional light"
    RTS Engline > Configure new map.
    Take a Villager prefab ( Units>Resources>Prefab>Villager) and dropped it on the plane created automatically.
    Baked navigation
    Hit play. Can't select the Villager.

    Sorry again for my ignorance. I wish you could make a video tutorial of making a simple map someday if you find time.
    Thank you for your time.
     
  10. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,423
    Did you just drop the unit prefab into the scene without assigning it to a faction slot? In that case, the unit instance will not initialize and won't be selectable.
     
  11. cidiego

    cidiego

    Joined:
    Oct 27, 2017
    Posts:
    17
    That was the problem. Thank you.
    So I guess every building/unit that will appear in the beginning of the match, has to be under faction slots. That could be interesting to add in the Create New Unit Documentation page.

    In a related matter, when I import the asset "Gaia" ( A terrain generator), RTS Engine throws these errors:

    The type or namespace name 'HideInFogRTS' could not be found (are you missing a using directive or an assembly reference?)

    Assets\RTS Engine\Faction Entity\Scripts\FactionEntity.cs(48,16): error CS0246: The type or namespace name 'FogOfWarUnit' could not be found (are you missing a using directive or an assembly reference?)

    Assets\RTS Engine\Game Managers\Scripts\GameManager.cs(101,16): error CS0246: The type or namespace name 'FogOfWarRTSManager' could not be found (are you missing a using directive or an assembly reference?)

    Assets\RTS Engine\Game Managers\Scripts\GameManager.cs(108,16): error CS0246: The type or namespace name 'NetworkLobbyManager_Mirror' could not be found (are you missing a using directive or an assembly reference?)

    Assets\RTS Engine\Multiplayer\Scripts\InputManager.cs(31,23): error CS0246: The type or namespace name 'NetworkFactionManager_Mirror' could not be found (are you missing a using directive or an assembly reference?)

    Assets\RTS Engine\Game Managers\Scripts\FactionSlot.cs(133,16): error CS0246: The type or namespace name 'NetworkLobbyFaction_Mirror' could not be found (are you missing a using directive or an assembly reference?)

    Assets\RTS Engine\Game Managers\Scripts\FactionSlot.cs(134,16): error CS0246: The type or namespace name 'NetworkFactionManager_Mirror' could not be found (are you missing a using directive or an assembly reference?)

    Assets\RTS Engine\Game Managers\Scripts\FactionSlot.cs(137,38): error CS0246: The type or namespace name 'NetworkLobbyFaction_Mirror' could not be found (are you missing a using directive or an assembly reference?)


    Thus, Gaia could not compile.
    Any suggestions on what I should do?

    Thank you so much for your help and patience Oussamma.
     
    Last edited: Mar 30, 2020
  12. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,423
    It seems like you have the "RTSENGINE_FOW" and "RTSENGINE_MIRROR" scripting define symbols in your player settings. This triggers FoW and Mirror related code to compile and therefore throws these errors.
    Please remove those symbols from your player settings and the errors will be cleared.
     
  13. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,423
    RTS Engine 1.5.4 is now available on the Asset Store.

    This version brings a lot of improvements regarding the unit attack and unit movement. I got rid of some of the old systems (such as the target position collider which just presented more load on the physics calculations in the game) and replaced them with more performant ones. One of the main additions in this version is the Grid Search system which allows components that periodically search for target objects to deal with (attack entities that search for a target in range, resource collectors that periodically search for resources to collect, etc..) to find their targets quicker and more efficiently.

    Here's the main changes list:
    • Fixed a bug that occurs when deselecting a unit group from the selected units.
    • Fixed the MissionManager component to correctly mark a scenario as successful when the “OnSuccess()” is called at any stage of the scenario.
    • Fixed a bug where builders keep constructing a building when it is destroyed.
    • Fixed a bug where free units with a Wander component are blocked after targetting a building.
    • Fixed sampling height to generate a target position starting with the source unit’s height to start computing potential target positions.
    • Fixed a bug where a free unit/building is rewarded resources after eliminating a unit/building that belongs to a factionFixed a bug where a NPC faction attempts to attack its target with an empty list of attack units
    • Added the BuildingPlacementStatusUpdated event which is triggerd from each BuildingPlacer component instance when the placement status of the building is updated.
    • Added option to specify a transform to look at for the unit when it spawns, if none is assigned, the unit will simply look at the opposite direction of its creator building (in case there is one).
    • Added Grid Searching managed by the GridSearchHandler and SearchCell components:
      • A search grid is composed of search cells with a fixed size (that can be chosen from the inspector).
      • Each search grid has a lower left corner and upper right corner coordinates that define areas that are searchable inside the map.
      • Instead of linearly searching through all potential objects until finding the closest one that satisfies certain conditions, the search grid allows to search only areas (or search cells) within the search range.
      • The GridSearchHandler is the component responsible for handling search requests from other components and it is responsible for creating and maintaining SearchCell instances.
      • When selected, the GridSearchHandler component draws gizmos that represent the search cells of the map so you can tweak the parameters and make sure that the whole map is included in the search grid.
    • Deprecated the use of Target Position Colliders. Units do not need to have a separate collider to mark their target positions now. The UnitTargetPositionMarker class is now used by each unit to notify search and movement components about their reserved target position.
    • Deprecated handling movement solely using the Unit Movement component.
    • Deprecated the need for attaching the Nav Mesh Obstacle components on units.
    • Updated the Movement Manager component to not include movement formation settings and instead moved them to the Unit Movement and Unit Attack components so they can be locally defined for each unit type.
    • Updated the UnitAttack, BuildingAttack and NPCAttackManager components to use the same data type for defining attack target engagement conditions
    • Added the option to allow attack entities to search for targets while not in idle state (for example, units can target enemies in range while moving).
    • Addd the option to make the attack object follow its target as long as it hasn’t moved by a certain distance from its initial position when the attack object is activated.
    • Added the EntityComponentTaskUIData asset file (scriptable object) type which allows to define UI related information for entity (unit, resource and building) component tasks. This allows to use the same task UI information for multiple entity types and multiple entity components at the same time.
    • Added the option to pre-create task slots on each task panel category.
    • Added the option to force the task slot index when a task is defined by a Entity Component Task UI Data (which will become the standard for defining task UI related data in future updates). This allows the task to be drawn on the same slot/position in the panel every time.
    • Added the “Auto Place” field for the NPCPopulationManager which enables/disables the abiility of the component to automatically place a population building.
    • Added the MainCamera property to the CameraController to avoid using the static “magical” Camera.main reference.
    • Updated the SelectionBox component to allow to add entities to selection using the multiple selection key.
    Please make sure you go through the update helper guide before updating your project to the new version: http://soumidelrio.com/docs/unity-rts-engine/update-helper/v1-5-4/

    As always, the full changelog can be found at: http://soumidelrio.com/assets/rts-engine/changelog/
     
  14. LordSwaggelore

    LordSwaggelore

    Joined:
    Mar 14, 2019
    Posts:
    5
    Hello OussamaB, are there any news about this? I think this would be a great feature for the RTS Engine :)
    Best regards
     
  15. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,423
    This is still in my todo list but it will unfortunately not be available soon.
    The next three updates are already planned and this feature will not be included in them but will definitely have a high priority afterwards.
     
  16. FunGamer

    FunGamer

    Joined:
    Oct 31, 2014
    Posts:
    8
    This is an excellent asset, really enjoying it.

    I encountered a problem in MultiPlayer with allPlayersReady (in NetworkFactionManager_Mirror.cs) never getting set to true.

    In a brand new project (Unity 2019.3.7f1) with the latest RTS Engine (1.5.4) and latest Mirror Integration package (1.5.3), hosting a multiplayer RTS demo for two players, both players (host and client) join and the the game is started and the DemoMap is displayed on both computers, and the villager can be selected on both computers. However, players cannot move units or construct buildings.

    After some debugging, it seems that allPlayersReady never gets set to true. OnClientGameSceneReady() is called twice, however readyPlayer count is not 2. I noticed there are two NetworkFactionManager_Mirror instances in the scene, one for each faction. A breakpoint at readyPlayers++ (line 175 of NetworkFactionManager_Mirror.cs) shows readyPlayers is incremented from 0 to 1, and from 0 to 1 again, never reaching 2, which means allPlayersReady never becomes true.

    SinglePlayer and Campaign are working well. There seems to be an issue with MultiPlayer though.
     
  17. LordSwaggelore

    LordSwaggelore

    Joined:
    Mar 14, 2019
    Posts:
    5
    Thanks for the reply, sounds good! :)
     
    OussamaB likes this.
  18. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,423
    I haven't updated the Mirror integration package link after the recent update. I have now so can you please get it and see if this issue still exists? It doesn't sound like something I have fixed in the last integration package update but could be related.

    You can get the integration from the same documentation page here: http://soumidelrio.com/docs/unity-rts-engine/multiplayer-mirror/
     
  19. FunGamer

    FunGamer

    Joined:
    Oct 31, 2014
    Posts:
    8
    Multiplayer is working again, thanks for posting the new Mirror Integration Package.

    This is an excellent asset with excellent support.

    Thank you!
     
  20. unity_5jznwCjJAHEaaw

    unity_5jznwCjJAHEaaw

    Joined:
    Jan 3, 2020
    Posts:
    3
    Hello, I have several problems, I can not select my unit, my borders are not visible.
    These are my error code.
    Could you help me, thank you in advance
     

    Attached Files:

  21. spalamas

    spalamas

    Joined:
    Aug 30, 2019
    Posts:
    12
    Hello,

    I'm new to RTS Engine and relatively new to Unity, but I have experience in programming. I instelled the latest RTS Engine in my project and was investigating with the demo game included how campaigns work.

    BUG 1:
    I noticed when playing the campaign that during the first senario (collect resources) , after completing the 3 steps (missions) there was no winning acieved. When executing the demo game inside Unity I noticed that upon comletion of the 3rd mission to collect the metal an exception was thrown and it seemed that the engine tried to load next mission which does not exists, and thus there was no winning situation. I traced the code and found the source of probelm in file MissionManager.cs.

    There you have to change the if statement code at line 99 to this:

    if (currMissionID == scenario.GetMissionCount()-1) //no more mission left?

    the problem is that with 3 missions GetMussionCount will return 3, but currMissionID starts at 0 as first ID (array stuff!) so it has to stop at 2 (missions 0,1,2 ) . Thus no more missions are left when currMissionID equals the number of missions minus 1.

    BUG 2:
    There is also another bug Ι found and managed to solve (I think!): On the demo game on the second senario of the campaign , i increased the time limit so I have much time. I killed 2 orcs but no ork kill was count (couter remained on 0) and the mission failed when time-limit reached.

    I manged to trace the problem and found that it is on the file FactionEntityHealth.cs.

    On line 152 there is a command isDead=ture. You have to remove this. !!!


    If it stays there then it prevents the DestroyFactionEntityLocal to be executed as on the begining (line 209) it has the command:

    if (isDead) //unit already dead?
    return false;


    Thus the event OnFactionEntityDead is never fired up to count the death!
    So remove the isDead=true from line 152. The isDead will become true inside the DestroyFactionEntityLocal later (line 215)!



    Cheers!
     
    Last edited: Apr 7, 2020
  22. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,423
    It seems like you have a missing Border component. Can you please share the exact line where the errors (especially first one) are being triggered from?
     
  23. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,423
    Hello, this has to be one of the best bug reports I've ever received. I really appreciate the time you took to look for the issue and fix it.
    Regarding the first issue, that is exactly the fix as the for second one, removing that line will allow the method to be called multiple times even if the faction entity is already destroyed. I have however fixed it and the fix will be included in the next update.

    Thanks again.
     
  24. spktools_com

    spktools_com

    Joined:
    Mar 28, 2019
    Posts:
    14
    Nullptr exception when I'm trying to access BuildingPlacer? Have you changed anything?


    Code (CSharp):
    1. RTSEngine.Building building = ghostObject.GetComponentInParent(typeof(RTSEngine.Building)) as RTSEngine.Building;
    2.  
    3.             RTSEngine.BuildingPlacer PlacerComp = building?.PlacerComp;
    4.  
    5.             if (!PlacerComp)
    6.             {
    7.                 PlacerComp = building.GetComponent<RTSEngine.BuildingPlacer>();
    8.             }
    9.  
    10. if (PlacerComp.CanPlace && !PlacerComp.inCollision)
    11.             {
    12. //...
    13. }
     
  25. LordSwaggelore

    LordSwaggelore

    Joined:
    Mar 14, 2019
    Posts:
    5
    Are there any assets we should watch out for in the spring sale because they will be supported in the future e.g. the A* pathfinding asset or a loading/saving asset? And will those assets be the optimal solution for the specific problem or are there alternative solutions planned?
     
  26. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,423
    Nothing changed regarding the BuildingPlacer. But I am going ahead to guess that the error is produced at this line:

    Code (CSharp):
    1.  
    2.                 PlacerComp = building.GetComponent<RTSEngine.BuildingPlacer>();
    3. }
    And that "building" is the one that is given you the null pointer exception.
     
  27. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,423
    I am planning to support A* pathfinding project in the future but will be taking an attempt during the next few weeks to make my own deterministic pathfinding solution and if that works out the way I want it (performance and work-time wise), A* pathfinding project might not be supported.
    Nothing planned regarding loading/saving assets but saving and loading will be supported as soon as I am done with the planned updates I have.
     
    LordSwaggelore likes this.
  28. September9

    September9

    Joined:
    Jan 20, 2016
    Posts:
    20
    Hi.
    I tried assigned a muzzle effect to archer arrow for test. It worked great. But direction of the muzzle was not changed to the character looking direction. Maybe it's my fault. Could you check this?
    Thank you.
     
  29. spalamas

    spalamas

    Joined:
    Aug 30, 2019
    Posts:
    12
    Hello!

    I'm using RTS in a project of mine. I have build my own menu scene and at the push of a button I load a scene I built using your DemoScene as a base and making modifications. However I have a problem. When returning from the RTS scene back to my menu scene all the animations on my menu scene have stoped working!. I use some particles for effects on the menu and they dont't work, they seem paused. Also I have an animated object (a book) in my scene and the animation of turing pages does not work. User Interface elements like buttons on Canvas work however. What's wrong? What does the RTS based scene and dissables all animations on my menu screen?

    SOLVED THE PROBLEM. Just leaving this here if anyone else is interested!

    I Googled what coudl cause particle and annimation pause in Unity and found that this can be caused when Time.timescale =0. It seems that your DemoLevel which I used as a base sets timescale to 0. I solved the problem very easily by opening th GameManager script and at the method public void LeaveGame() I returned timescale to 1 before calling the LoadScene (I also used LoadSyncAsync instead of LoadScene but that's not necessary).

    Here is the new if statement:

    Code (CSharp):
    1.  
    2. if (MultiplayerGame == false) {
    3.                 Time.timeScale = 1;
    4.                 SceneManager.LoadSceneAsync(mainMenuScene, LoadSceneMode.Single); //go back to main menu        
    5.             }  else { ...
    6.  
     
    Last edited: Apr 18, 2020
  30. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,423
    I have fixed this by adding an option which will allow you to align the spawn effect of an attack object to look at the target. This addition will be added with the next update.
     
  31. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,423
    Hello, thanks a lot for taking the time and posting a solution to this issue.
     
  32. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,423
    If you are not aware yet, then the RTS Engine is currently at 50% OFF until the end of this month as part of the Asset Store Spring Sale.
     
  33. spalamas

    spalamas

    Joined:
    Aug 30, 2019
    Posts:
    12
    Hello, while playing around with RTS inside Unity Editor ( I created a new type of unit with gun everything went ok) I noticed thatr after playing for some time and creting untis etc from some point and on I'm starting getting exceptions like this (I suppose another faction tries to create a warehouse since I haven't created any while playing):

    Build Around object or Building Center for Warehouse hasn't been specified in the Building Placement Request!
    UnityEngine.Debug:LogError(Object)
    RTSEngine.NPCBuildingPlacer:OnBuildingPlacementRequest(Building, GameObject, Single, Building, Single, Boolean) (at Assets/RTS Engine/AI/Scripts/NPCBuildingPlacer.cs:82)
    RTSEngine.NPCBuildingCreator:OnCreateBuildingRequest(NPCBuildingRegulator, Boolean, Building) (at Assets/RTS Engine/AI/Scripts/NPCBuildingCreator.cs:454)
    RTSEngine.NPCBuildingCreator:OnActiveUpdate() (at Assets/RTS Engine/AI/Scripts/NPCBuildingCreator.cs:344)
    RTSEngine.NPCComponent:Update() (at Assets/RTS Engine/AI/Scripts/NPCComponent.cs:64)

    Also more important , while playing my level inside editor when destroying the capital of a faction Unity Editor freezes and requires killing!
     
    Last edited: Apr 19, 2020
  34. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,423
    Regarding the error, this is logged by NPC factions to state that they are not finding suitable positions to spawn a building around its designated center object (which can be assigned in the NPC Building Regulator Data, doc page here: http://soumidelrio.com/docs/unity-rts-engine/npc-factions/npc-building-regulator-data/).

    This seems like you're running the demo game or using one of the demo AI managers (that is attempting to place the demo Warehouse building) and it is not finding a suitable food resource inside its territory to place the Warehouse building around. This however shouldn't really be an error nor a warning since it is not game breaking but just was a way for me to debug AI behavior in the past, this will be changed in the next update.

    As for the issue regarding destroying a faction capital building, thanks for reporting that. I have reproduced the issue and now working to solve it.
     
  35. Pukins

    Pukins

    Joined:
    Dec 23, 2018
    Posts:
    1
    I sent you an e-mail. but I think you couldn't see it on your mail box.
    maybe because it was sorted into spam.

    so.. I post here the same.




    I am going to use PUN2 instead Mirror

    so.. could you give me some advice or tip about that?
    maybe just which class should I rewrite

    of course photon can easily sync Transform
    but I want use your lockstep sync

    and my game is not exactly RTS, it would be like
    Starcraft 2's tug of war
    or
    Dota Underlords
     
  36. spalamas

    spalamas

    Joined:
    Aug 30, 2019
    Posts:
    12
    That makes perfectly sense. Indeed I have based my level on your demo scene. I used it as a starting point and I'm changing stuff like models, buildings, animations. My changes have restricted the free space around the red enemy faction and I placed the food resource in a tight place so indeed it's a free space problem.

    BTW the longer I work with your asset the more I descover its sophistication! I replaced your demo villagers with more complex characters and annimations and found out your annimation overide system for the colection of various sources. I loved thee way you designed it! A core animation controler and overides around it.

    Keep up the good work! And your support is excelent as always! Wish you all the best!
     
    OussamaB likes this.
  37. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,423
    Hey there, I just answered your e-mail. Sorry for the late reply. Getting a lot of support requests during the sale.
     
  38. spalamas

    spalamas

    Joined:
    Aug 30, 2019
    Posts:
    12
    Hello! Just a minor bug report. I have built a building which is able to attack (like the tall tower) and placed 3 different attack sources in it so it fires from different points. I have set the selection of the attack source to random but I noticed that the building was only using thw first source (number 0 as it is an array). I traced the problem to the file "AttackObjectLauncher.cs" where I found that you have the following code (starting on line 105) :

    Code (CSharp):
    1.  
    2. if (sourceStep >= sources.Length || launchType == LaunchTypes.random) //if we reached the last attack object or the launch type is set to random
    3. {
    4.           sourceStep = 0;
    5.           //end of attack
    6.           source.OnAttackComplete();
    7. }
    8. else //move to next attack object
    9. {
    10.           sourceStepTimer = sources[sourceStep].GetDelay();
    11. }
    The above code in the case launchType == LaunchTypes.random sets sourceStep = 0 which couses the 0 attack source to be used next time too. I modified the code as follows:

    Code (CSharp):
    1.  
    2. if (sourceStep >= sources.Length || launchType == LaunchTypes.random) //if we reached the last attack object or the launch type is set to random
    3. {
    4.    if (launchType == LaunchTypes.random) {
    5.        sourceStep = Random.Range(0, sources.Length);
    6.     } else {
    7.          sourceStep = 0;
    8.     }
    9.     //end of attack
    10.     source.OnAttackComplete();
    11. }
    12. else //move to next attack object
    13. {
    14.      sourceStepTimer = sources[sourceStep].GetDelay();
    15. }
    That seems to solve the problem since in the case of random selection it selects a new random source for sourceStep.

    Wish you the best
     
  39. spalamas

    spalamas

    Joined:
    Aug 30, 2019
    Posts:
    12
    Hello , I have a question. I'm making a game have a battle field. However before starting the battle, depending on some user's choices I want to alter various parameters. For example I have some food sources and I want to dynamicaly set the time for one unit collection. How to you suggest doing this? I noticed there is a speedModifier on GameManager but I want more "focused" control e.g. affect only the food collection time. I also noticed that on your "Resource" class you have the "collectOneUnitDuration " set as private, like it is not intented to be altered on-the-fly. Is there a reason about this? Should I create different versions of my battle scene with different settings and load the apropriate one each time?

    Thanks!
     
  40. nukemben

    nukemben

    Joined:
    Nov 15, 2013
    Posts:
    2
    Hey, does anyone know how the 'General Settings' and 'Faction Slots' headers in inspector are created in the game manager script? I can't see any references in the code to create them.
    upload_2020-5-6_22-28-7.png
     
  41. spalamas

    spalamas

    Joined:
    Aug 30, 2019
    Posts:
    12
    Το Create a GameManager in your scene add an empty gameObject , and then select it and on the inspector drag (under the Transform component) the "GameManager" script from RTSEngine->Game Mangers -> Scripts.
    The above will add the geneal settings and faction slots.

    I sugest if you are new on RTS to start from the demo provided scene and modify it to fit your needs. I found it much easier as it contains all the necessary componets. Then I started customizing everything, the units, the buildings, the factions, the terrain ...
     
  42. nukemben

    nukemben

    Joined:
    Nov 15, 2013
    Posts:
    2
    Hey Spalamas,

    Thanks for your reply. I mean how is the general settings and faction slots drawn? I can't see a reference to it in the script? I'm aware of "[Header("Health Settings")]". But not of the type used here. I've an attached an image below to help clarify.

    upload_2020-5-6_23-31-42.png
     
  43. spalamas

    spalamas

    Joined:
    Aug 30, 2019
    Posts:
    12
    Oh now I see. You meant the labels. OK. In the Folder MenuEditor->Editor there is a GameManagerEditor script that adjusts the appearace.

    Lines 40 and 64 in this file
     
    Last edited: May 6, 2020
    nukemben likes this.
  44. spalamas

    spalamas

    Joined:
    Aug 30, 2019
    Posts:
    12
    Hello, Question: On the demo scene that comes with RTS, I make a new Capital prefab and make this the capital of a computer control faction replacing the old in the GameManger. However during playing , when the faction expands and builds additional capital it used the old prefab. What needs to be changed? I searched everywhere I could think of and can't find a reference to the old capital prefab.

    Never Mind! Found the solution! I just leave it here in case someone is interested. THe problem was the NPCTerritoryManager , there was a referenece to the old Capital Prefab so when the faction needed to expand it used this.
     
    Last edited: May 7, 2020
    OussamaB likes this.
  45. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,423
    Thanks a lot for the detailed bug report and with taking the time to fix it. I really appreciate it. Fix will be available in next update.
     
  46. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,423
    The reason you can not modify that directly is because of the sync issues that may arise when you modify that value in a multiplayer game on one client and not the others or example. Although the actual outcome of the resource collection will not really fall out of sync (because the local player that controls the resource is the time is the player trusted to report on the resource amount change), a lot of other aspects of the simulation (collection animation, audio, drop off movement, etc..) will get out of sync.

    This is something I am thinking about with each update, one of the solutions is to introduce special sync messages that allow to sync the values of this attributes and others but as long as I do not have a general solution yet, creating sync messages for each type of attribute for each type of component does not scale at all. So this is currently a limitation.
     
    spalamas likes this.
  47. spalamas

    spalamas

    Joined:
    Aug 30, 2019
    Posts:
    12
    Hello today I noticed what appears to be a bug. I have a food source in my scene with limited amount and noticed that when it gets empty , the units that were assoociated with it (eg. carrying food back to base) stay still on the point they were when the source empited. Later I can select the unit and move it elsewhere but idealy it should finidh caryying back the food on the base and then stay idle there. I din't notice any exception thrown.
     
  48. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,423
    Hello, this issue is going to be fixed with the next update since the resource collection behavior is being re-written. Thanks a lot for reporting it.
     
    spalamas likes this.
  49. spalamas

    spalamas

    Joined:
    Aug 30, 2019
    Posts:
    12
    Hello, I'm having a problem. A have build a scene with two factions. The one controled by the player and the other NPC. I want the computer to attack only a specific type of building. However I noticed that when I set on the NPCManger the NPCArmyManagers component to attack only this specific building code during attack the computer will attack my capital insted. I have set in th Game Manger the winning condition to "eliminate all" so the capital is not a winning priority. Nothing, it still attacks the capital first. I also tried to set the Capital so it can;t be damanged but then the computer does not attack at all!

    What adjustments can I do so that computer only attacks specific building type ignoring the capital?
     
  50. mpue

    mpue

    Joined:
    May 24, 2015
    Posts:
    15
    Is there any chance to get some usable documentation, containing a step-by-step description. With the current docs I am completely lost.
     
unityunity