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:
    319
    Sweet I like new updates lol. I really needed the new Healer and Converter functions. Much Appreciated!
     
    OussamaB likes this.
  2. Cartoon-Mania

    Cartoon-Mania

    Joined:
    Mar 23, 2015
    Posts:
    320
    I want to ask. Is it easy to add actions or add animation to a unit?
     
  3. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    It's currently not so easy to add actions as you would need to do code modification here and there.

    A system that will make this easier is will be available soon but for now you can check @A_Akkad comments and see how he went through adding it.
     
  4. CPTEliteWarfare

    CPTEliteWarfare

    Joined:
    Apr 9, 2014
    Posts:
    68
    Sweet needed mainly the healer function :D
     
  5. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    You can simply then update the Healer.cs only if you don't want the other changes to overwrite what you have in your peoject.
     
    Paul-Swanson likes this.
  6. A_Akkad

    A_Akkad

    Joined:
    Aug 28, 2017
    Posts:
    45
    1. Line 148 in Building.cs; how (and why) are you assigning multiple definitions to your variable?
    Code (CSharp):
    1. public BuildingTasks TaskType = BuildingTasks.CreateUnit & BuildingTasks.Research & BuildingTasks.Destroy; //the type of the task
    2. So I spent the past two days learning about hingejoints, scripting them and making a gate prefab utilizing hingejoints only to realize that if you attach (this is what I narrowed the problem too after troubleshooting, might be wrong) a hingejoint to a building, it won't let you build it!!! Take any building prefab you have in the BuildingManager.cs fields and attach hingejoints and try it. It makes no sense. When you try to build it using a civilian, the game spawns the gate (or whatever building has the hingejoint) at vector 0,0,0 and doesn't let you place it anywhere else.
    Any idea why or any solution?

    3. Is it necessary to have the MvtTargetObj gameobject in your scene?

    This worked!

    Let me get back to you on that tomorrow, I have a headache from problem 2. and need to take a break.
     
  7. A_Akkad

    A_Akkad

    Joined:
    Aug 28, 2017
    Posts:
    45
    I have a nice guide for making custom spells/tasks for units, not for animations.
     
  8. CPTEliteWarfare

    CPTEliteWarfare

    Joined:
    Apr 9, 2014
    Posts:
    68
    Still just updated everything its fine , only took us about 10mins to compare code/changes and just copy and paste the changes hahaha :D
     
  9. CPTEliteWarfare

    CPTEliteWarfare

    Joined:
    Apr 9, 2014
    Posts:
    68
    I would say its easy to add Animations just need know when to call that animation , if you just simply replacing the current Animation States then yes its fairly easy but if your adding your own taste then you would need some knowledge in some C# to call your animation correctly with some code modification.
     
    Cartoon-Mania likes this.
  10. Cartoon-Mania

    Cartoon-Mania

    Joined:
    Mar 23, 2015
    Posts:
    320
    @OussamaB

    Adding easy actions and animations is helpful for many people. When Can I see the feature?
     
  11. A_Akkad

    A_Akkad

    Joined:
    Aug 28, 2017
    Posts:
    45
    Is there a unique method you use to compare code? I am having a hard time doing it manually.
     
  12. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    319
    1 way you can do it is install a free application called Cygwn. It's a Unix emulater. Then map an alias to your project folder and a project with just his new code in it. Then just run a diff command on both both files. It will tell you where the changes start. And you can just copy paste that segment. 15 minute 1 time setup. And from there the compares are super fast. They may use a different method but that's how I personally handle it
     
    OussamaB likes this.
  13. A_Akkad

    A_Akkad

    Joined:
    Aug 28, 2017
    Posts:
    45
    Thank you sir. Will try it next time I want to update my files. Sounds infinitely faster than me going through it manually.
     
  14. A_Akkad

    A_Akkad

    Joined:
    Aug 28, 2017
    Posts:
    45
    1. For some reason the object I was working on was not the prefab. I might have forgotten to hit Apply or something. It works fine. I apologize I took your time on that.

    2. Regarding 2., in my previous reply; I removed the hingejoints from my gate (although my goal is to eventually be able to just use the hingejoint gate) and created a placeholder closedgate and opengate prefab. I programmed my gate task "Open/Close gate" to destroy itself and instantiate the opposite gate (open if closed, and vice versa). The overall code works fine and the "Open/Close gate" task works, but the gate that instantiates has a red Plane (versus the normal green) and is non-selectable. No errors are given. This is an issue because I want the player to be able to select the gate again, and re-close/open it. My guess is that the engine does not recognize the new building either as a building, or as a selectable (faction-wise) building.
     
  15. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    It's only for users who to modify the code so they know which tasks can be used. Other than that it is indeed useless.

    2. You need to make the building that you placed by your own code "Placed By Default" so that it spawns directly.
    something like this:
    Code (csharp):
    1.  GameObject NewBuilding = Instantiate (BuildingPrefab, position, rotation);
    2. NewBuilding.GetComponent<Building>().PlacedByDefault = true;
    3. //also assign the faction ID and other stuff by accessing FactionID and other Building class attributes
    Nope.
     
  16. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Can't really give an exact time right now. One thing I can say for sure is that it's not coming in the next two updates as the to-do list for those two is already planned.
     
  17. A_Akkad

    A_Akkad

    Joined:
    Aug 28, 2017
    Posts:
    45
    So, I have a base game ready for some game testing. I set up a new map and two factions, etc. However, when I host and play a MP game (with two players), the game force spawns in a city for each faction. (civilians cannot build cities, and they are not a part of my game). I also already have custom capital buildings set up in my scene (because the RTS engine demands a capital, I have one built for each faction that is invisible and functionless). So technically there are 2 capital cities for each faction now.

    Another problem is that my civilian refuses to build any of the buildings in the task box. You can select them, move them around (and they become green when the terrain allows you to build them) but when you click mouse0 to actually place the building the builder kinda sits there and does nothing.

    Mind you, it works perfectly fine and as intended in single player, so the issue is only in mp. What are the possible issues/solutions here?
     
  18. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    You probably forgot to configure the Network Map Manager, Network Faction Manager and probably other multiplayer-related components.

    For example you need to register all the spawnable prefabs (units, buildings and attack objects basically) in the Network Map Manager as well as in the MFactionManager objects (where you can assign the capital building that you want to spawn in the multiplayer game and separate units and buildings that can be spawned during the game into two lists). This is done because all objects that are spawned during a multiplayer game must be registered for all clients and these lists allow that to happen.
     
  19. A_Akkad

    A_Akkad

    Joined:
    Aug 28, 2017
    Posts:
    45
    This magical piece of code made everything work! (albeit, after a considerable amount of debugging)
    I will work on that soon and get back to you. My gates/walls still need A LOT of work, so I will have to postpone MP testing.

    Regarding what we talked about "buildings around the civilian (for example, after using shift to place multiple compies) the builder ignores them until told otherwise. Is there an autobuild function that allows the civs to automatically finish buildings after creating multiple copies?
    That behavior for builders is currently not available, planning to add it though. Thanks for the suggestion." Is there a date on when you are planning on releasing this functionality? Or is it TBA :p
     
  20. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    I must say TBA. I can most definetly say it won't be in the next update as that's already planned. But hopefully in the one that comes after it.
     
  21. KAYUMIY

    KAYUMIY

    Joined:
    Nov 12, 2015
    Posts:
    115
    Hello guys. I need your suggestions.

    I am doing research which is "Agent Grouping Recommendation Method".

    I need a project related to RTS games for my experiment.
    I don't have time to start from scratch. So I need full RTS project in order to apply my own idea.

    Do you think this is right asset to buy for my research purpose?

    Thank You All.
     
  22. CPTEliteWarfare

    CPTEliteWarfare

    Joined:
    Apr 9, 2014
    Posts:
    68
    Depends on what you want do. The asset doesn't come with a Fog Of War so you would either got make one or buy one. If you want add a Skill rank system or any type of skilled matchmaking you would also need add that yourself. If you want do 2v2 and so on you would have to add your own team system. You would basically have to add on to the asset unless you like how everything is in the asset then great its prefect for you. because you can easily remove the models and animations that are in place and change them with your own. same goes with UI
     
  23. CPTEliteWarfare

    CPTEliteWarfare

    Joined:
    Apr 9, 2014
    Posts:
    68
    so i notice in multiplayer it stops alot like every 3 seconds it would stop then go stop then go
     
  24. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Does this happen in LAN, in online multiplayer or in both?
     
  25. CPTEliteWarfare

    CPTEliteWarfare

    Joined:
    Apr 9, 2014
    Posts:
    68
    Online Multiplayer
     
  26. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Can't really say we have the best version of the multiplayer system right now but it is definitely improving.

    There will be a huge update coming soon (we'll move directly from v1.1.6 to v1.2.0) which includes an improvement for the multiplayer system (not the final version tho).
    The reason why I'm making a huge update at once is because all the things in the update list are linked together.

    I will share with you the update list soon, so stay tuned.

    P.S: If I answered you late in the last 3-4 days, It's because I've been having exams and needed to focus a bit but now I am back and hopefully you will get replies in 24 hours or less. Thanks for your understanding.
     
    cidiego likes this.
  27. cidiego

    cidiego

    Joined:
    Oct 27, 2017
    Posts:
    17
    I have been trying to solve it for days, but I can't. (I'm still very noob)
    When I command the worker to go up a hill, he just goes through. The terrain collider is updated to height. I guess there is something wrong with the physics of the worker though you have already given him a box collider and Rigidbody.
    Does the current versión of the engine allow for different heights to be on the map?
     
  28. Delta5-1

    Delta5-1

    Joined:
    Apr 21, 2015
    Posts:
    9
    You have to bake the NavMesh in order to have effect on terrain changes. The Unit will behave like on a flat terrain until you bake the changes you made on your terrain.
     
    cidiego and Paul-Swanson like this.
  29. kmayfield

    kmayfield

    Joined:
    Jan 1, 2017
    Posts:
    9
    I am having some difficulty using the Placed By Default option on buildings that I want to appear fully built at the start of the game. The only building that seems to show up is the capital building. All others are turned off / hidden. Single player not multi-player. I have set them all to the correct Faction ID etc. etc. I have made plenty of buildings that work fine if built by a unit so I have a good understanding of how to create the asset, however I feel like in this case i may be missing something. Has anyone else had the same problem or had success with multiple buildings with the Placed by Default option?
     
  30. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    In the "Building Placement" component, there's a list called "Free Buildings", simply add the buildings you want to spawn at the beginning of the game to that list.
     
    kmayfield likes this.
  31. kmayfield

    kmayfield

    Joined:
    Jan 1, 2017
    Posts:
    9
    That did it! thanks.
     
  32. cidiego

    cidiego

    Joined:
    Oct 27, 2017
    Posts:
    17
    Hello guys!
    I'm afraid im stuck again. It is the "Under construction" component this time.
    When I try to command a civilian to build something, the foundation (the concrete base of the future building) gets stuck to the mouse arrow whenever it goes. Also, the building never gets built. Also, it gains physics and I can push civilians with it.

    It consumes the resources and the civilian approaches to build it again and again but the foundation just wont be set.

    I havent touched the building manager or building placement script. However, I have added new buildings (model swapping the ones included). Im checking everything but I've got no idea why this is happening. I cant build anything.
    I guess is related to Under Construction or Plane. Or maybe the raycheck is not working properly. But why? I havent touched anything from the script. Just changed the model of buildings and moved them to another folder.

    the y axis IS inside the min and max height interval. Navmesh is baked.

    Please help me.
     
    Last edited: Nov 2, 2017
  33. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Can you make sure that the buildings prefabs to be placed have "Placed By Default" (in the Building inspector) disabled?
     
  34. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Hey everybody, as promised, here's the current list of the next update, which will be v1.2.0:

    Multiplayer:

    - Improved creating/joining LAN games using the UNET Discovery Component.
    - The multiplayer room now syncs correctly for players who join while already joined player have modified the room settings.
    - Object destruction (unit death, building destruction, etc..) is now handled differently in multiplayer.
    - Switching the unit's attack type, toggling invisibility, interacting with APC units and converting units now successfully syncs in a multiplayer game.
    - Improved the current lockstep model of the multiplayer.
    - Improved the NPC building's upgrade behavior.
    - Improved research tasks in order to sync all unit upgrades on spawn.
    - Improved spawning units, buildings and resources.
    - Added a transition menu from the main multiplayer menu to the LAN room.
    - Added the Network Prefab Manager component which makes easier to to update the spawnable prefabs in a multiplayer.

    Resources:

    - Added the option to show/hide resource amount and/or resource collector's amount in the UI.
    - Added the "Code" field for the Resource component: used to identify resources (two resource objects can share the same "Name" and have a different "Code" when they allow the player to collect the same resource type but have a different model or different settings like max amount, max collectors amount, etc..)
    - Added a new button in the Resource Manager component that creates a list of resources to spawn on the map: All resources in the scene must be children of one empty object, this object is assigned to the "Resource Parent" in the Resource Manager component. When the "Generate Resources" button is clicked, it will create an organised list of all resources that are present in the map and will spawn them correctly in single player and multiplayer games.

    Treasures:

    - Treasures are now considered as resources.
    - Creating a treasure is exactly like creating a resource, expect that the main resource component has a "Treasure.cs" component.
    - Treasures must have their own resource type defined in the Resource Manager.

    - More new features:

    - Added multiple attacks for a single unit.
    - You can now switch between the unit's multiple attacks using the task panel.
    - Added component tasks: Units can be ordered to build, gather resources, attack, heal or convert from the task panel.
    - Mouse texture can be changed to the pending component task.
    - Added an option to make units attack automatically when they are attacked (means they only defend themselves and don't engage first in combat).
    - Improved the unit attack component to make it suitable for melee attacks.
    - Removed interaction size and max building/gather distance for buildings/resources. It is now set automatically.
    - Added automatic behavior for builders, they can now search for buildings that need construction within a certain range and go automatically build them.
    - Added automatic behavior for resource collectors, they can now search for resources within a certain range and go automatically gather them.
    - All buildings, units and resources prefabs must now be inside a folder called: "Resources/Prefabs".
    - Clicking on the minimap camera does not deselect selected units and allows for quick navigation on the map.
    - Improved units rotation when moving.
    - You can now have different UI when playing with different faction types.
    - Added an effect when a unit is converted.
    - Added goto position for portals.
    - Added a couple of new custom events.

    Main bug fixes:

    - Fixed a bug in the attack reload timer for direct attacks.
    - Fixed showing unit's tasks while placing a building.
    - Fixed the bug where healers can heal themselves.
    - Fixed the animator from getting messed up when the invisibility ability is toggeled.
    - Fixed upgrading all buildings when having more than one town center.
    - Fixed following units with the main camera.
    - And a lot more bug fixes...


    Working hard on this one, hope you'll find the new features useful!
    Any suggestions?
     
    Delta5-1 likes this.
  35. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    319
    Wowsers. That is a big update. your fantastic work does go very well appreciated!
    I'm pretty interested in this part:
    Can you clarify?
     
    OussamaB likes this.
  36. CPTEliteWarfare

    CPTEliteWarfare

    Joined:
    Apr 9, 2014
    Posts:
    68
    CAN'T WAIT! Thanks for all the hard work you been doing to improve this Asset/Framework
     
    OussamaB likes this.
  37. cidiego

    cidiego

    Joined:
    Oct 27, 2017
    Posts:
    17
    Placed by default is disabled.
    Do all prefabs have to be located within the main folder "RTS Engine" ? I guess not. Theres something I did wrong. The model to be built gains physics even though is just the proyection of the building yet. I guess the problema is the UnderConstruction, which just wont take place.

    I've realised I cant modify your prefabs to "copy and paste" making my own prefabs. This is what screws it. So I have to create new prefabs on my own and leave the RTS Engine untouched and add my new things in another folder.

    Im soo noob.
     
    Last edited: Nov 6, 2017
  38. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    It basically means that when a unit is moving far away from the target, it won't be looking at the target destination and giving the feel that it's moving sideways. it will simply look at the target object when it reaches a specific distance from the target destination and when there's no obstacles between the unit and the target destination. Another thing that has been added is when you ask the unit to move to a destination where the distance between it and the unit is smaller than the stopping distance assigned for the unit, it will actually simply turn around and look at the destination but won't actually move.
     
  39. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Nope, it does not matter where the prefab is. In the next update it will, but right now don't worry about it.

    Can you a show screenshots of the Building inspector? might have missed some configuration I guess.
     
  40. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    So RTS Engine v1.2.0 will be available really soon. It is currently being tested and if no major problem is found then expect it to be on the asset store by next week.

    Thanks for your patience everyone.
     
    Brucas, dashasalo and jobo22 like this.
  41. JessieK

    JessieK

    Joined:
    Feb 4, 2014
    Posts:
    148
    Hello, I couldn't help but notice "attack move" is still not in the engine? Am I missing something or is the demo out of date? Do you have any idea when it might be in the engine as sadly until it is I won't be buying as its vital for an RTS game to have this.
     
  42. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Hello, what do you mean by "attack move"? That the unit can attack while moving? Because the Engine supports that already.
     
  43. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    v1.2.0 has been submitted, it will be available soon on the asset store.
     
    jobo22, Paul-Swanson and Brucas like this.
  44. cidiego

    cidiego

    Joined:
    Oct 27, 2017
    Posts:
    17
    Hello community!
    I have another noob problem. Could you help me ?
    The engine gives me the error: NullReferenceException: Object reference not set to an instance of an object. IUManager.UpdateUnitTasks ()
    It is a Unit selection component problem I guess.
    When I try to select a group of units. The Green square of selection freezes.
    Could you please helpme ?
    Thank you soo much for your time!
     
    Last edited: Nov 22, 2017
  45. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Hello,

    Make sure that the "Unit Selection" field in the Unit inspector is actually set to the child object that has the "SelectionObj" component in order to avoid this issue.
     
  46. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    So the new version 1.2.0 is now available on the asset store.
    The asset is also on sale, you can get it now for 30% off!

    More updates coming soon.
     
    Paul-Swanson likes this.
  47. Cartoon-Mania

    Cartoon-Mania

    Joined:
    Mar 23, 2015
    Posts:
    320
    Is it easier to add custom actions in version 1.2?
     
  48. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Unfortunately no. I had to concentrate on any other things in the latest update and custom actions was not one of them.
     
  49. jobo22

    jobo22

    Joined:
    Dec 1, 2016
    Posts:
    83
    Hi @OussamaB I just bought this asset a couple days ago and it awesome! But I keep getting this error when I try to place a building I made and it wont place the building.

    NullReferenceException: Object reference not set to an instance of an object
    BuildingPlacement.PlaceBuilding () (at Assets/RTS Engine/Buildings/Scripts/BuildingPlacement.cs:209)
    BuildingPlacement.Update () (at Assets/RTS Engine/Buildings/Scripts/BuildingPlacement.cs:122)

    Also when I'm moving around the building I can push the civilians around because the Nav Mesh isn't being deactivated for some reason. When I use one of the demo buildings it works great, but I don't see any difference in my building and the demo ones. Anyone know what the problem is? Thanks! :)
     
  50. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    319
    I'm like 95% certain its your layers that are the issue. Study the included prefabs layer setup then look at yours. You most likely havn't set them to the same thing