Search Unity

Unity RTS Engine

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

  1. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    It should take a few milliseconds in order to executed a move ordered by a player in the MP game so that everything stays in sync. But it is needed taking more than needed when units are dropping resources. Looking into it.

    The fix will be available in the next update.

    The issue here is that destroying a building or a unit due to health reaching 0 can only be done when the health in the building's/unit's owner screen reaches 0 so that it commends the server to destroy that object. This means that the health does not sync but only the order to attack a building/unit syncs (to make the multiplayer experience smooth). Will attempt to change how commands are sent and are handled by clients in order to better the sync.
     
  2. OussamaB

    OussamaB

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

    - Added selection components for units (just like buildings and resources).
    - Improved navigation mesh movement.
    - Improved getting damage for units.
    - Buildings can now act as APC: Units can hide in buildings.
    - Added the Healer component for units which allows the healer to add health points to wounded units that belong to the same faction.
    - Added custom events for the Healer component.

    For the next couple of days, I will be working to get the documentation up to date and improve it overall.
    The next update will mainly handle improvements regarding the MP side of the asset.

    I am also in the process of improving the demo scene and since I am not the best level designer, it would be really awesome if someone can provide me a better looking terrain to use for the demo scene.
     
  3. Delta5-1

    Delta5-1

    Joined:
    Apr 21, 2015
    Posts:
    9
    I can create a map for you, just tell me what exactly you want (grasslands, forrest or even a desert Map?)

    Sounds like a great Update! But one question: are those Units able to fire from the inside of the buildings? Or is it just for taking shelter?
     
    OussamaB likes this.
  4. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    318
    I think it might actually benefit users in regards to the map selection if you have like 2-3 different maps tbh. I'll make one as well and send over when I have a few minutes. I'll make a map called river bed. This will also give the opportunity to show how to use the min / max height stuff you put in. It will be a 3 tier type map. Lowest being the shallow river that's walk-able and some ledges that rise up to higher places, and a higher 4th tier that is not accessible via foot units. This will show case a lot of the work you put in really well.

    I don't think there's anything inherently wrong with your default demo map. Its good to simply have a flat terrain like that for testing purposes.
     
    OussamaB likes this.
  5. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,138
    So I have a few questions before I take the plunge and buy this, since making my own RTS engine has been proving to be a pain in my backside:
    1. Can I change the faction of a unit during play? For instance, can I have a neutral faction character that turns to the player faction upon the player discovering them?
    2. Can I disable the minimap camera? I plan on implementing a custom map solution.
    3. I'm making a game with a fixed amount of player units. Is it possible for me to change the bounds of the edges for map scrolling so I can implement a quick select on the side of the screen?
    4. Is it possible to have units perform more than one role? For instance, can I give a unit that can place bombs and shoot a gun? Or give a soldier a medkit?
    5. How "aware" is the AI? Is it based on line of sight or a detection radius? Can I replace it with my own AI?
    I know my needs might be a little edge-case, so I figured I'd ask about this first.
     
    Last edited: Jul 29, 2017
  6. Delta5-1

    Delta5-1

    Joined:
    Apr 21, 2015
    Posts:
    9
    I totally agree. I've already retextured the Demo Map and replaced all Props and Ressourcemodels, but the Map itself remains untouched more or less, as it is a perfect Showcase for Pathfinding and showing the capabilities of the RTS Engine.

    A river bed map sounds also great, looking forward to see it. If needed I can create a third map, but I think 2 Maps will do it for now.
     
    Paul-Swanson and OussamaB like this.
  7. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Grassland would be the best choice but anything will actually do. It's really awesome from your part!
     
  8. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Can't thank you enough for taking your own time to do this.
     
  9. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    This is a planned feature. I will be adding the capability to turn neutral or enemy units to units that belong to the player's faction.

    Yes you can disable it.

    I believe this is possible with the current version of the asset, but mind explaining more in case I have miss-understood what you meant?

    A unit in the RTS Engine can build, gather resources, attack or/and heal other units.

    The AI is always the tricky part, it is currently designed in a way that you can create different AI players just by changing a set of values from the inspector which will determine whether the AI likes to gather a lot of resources and be safe or whether it likes to create army units and attack as fast as possible, etc... This allows you to create difficulty levels (just like in the demo). Replacing the AI with your own would be very challenging as a lot of the code will have to be re-written. So unless you're willing to dive deeply in the details of the code (which is commented and should be readable), then I would advise against doing so.
     
  10. Mikaelst

    Mikaelst

    Joined:
    Oct 3, 2014
    Posts:
    2
    Very awesome! Bought it! Speaking of AI. Am I the only one who's thinking that it might be pretty cool if a few personality traits were implemented to units like Rimworld/Prison Architect? Or are you all hardcore Dune/C&C fans that only wants combat? =P Else there's an idea for a spinoff direction/new asset/addon. Don't think there's any sim colony building game engines out there. This might be as close as it gets.
     
  11. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Thanks for purchasing the RTS Engine and thanks for your suggestions. However the main idea (at least for now) is to continue developing the asset in the same direction and keeping the same game play.

    -----------

    The new version of the RTS Engine is now available on the asset store!
     
  12. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    New update coming tomorrow. Multiplayer improvements, new converter component for the units, performance improvement and a new demo map. Huge thanks to @Delta5-1 for supplying the map, textures, resources and buildings. Here's a screenshot:

     
  13. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Just submitted a new update! Turns out that the update before this one hasn't been accepted yet even though it was submitted nine days ago.

    - Fixed unit spawning in multiplayer.
    - Fixed units/buildings health syncing in multiplayer.
    - Fixed auto-search for attack units in multiplayer.
    - Added custom events for APC units/buildings.
    - Added the Converter component which allows units to convert enemy units to their faction.
    - Added new unit in demo scene: Converter, can be produced from the city center and allows to convert enemy units.
    - Improved the NPC attack manager.
     
    Paul-Swanson likes this.
  14. kmayfield

    kmayfield

    Joined:
    Jan 1, 2017
    Posts:
    9
    Question about maps. Anytime a create a new scene and modify the terrain height or textures, that change is propagates to all my other maps (i.e. they all look identical except building placement). I know I must be missing something obvious here. Can anyone help?
     
  15. Delta5-1

    Delta5-1

    Joined:
    Apr 21, 2015
    Posts:
    9

    I had the same problem. Exclude all child objects from the terrain (Directional Light, Flat Terrain, Air Terrain), then deactivate the terrain. Create a new terrain, include all previous components as child objects and you're good to go. I guess there might be an easier solution, but this worked for me.

    Don't forget to assign the new Terrain in all needed Components.
     
  16. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    It is indeed because each Terrain's configurations (texture, height and everything else) are stored in a Terrain Asset (which you can find in the project's window). Therefore you need to create a new Terrain for each map.
     
    Last edited: Aug 8, 2017
    Delta5-1 likes this.
  17. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    THE ASSET IS ON SALE - SAVE 30%
     
    Paul-Swanson and Delta5-1 like this.
  18. kmayfield

    kmayfield

    Joined:
    Jan 1, 2017
    Posts:
    9
    Thank you both so much. That was a big help.
     
  19. simonulloa

    simonulloa

    Joined:
    Jan 25, 2017
    Posts:
    2
    Hi,
    Great Kit but when I went to your website, it said "Account Suspended". Can you please fix this or send me a PDF of the tutorial page.

    Thanks:)
     
  20. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    It is working now. Sorry for the inconvenience.
     
  21. Kobaltic1

    Kobaltic1

    Joined:
    Jan 22, 2015
    Posts:
    183
    I just got this and installed this on Unity 2017. Every character is in the air at 7.18 on the Y axis and I can't move them. No matter what I do they all stay that high.

    EDIT: I tried in Unity 5.5 and it works just fine.
     
    Last edited: Aug 12, 2017
  22. Phesant33

    Phesant33

    Joined:
    Nov 13, 2015
    Posts:
    34
    Hi, just got this, great asset. Just adding in my own custom building, It appears fine when going to build, but at as soon as I left click the civilian goes to build it, but then when I move the mouse cursor he moves too and the building does... the building just tracks the cursor and the civilian follows behind trying to build, but the building never actually gets finished.

    Get this error
    NullReferenceException: Object reference not set to an instance of an object
    BuildingPlacement.PlaceBuilding () (at Assets/RTS Engine/Buildings/Scripts/BuildingPlacement.cs:183)

    Thanks for any help
     
  23. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    318
    Make sure you layers are set correctly on all your building parts. I had the same issue because I missed a few steps setting up my buildings: https://forum.unity3d.com/threads/unity-rts-engine.455283/page-5#post-3150336
    Once I fixed my layers it operated properly. Check out the reply after that as well. Hopefully this helps you out some in fixing your issue. Goodluck!
     
    OussamaB likes this.
  24. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    So this looks like it's Unity-version-related. I will look into and send you the fix ASAP.
     
    Brucas likes this.
  25. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Did the solution proposed by @Paul-Swanson work?
     
  26. AhWhatTheCheese

    AhWhatTheCheese

    Joined:
    Aug 13, 2017
    Posts:
    1
    I would like to know if there is a way to do something without modifying the code...

    Is there a way for a user to add or "build" (placable) a building that generates resources when the player goes to "work" or spends time there? I don't want automatically generating resources, but resources that are generated only when the player chooses to spend time there.
     
  27. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    318
    If I'm understanding what your saying.. Is you want the automatic Resource collection to only happen when a Unit is within a range you define. Such as he is working here so he gets resources. And when he leaves the resources stop being gathered...?

    That's I won't say simple but it's not hard to accomplish. You wont have to edit the RTS engine scripts to make it happen...as far as I'm aware, but you will need to script. So fairly recently he wrote in Unit categories.

    Here's what I'm thinking you can do....no idea how easily you can get this to work but this is my idea for you.
    On your generators you add an extra collider that's only acting as a trigger volume.
    You will need to disable the resource generator script on the building. You can make a script that will turn in turn activate that Resource Generator script when a unit of a certain category enters that colliders range and thusly shut it back off when no unit of that category is present.

    Or alternatively you simply have the generator create 0 by default, and change that value (like say +50) when a Unit enters its area of affect that you defined with the collider. Can also have is stop collecting by setting it back to 0 if no defined unit is present.

    Using this method you increased the generation with the number of Units present at one time.

    If this isn't what you intended/meant please ignore me. :) Good luck
     
  28. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    This feature is planned but I can not say exactly when will it be added but @Paul-Swanson has already suggested a very good solution in the post above.
     
  29. Brucas

    Brucas

    Joined:
    Jan 14, 2014
    Posts:
    17
    I ran into this issue as well using Unity 2017.
     
  30. adiaz004

    adiaz004

    Joined:
    Sep 9, 2016
    Posts:
    3
    Anyone have an issue where civilians will walk to the edge of the map when they try and drop off resources...instead of going back to the drop off building like the center?
     
  31. Brucas

    Brucas

    Joined:
    Jan 14, 2014
    Posts:
    17
    I'm using Unity 2017. It has already been noted that the civilians are spawning on and using the air plane navmesh when they spawn.

    But is anyone else having issues with getting the local multiplayer working using the demo scenes? I built a standalone using the menu scenes and demo map and when I start a local multiplayer game both factions connect, but the client only spawns its own faction center and not the one for the host player. The host spawns both bases. Any unit that is spawned from one or the other is spawned on both client and host and they sync up correctly, its just the starting bases that are not working for me when trying to get the multiplayer working.
     
  32. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    For Unity 2017 users (@Brucas & @Kobaltic1 ). There are currently two known issues:

    - Units spawning at the air plane Navmesh:

    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).

    - The multiplayer issue:

    I was looking into the multiplayer issue for some time now and I strongly believe it is from Unity's end. The same code runs perfectly for other versions but for this one, the network connection takes too long to be ready and therefore it's not allowing to spawn all the capital buildings at the beginning causing all the errors and problems.

    However I found a fix (for now), open the "MFactionManager.cs" script and search for this line:

    Code (csharp):
    1. NetworkServer.SpawnWithClientAuthority (Capital, connectionToClient);
    and then replace with this line:

    Code (csharp):
    1. NetworkServer.Spawn (Capital);
    Turns out giving the authority for an object at the start of the game represents a problem now in Unity 2017. I will contact Unity about this and report it as a bug, if this is the way things are supposed to work from now on in Unity then I will make a permanent fix and post it ASAP.
     
    Kobaltic1, Yasunokun and Brucas like this.
  33. Brucas

    Brucas

    Joined:
    Jan 14, 2014
    Posts:
    17
    Thanks for the fixes :)
     
  34. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    New update has been submitted, PORTALS have been added and APC has been improved!

    - Added Free Buildings: these are buildings that do not belong to any faction.
    - Added the feature to make a building non attackable.
    - Added portals: allow units to travel from one place to another.
    - Added the feature to make APC call for units to get in.
    - Added the feature to allow or cancel ejecting one unit at a time from an APC.
    - Added new custom events for converter units, APC units and portals.
     
    Paul-Swanson, Brucas and Yasunokun like this.
  35. Yasunokun

    Yasunokun

    Joined:
    Feb 20, 2015
    Posts:
    8
    @OussamaB - Hi, Just wanted to say I have really enjoyed the progress of this thread and your asset. After seeing you support it so well, I will be buying it in the next few days. Thank you for all of your hard work!
     
    Paul-Swanson, Brucas and OussamaB like this.
  36. Kobaltic1

    Kobaltic1

    Joined:
    Jan 22, 2015
    Posts:
    183
    I created a new civilian but I don't know how to get the program to use my new character instead of the default one. Could you point me in the right direction?
     
  37. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    318
    On the building that's making them [in this case the capital building] you need to replace the default one under tasks with yours. If you have a level where the capital buildings are already placed you'll need to update the prefabs as well as the ones that are already placed.
    I'll post an Image in a moment. I'm currently importing gunfire sounds, lightning generating code, and Unit Audio right now. So it'll be a little while.

    Here's the PIC:

    You set the task number to the amount of things you want the building to make or upgrade.
    Faction Code: lets you limit who can make it.
    Task Type: Make sure this says Create Unit <- Obviously makes new Units
    Task Icon: Lets you put a nice Icon there to make it stand out
    Required Resources: Where you define the cost. Need to set up your resource list first though.
    Unit Prefab: Is where you actually putting your prefab that you want to be made
    For more information please see his online manual, but I find those are the most impotrant for quick tests. :)

    Also the most recent update is already live :D Dude you totally jumped in front me asking for this stuff.
    I was going to ask for a Rotation Constraint on the Turrets. Bam! It's there. [When did you even add those? o_O...and how did I miss them?]
    Factionless Buildings? BAM it's there!
    Portal type Buildings BAM ITS THERE. You must be reading my mind lol

    Just what I needed too. I'm making city structures that can be blasted apart. Just need to make my lightning cannons now bwahaha
     
    Last edited: Aug 22, 2017
    OussamaB and Kobaltic1 like this.
  38. Kobaltic1

    Kobaltic1

    Joined:
    Jan 22, 2015
    Posts:
    183
    Thanks for the help.
     
  39. CPTEliteWarfare

    CPTEliteWarfare

    Joined:
    Apr 9, 2014
    Posts:
    68

    I keep getting these errors still from the AI's (Thats my teammate AI thats why i can see him from Fog Of War. Also the black circle around the HQ is a Building Radius is turns green when buildings are build-able its still in the works lol)

    NullReferenceException: Object reference not set to an instance of an object
    NPCArmy.Update () (at Assets/Code/RTS Engine/AI/Scripts/NPCArmy.cs:282)
     
  40. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Are you sure that all the units you have in the NPC Army prefabs list have an "Attack.cs" component?
     
  41. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Thanks a lot for taking your time and help people in this thread!
    And I am really glad you found the new update useful for your project.

    ---

    I am currently hunting down issues with the multiplayer side of the asset, so if you have came across one, please let me know.
     
  42. CPTEliteWarfare

    CPTEliteWarfare

    Joined:
    Apr 9, 2014
    Posts:
    68
    Yea they do , i need update the asset so ill let you know if the issue still happens , ill also go testing more on the multiplayer soon once i update the asset so i can report any bugs or issues with multiplayer
     
  43. dude3585

    dude3585

    Joined:
    Aug 13, 2017
    Posts:
    2
    Does this include fog of war? Havnt bought yet but looks very interesting. Im a newbie with Unity been learning. Thanks.
     
  44. Brucas

    Brucas

    Joined:
    Jan 14, 2014
    Posts:
    17
    Paul-Swanson and dude3585 like this.
  45. dude3585

    dude3585

    Joined:
    Aug 13, 2017
    Posts:
    2
    Thanks Ill check it out. $15 not bad at all.
     
  46. Kobaltic1

    Kobaltic1

    Joined:
    Jan 22, 2015
    Posts:
    183
  47. CPTEliteWarfare

    CPTEliteWarfare

    Joined:
    Apr 9, 2014
    Posts:
    68
    It doesn't but like how Brucas said that Fog of War asset he linked is really great , one of my coders was able to make it work for our project plus it supports Multi-threading :p
     
  48. JOJOMCGEE

    JOJOMCGEE

    Joined:
    Aug 25, 2017
    Posts:
    4
    Forgive me if these are well known bugs, but in the current demo, when playing the game, if you try to go to the bottom left corner to move the camera it does not work. This also occurs in bottom right corner as well. The space in between the mini map and bottom left panels works fine so I think it has to do with the previously mentioned mini map and panels.

    Also, I'm not sure if this occurs with other units, but with the demo Air unit, if you spam right click on a target it will rapid fire the projectiles dealing damage as fast as you can right click.

    I'm very close to scrounging the needed funds to get the RTS Engine and just wanted to know if these bugs were a part of an older demo I may have accidentally downloaded or if these bugs were already on the to-do list.

    Thanks In Advanced :)
     
  49. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    That has to do with the camera settings, you can easily change the min and max positions that the camera is allowed to travel to and get it to go all the way to the corners.

    Just tried to re-produce this but I was unsuccessful.

    Thanks for your interest in the asset! I believe the latest downloadable demo is the one that matches the latest version.
    I think it would be for the best to record the bugs in a video and then e-mail it to me if you don't mind. That way I can see the bugs in action.
     
  50. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Thanks to the video, I figured out what you actually meant.

    This is not actually a bug, I intentionally disabled moving the screen on edge when the mouse is over UI elements so that it does not get moved unintentionally when the player is trying to do something with the UI.

    In order to have that disabled, please open the "CemraMovement.cs" script and change the initial value of the bool below to true in line 130, so from:

    Code (csharp):
    1. CanMoveOnEdge = false; //line 130
    to

    Code (csharp):
    1. CanMoveOnEdge = true; //line 130
    Below that line you could see the code below that checks if there is any UI object but that will all be useless since the bool is already initialized in true.