Search Unity

Unity RTS Engine

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

  1. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    318
    Has any one figure out a way to make Area of Effect Attacks?
    Id like to make a flamethrower type unit, however I can't come up with a way to make it so one attack hits multiple units at the same time.

    Unfortunately its a feature I need desperately. Any one hacked something like that in at this point?

    Or is this feature already in? and maybe I'm just blind?
     
  2. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Expect this in the next update (will be submitted a in a few days). I'm currently working on it.
     
    Paul-Swanson likes this.
  3. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    New update has been submitted, here's the update list:

    - Added the feature to choose whether to spawn or to hide the border object.
    - Added ability to build outside the borders.
    - Most of the multiplayer code has been re-written in order to make it smoother and keep everything synced between all players.
    - Added area damage for units: damage units and buildings inside a defined range depending on their distance.
    - Added the feature to continue placing buildings while holding a specific key.

    The next update will most probably have some NPC improvements.
     
    A_Akkad and Brucas like this.
  4. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    318
    Ahhh good news! Thanks!
     
  5. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    What kind of unet multi player does this support?
    Is it server side?
    Or is it just client peer networking?
    I'm gonna buy this asset anyways though.
    Just curious.
     
  6. Stagg

    Stagg

    Joined:
    Dec 19, 2013
    Posts:
    2
    Just bought the asset and when I build and run the game the units are all floating. Still learning the structure of the asset, if you could point me in the right direction to fix this that would be amazing.
     
  7. Sir_patrickl

    Sir_patrickl

    Joined:
    Jun 24, 2013
    Posts:
    62
    This asset looks interesting however I have some questions.

    1. Are you using deterministic Lock-Step on the networking side? If not how are you keeping clients in sync and how many players/units can the game support? I've previously built a simple RTS engine but hit a wall when I wanted to add multiplayer using lock-step since Unity and some of the assets I used were not deterministic (i.e. not using fixed point math).

    2. Is this targeted to programmers or designers? I'm a programmer and looking for a good core engine to work with and heavily customize so just wanted to know if this would be suitable for this use-case.

    Thanks
     
  8. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    The networking follows a server side lockstep model.
     
  9. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    That is because they are following the air terrain (which is supposed to work only for air units) and not the ground terrain. You can fix this by temporarily removing the air terrain which is a child object of the main terrain object in the demo scene and re-baking the navmesh and simply wait for the next update to fix it.

    Another solution (the one that will be included in the update) is this:

    1) Go to the "Navigation" menu -> "Areas"
    2) Create a new area, call it "Flyable"
    3) Go to the "Object" sub-menu of the "Navigation" menu
    4) Select the air plane object and activate it
    5) Set its "Navigation Area" to "Flyable"
    6) Bake the new navmesh and de-activate the air plane object.
    7) For ground units, remove "Flyable" from their "Nav Agent" area mask in the inspector and leave it for air units (or have it as the only area mask).
     
  10. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    1. To be completely honest with you lockstep is definitely one of the biggest challenges I faced (and still face) when creating the asset. My goal right now to achieve a lockstep a-like multiplayer model but at its current state it's not 100% done. In the last update I've re-written all the lockstep related code allowing for the multiplayer game to be smoother and allowing for everything to sync a lot better than before. It is currently not deterministic which is why in some rare cases there has been de-sync problems but it is one of my top priorities to make it so (especially for the path finding part).

    2. The asset is actually targeted for both programmers and designers. Being able to change everything from the inspector works good for designers and having a well-documented code + custom delegate events for basically every major event in the game is pretty useful for programmers.
     
  11. CPTEliteWarfare

    CPTEliteWarfare

    Joined:
    Apr 9, 2014
    Posts:
    68
    My coders have totally modified the hell out of this RTS Engine asset , we throw away UNet(Unet cost about $2000 a month just for 500 CCU) and add Photon Network(Cost $95 a month for 500 CCU) to the Asset changed most of the code , Added Teams for 2v2 and 5v5 , we added Fog of war system , Resource Sharing , Grid Placement and much more. So i would say this is 100% Programmer and Network Programmer Friendly :D
     
    A_Akkad and OussamaB like this.
  12. CPTEliteWarfare

    CPTEliteWarfare

    Joined:
    Apr 9, 2014
    Posts:
    68
    I notice that the latest patch is 5.6.1 and up are we needing to upgrade or can i just stay in 5.5.3 and be fine?
     
  13. Jasinka

    Jasinka

    Joined:
    Oct 18, 2016
    Posts:
    50
    Looks really nice asset! Good job.
    It will works on iphone and android? If not, when it will be completed solution?:)

    Regards.
     
  14. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Back up your current project and see if the new version works for 5.5.3. I think it will work without a problem but even if some small issues pop up, we can fix. I would recommend you to upgrade to 5.6.1 though to avoid any hidden issues.
     
  15. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648

    Umm 500 ccu with UNET is like $150 a month. Where did you get the $2,000 from?
     
  16. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Currently the asset is not targeted for mobile platforms. No certain plans to support mobile as well.
     
  17. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Oh forgot to mention this but v1.1.4 is up on the asset store and the asset is right now on sale. It is part of the "Back To School" bundle.

    THE ASSET IS ON SALE - SAVE 40%
     
  18. CPTEliteWarfare

    CPTEliteWarfare

    Joined:
    Apr 9, 2014
    Posts:
    68
    Price from the Unet Multiplayer Service , i know it probably wasnt like $2,000 , just over doing it because it over priced , It was like around $200* Estimate , But still any current Network Solution for Unity is crap better off making your own which i plan to do later on during the Project life.
     
  19. CPTEliteWarfare

    CPTEliteWarfare

    Joined:
    Apr 9, 2014
    Posts:
    68
    I will let you know if any issue happen with 5.5.3 if we see any or lots of issues we will upgrade , i just didnt want learn Unitys new Nav System.
    Ill let you know in a few days once we re-add our code and re-code somethings.
     
  20. Legend458

    Legend458

    Joined:
    Mar 13, 2016
    Posts:
    190
    How easy is it to create new units? Also when does the sale end?
     
  21. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    318
    If you mean like basic tanks and infantry?
    Super easy. Its pretty much just add the scripts you need.
    Once you get the hang of it, you can make a Unit in like 4 minutes presuming you've already imported all the things you need.

    Iv made about 30 units total. And while there are some nuiances, its nothing difficult.
    It harder to make a new map than a new unit :)
     
    OussamaB likes this.
  22. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Make sure you fully read the unit creation part of the documentation at least once so that you make sure you won't miss anything (Link: http://soumidelrio.com/docs/unity-rts-engine/units/ ).

    Just create one unit and you'll get the hang of it. Just like @Paul-Swanson said, it's just a matter of adding a bunch of components then modifying the values of the attributes from the inspector.
     
    Yasunokun likes this.
  23. Legend458

    Legend458

    Joined:
    Mar 13, 2016
    Posts:
    190
    Ok, thanks for all the information! I'll probably get the kit!
     
  24. JOJOMCGEE

    JOJOMCGEE

    Joined:
    Aug 25, 2017
    Posts:
    4
    Is it possible to have a menu based building system. As in you don't need a worker to place a building, you just place it from the menu. Like Command and Conquer
     
  25. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    Reading the docs, a few questions popped up in my mind:
    1. To create a new map/scene I understand a terrain must be used. Is it possible to use a mesh? Especially not a flat polygon, but a mesh with some terrain shapes. A navmesh. I`m not thinking about planets or hangovers, just a top-down terrain to mesh conversion. And of course, the units to follow the terrain/mesh uphill or downhill as needed.
    2. Considering it's a non-mobile oriented, is it possible to use around 500 units for each army? I,m mostly interested in frame rates and performance. I checked the demo on a average AMD laptop and I had the feeling it was a bit laggy. I checked the demo a couple of months ago, and from memory, I don't remember having the same feeling.
    Thanks!
     
  26. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Added to the to-do list! Thanks for the suggestion.
     
    Paul-Swanson likes this.
  27. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    1- Using a mesh should be totally fine but make sure the down/uphills can be navigated by nav mesh agents.
    2- This depends on the details of the unit models. If they are made RTS friendly (not too much details, some details that are supposed to be on the mesh are drawn on the texture instead) then the performance should not be an issue. Same thing goes for buildings.
     
  28. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    RTS Engine v1.1.5 has been submitted. Highlights of this update is the new invisibility ability for units and the age advancement feature!

    - Improved registering input actions for units in multiplayer.
    - Added invisibility component: new ability that allows units to go invisible for a period of time (making enemy units not see them and avoid getting damage).
    - Added the feature to allow (or not) units to attack, heal, convert, collect or build while invisible.
    - Right clicking on a point in the minimap while selecting unit(s) will now move units to that point.
    - Added the ages feature: all buildings get upgraded starting from one upgrade
    - Improved NPC Building Placement performance (code improvement).

    For the next few days, I will be updating the documentation and try to improve it (probably will include a FAQ section as well).

    Also please don't hesitate to rate/review the asset on the store, it is much appreciated!
     
  29. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    Sounds good. One small detail. :) These questions were asked by a non-coder. Are the answers the same? I mean, to use a mesh instead a terrain do I have to do some code changes?
    Thanks for your answers!
     
  30. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    No code changes are required!
     
  31. JOJOMCGEE

    JOJOMCGEE

    Joined:
    Aug 25, 2017
    Posts:
    4
    If I have a project that I'm working on right now, how do I update the project with the new updates without messing up everything. I'm really a coder... so idk
     
  32. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    If you haven't modified the code then you shouldn't worry about it.
    But please make sure that you backup your project before doing any update, just in case.
     
  33. CPTEliteWarfare

    CPTEliteWarfare

    Joined:
    Apr 9, 2014
    Posts:
    68
    best way is just back-up your code / project then just re-add all the code and make sure everything is working fine. here's a great tip and what i normally do - Don't update the Asset unless you really need those improvements / updates for example i really need this new update he put out because of NPC Building Improvements is what i need and also the invisibility
     
    OussamaB likes this.
  34. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    v1.1.5 is now available on the asset store!

    The sale will be ended in two days!
     
  35. A_Akkad

    A_Akkad

    Joined:
    Aug 28, 2017
    Posts:
    45
    Dear OussammaB,

    First of all, I would like to thank you for creating such an epic asset. I am completely new to Unity and coding in general and have a dream of making an RTS. The past couple of weeks I have been learning Unity and C# in an attempt to create said RTS, when I stumbled upon assets in general and discovered the RTS engine. Of course, your asset has saved me years in development.

    1. Anywho, the past couple of days I have been trying to create my first custom unit. I have been using the documentation on your main site to help me. After 3 days of reading and messing around in the engine, I managed to make my unit MOVE when I clicked on the terrain! It might not sound exciting, but it was for me. However, I am having trouble getting my unit spawned into the game at launch. How can I manage that?

    This is what I tried: I went to the Unit Manager and wrote my first code snippet " //*Custom Code; Make the shepherds active at Start
    public GameObject shepherdOne;
    //*Custom Code; Make the shepherds active at Start
    //shepherdOne = GameObject.Find("ParentOfShepherd1");

    shepherdOne = GameObject.FindGameObjectWithTag("Shepherd");
    shepherdOne.SetActive (true);
    Debug.Log ("Shepherd 1 is " + shepherdOne.activeSelf);
    }"

    I thought this would work, but it is not. Please advise!
    2. Another question: When you release updates, how do I go about updating the asset in my game? Will it change the code I added? How does it all work?

    3. Also, the civilian prefab moves correctly, but my custom uni floats around. I have already removed the flying nav mesh. Any solutions to that? The custom unit does not float during game setup, just when I run the game.

    4. Regarding the Free Units list; I knew of its existence, but I thought those are units you cannot control as a player? My current goal to modify the engine and make my RTS starts with building my main unit, which is the Shepherd. What was wrong with my code? Why did it not activate the game object? UnitManager.cs launches at game launch, correct?
     
    Last edited: Sep 15, 2017
  36. A_Akkad

    A_Akkad

    Joined:
    Aug 28, 2017
    Posts:
    45
    Those are some legit AAA visuals. Straight from WC3 too, which is one of my favorite games all time! Did you design them? Are they an asset I can use?
     
  37. Gatto_matto

    Gatto_matto

    Joined:
    Feb 15, 2011
    Posts:
    60
    Hi Oussama.

    I love rts. Your asset is really great.

    Unfortunatly I’m not a programmer. I got some errors and I can’t solve them.

    I want to make a test scene from scratch. I followed the documentation, putting together all the objects and components. I put 2 factions, 2 capitals, and 2 units on the terrain. But I got these errors:

    NullReferenceException: Object reference not set to an instance of an object
    GatherResource.Awake () (at Assets/RTS Engine/Units/Scripts/GatherResource.cs:61)

    ArgumentOutOfRangeException: Argument is out of range.
    Parameter name: index
    System.Collections.Generic.List`1[GameManager+FactionInfo].get_Item (Int32 index) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:633)
    NPCArmy.Awake () (at Assets/RTS Engine/AI/Scripts/NPCArmy.cs:130)

    ArgumentOutOfRangeException: Argument is out of range.
    Parameter name: index
    System.Collections.Generic.List`1[GameManager+FactionInfo].get_Item (Int32 index) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:633)
    NPCResource.Awake () (at Assets/RTS Engine/AI/Scripts/NPCResource.cs:122)

    NullReferenceException: Object reference not set to an instance of an object
    Building.SetTaskTypes () (at Assets/RTS Engine/Buildings/Scripts/Building.cs:805)
    Building.Start () (at Assets/RTS Engine/Buildings/Scripts/Building.cs:441)


    Can you help me?

    Thank you
     
  38. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    I answered this on the e-mail.

    It will actually overwrite the code you did so make sure to back everything up. Here's a great advice from @EliteSniperx16 :

    Your custom unit might not be actually floating but you've probably modified the "Base Offset" and "Height" values in the navigation mesh agent making it float. Can you check both these fields?

    The UnitManager.cs launches at game launch, that's correct.
    The Free Units list is currently only used for activating units at launch in an offline game (because they get activated by the server in an online game). It is not exclusive for units that you can not control but the two lists will separated in the future.
    Your code is not working because probably it has something to do with the way you placed your unit in the hierarchy? Are you sure you set everything correctly there (I mean the parenting thing, etc)?
    I also advise you to stay away from GameObject.Find, FindObjectOfType and everything from that kind because it is not optimal for the performance.
     
  39. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Did you place a unit at game launch? If yes, please add to the "Free Units" list in the UnitManager.cs inspector.

    Make sure that you have the FactionManager.cs component for the factions in the scene (one for each faction).

    Same as above.

    Not 100% sure about this one but it seems like it's related to the FactionManager.cs being missing in the scene.

    Please let me know if the solution above worked or not.
     
  40. Gatto_matto

    Gatto_matto

    Joined:
    Feb 15, 2011
    Posts:
    60
    Thank you very much for your answers: I solved the first three problems.

    At the moment the capital buildings still don't work. I will compare them with the demo scene and I hope I find what's wrong.
     
  41. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Are you sure that the capital buildings have "Placed By Default" enabled?
     
  42. A_Akkad

    A_Akkad

    Joined:
    Aug 28, 2017
    Posts:
    45
    Thanks for the tips regarding the updates! I will document my changes and use the documentation to repaste my code. Seems like a major hassle, though. So, like you said, I will do it selectively.

    1. Regarding my custom unit; I rechecked the base offset and height under nav mesh agent to no avail. I changed them repeatedly and my guy still flies around the map, haha. I did a deeper comparison between him and the normal prefab unit that comes from your asset and couldn't find any differences!

    2. Speaking of my unit, using the free unit feature did not allow him to spawn in at game launch either! It simply removed his faction colors, made him unselectable and I couldn't not move (or fly :p) him anywhere. I want to point out, when I drag a prefab over to the game scene, it spawns in at launch. It is only when I place the Unit.cs script on the gameobject where they get automatically deselected. The code I am using to activate my unit IS running and "active" IS true. I know this because I used debug.log to print both factors. Despite the log stating he is active, he is not!!!! It is driving me crazy. My only idea is that he is being deactivated sometime later in a different script?

    3. I have another huge issue I have been working on for 3 days; I get similar errors to Gatto_matto. I managed to fix some of them, but I still get 6 (down from 14, I am proud of myself :)). Maybe they are related to these other issues?
    NullReferenceException: Object reference not set to an instance of an object
    GatherResource.Awake () (at Assets/RTS Engine/Units/Scripts/GatherResource.cs:61) (I get this twice)

    NullReferenceException: Object reference not set to an instance of an object
    UnitManager.Start () (at Assets/RTS Engine/Units/Scripts/UnitManager.cs:35)

    NullReferenceException: Object reference not set to an instance of an object
    Building.SetTaskTypes () (at Assets/RTS Engine/Buildings/Scripts/Building.cs:830)
    Building.Start () (at Assets/RTS Engine/Buildings/Scripts/Building.cs:439)

    NullReferenceException: Object reference not set to an instance of an object
    GameManager.SetFactionTargets () (at Assets/RTS Engine/Game Managers/Scripts/GameManager.cs:513)
    GameManager.Update () (at Assets/RTS Engine/Game Managers/Scripts/GameManager.cs:449)

    And the following error pops up when I force activate my unit (by launching the game and activating him manually in hierarchy) and tell him to go to the one Food resource I have on the map:
    NullReferenceException: Object reference not set to an instance of an object
    GatherResource.SetTargetResourceLocal (.Resource Target) (at Assets/RTS Engine/Units/Scripts/GatherResource.cs:260)
    GatherResource.SetTargetResource (.Resource Target) (at Assets/RTS Engine/Units/Scripts/GatherResource.cs:221)
    SelectionManager.Update () (at Assets/RTS Engine/Selection/Scripts/SelectionManager.cs:203)

    I want to thank you again for all your support! I greatly appreciate it. I try to fix everything by myself for a long while, but these issues I have given up on. I have a lot of plans for this RTS of mine, so hopefully over time, as I get more familiar with your engine, I will need less and less help.

    Regarding your advice on staying away from GameObject.find, I will look for alternatives! Thanks for the heads up!
     
  43. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    You mentioned in a previous post that you removed the air terrain but did you re-bake the nav mesh after doing that? Please check the following:

    - Re-bake the nav mesh
    - Make sure that the unit you created does not have "Flyable" in its "Area Mask" in the "Nav Mesh Agent" component.

    Regarding activating the unit at launch, when I mentioned that you need to add the unit in the "Free Unit" list, I didn't mean that you had to make the unit "Free" in the Unit.cs inspector, simply add it to the list in the Unit Manager inspector and keep its configuration as they are. When a unit is on that list, that means it will get activated at game launch. Only when the unit is marked as a "Free Unit" in the Unit.cs inspector will it be uncontrollable from the player.

    I know that this is confusing (the name of the list) so I apologize for any inconvenience this may have caused.

    Please change the "Awake" in line 58 to "Start". This is caused because the script is trying to access some attributes in the Game Manager before the manager has finished getting started.

    Not sure about those two, did you modify anything in the Unit Manager and/or Building scripts?

    Make sure that there is a NPC Army component for each faction in the scene.
     
    A_Akkad likes this.
  44. A_Akkad

    A_Akkad

    Joined:
    Aug 28, 2017
    Posts:
    45
    I re-baked several times to make sure. Still no difference. My unit does not have Flyable in the mask layer because I removed the Flyable layer completely from the Navigation Areas. Also, the regular civilian prefab I am using walks around normally. I think the issue lies in my made up unit. However, I used the exact directions provided in the documentation and I juxtaposed both units and did not find any differences in anything that should affect the floating.

    This works handsomely. When I start working on my multiplayer portion of the game, will this method of force activating work again? What is it exactly (what code or script) that stopped my units from spawning in initially at game launch?

    This worked perfectly. In fact, it also fixed some other issues too. I now only have two errors:
    NullReferenceException: Object reference not set to an instance of an object
    Building.SetTaskTypes () (at Assets/RTS Engine/Buildings/Scripts/Building.cs:830)
    Building.Start () (at Assets/RTS Engine/Buildings/Scripts/Building.cs:439)

    and

    NullReferenceException: Object reference not set to an instance of an object
    GameManager.SetFactionTargets () (at Assets/RTS Engine/Game Managers/Scripts/GameManager.cs:513)
    GameManager.Update () (at Assets/RTS Engine/Game Managers/Scripts/GameManager.cs:449)

    However, when I added all the NPC components to my factionmanagers, all the errors were resolved! I did not read that you MUST add NPC components to even player factions. Maybe you can clarify in the documentation :D

    How did you know how each error correlated to a certain issue? I did some research on the errors myself and read the code but was not able to deduce what you deduced. Is it simply experience with your code, or are there other methods you have?

    So far, the only issue I currently have is my floating unit. I think I can simply delete him and modify your prefabs instead of making my own units, right?

    Thank you again.
     
  45. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    It sounds like you might have missed something while creating the unit, we could investigate this further if you want, you can e-mail me the prefab you created (in a unity package) and I will be able to take a look at it and see what's wrong.

    The reason objects get hidden in the single player mode is because they have the "Network Identity" component which forces them to be hidden in case there was no UNET multiplayer game going on. Therefore we need to activate them manually in an offline game. In a multiplayer game they will be activated and spawned as network objects for all clients.

    You are right here. I've made a lot of updates in the past month and the documentation kinda fell behind so I need to take a look at it (just finishing the update I am currently working on first).

    I just see the line the error is coming from and I check which components are mentioned in that line (since the error is: Object reference not set to an instance of an object). Then I know which component has not been correctly set or is missing.

    You definitely can (and I advise you to do so). But send me the prefab of the unit you've created from scratch so that we can know what the issue was and I can advise future users when they fall in the same problem.
     
  46. A_Akkad

    A_Akkad

    Joined:
    Aug 28, 2017
    Posts:
    45
    Where is this code located?

    I just sent you the unit via email in a unity package. I created a second unit yesterday, still floats, although not as high. The solution I found was to jam the mesh into the terrain, which is not optimal.

    Another issue I was running into with the engine is that units have a large inertia/momentum. Units do not typically have inertia in an RTS. I was researching a way to remove it, but could not find a solution that actually worked. What I did instead was create an absurdly high acceleration in the nav mesh agent. Is that a good solution you think, or is there a more conventional way to do it?
    Try as I might I could not find anything in your code that created the inertia. Is it an automatic Unity thing? Is the movement code for the RTS engine in the Unit.cs -> CheckUnitPath? (just to double check that I understand the code somewhat :))
     
  47. Brucas

    Brucas

    Joined:
    Jan 14, 2014
    Posts:
    17
    Just a stab in the dark here... but is it possible that your nav agent is not lined up with your unit's mesh? Seems like there might just be a Y offset that is not zeroed out properly possibly.
     
  48. Brucas

    Brucas

    Joined:
    Jan 14, 2014
    Posts:
    17
    What will come with the new update and when do you expect to submit it?
     
  49. Phesant33

    Phesant33

    Joined:
    Nov 13, 2015
    Posts:
    34
    Hey guys, I have lots of nice buildings but can't place them. I follow the documentation, every time though I get the same problem. The building appears before I have placed it, but then as soon as I click to place it, the builder runs to start building but then the mouse cursor (and building) don't stay put, the builder runs around trying to build following the building wherever the mouse goes. Any help would be much appreciated. The other issue is that for the building state model I can't use both the "default" and "building" layers at the same time, its one or the other.

     
  50. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Check line 608 in the MFactionManager.cs script.

    Okay as I suspected, the floating issue happens because of the nav mesh agent offset. It's hard to notice tho.
    The Unit component has a field called: "Unit Height" and another one called: "Unit Radius". You are supposed not to touch anything in the nav mesh agent because at the beginning of the game, the Unit component will set the agent's offset to the value of the "Unit Height" and the agent's radius to the value of the "Unit Radius". Both of these values will be used in different scripts so it is essential to have them set there as well (you can set the nav mesh agent and then copy the offset and radius to the unit component as well).

    Sorry for the confusion, this deserves some changing or at least more clarification in the documentation.

    This is handled solely by the Nav Mesh Agent (acceleration field).