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

RTS Toolkit

Discussion in 'Assets and Asset Store' started by chanfort, Jun 6, 2014.

?

Which phase of RTS Battle Simulator need improvements?

  1. search

    39.4%
  2. approach

    30.3%
  3. attack

    57.6%
  4. self-heal

    21.2%
  5. death

    12.1%
  6. rot (sink)

    18.2%
Multiple votes are allowed.
  1. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    629
    It's a tech tree! You need firstly to build laboratory and then 5 farms. After that you unlock factory. After building factory you unlock stables. After building stables you unlock mill. There are also tech tree locks placed on arsonist and knight units. They unlocks when you spawn around 50 archers or swordsman accordingly.
     
  2. iceberg

    iceberg

    Joined:
    Oct 27, 2012
    Posts:
    5
    Does uRTS use lockstep for multiplayer?
     
  3. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    629
    No, it's just basic client-server sync queries.
     
  4. Ragnorum

    Ragnorum

    Joined:
    Aug 12, 2017
    Posts:
    22
    Yes it is a techtree, but where/how do you set up the UI-elements for the castle?
    And where/how do you set up the conditions for example the stable-element?

    Also being able to build many units at once doesnt seem to work.
     
  5. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    629
    So the tech tree is currently defined in Scores.cs which is attached to uRTS/RTS/Scores game object in the main scene. Basically it's an array of lockers and locking conditions, depending on when nation builds/spawns necessary number of other units. So for example stables are the second element in this array with its RtsUnitId=7. The conditions says that player needs to have a laboratory (RtsUnitId=4) and factory (RtsUnitId=6) built before stables is unlocked.

    Umm, what do you mean? Do you mean that you are unable to spawn like 5 archers from barracks in a single go? When you choose archer and press one time, a number of units to spawn appears in the left hand side of the screen. Then you can scroll the mouse to change that number before clicking 2nd time to begin spawning. Do I miss something here?
     
  6. Ragnorum

    Ragnorum

    Joined:
    Aug 12, 2017
    Posts:
    22
    Thank you, i'll have a look at it.

    No you are absolutly right, it works. I had just misinterpreted the controls...
     
  7. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    629
    Hmm, I probably need to explain better these controls as it's not the first time players do not find how to change the number of units to spawn...

    Let me know if there would be any issues with tech tree.
     
  8. Ne0mega

    Ne0mega

    Joined:
    Feb 18, 2018
    Posts:
    341
    What is "Pars" It is throughout your code, and many scripts are named like "UnitPars". What is Pars short for?

    Also I am looking for where I can call all units that have been selected.
    I found "AreAllSelectedUnitsWorkers" and "SelectedUnitCount", and MoveUnit(Vector3 dest) in UnitPars.cs. But the script I wrote for another project (game time formation drawing), also need to iterate through the list of currently selected units, and assign each unit a new destination.
     
  9. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    629
    "Pars" stands for "Parameters".

    You can use SelectionManager.active.selectedGoPars to iterate over all selected units.
     
  10. Norman_Reedus

    Norman_Reedus

    Joined:
    Oct 18, 2017
    Posts:
    3
    Hello, I tried your asset, there is one problem, when saving / loading, when you load the game, the AI decided to play for me. Thus he spends my resources and builds my buildings) I also noticed that I can attack my own buildings with a hero.
     
  11. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    629
    Hi there, that's interesting. Might be related that nation ids are not correctly restored on units. When you selecting a unit, which is controlled by AI is it marking as your unit or as another nation unit? I am currently working on nation refactoring so might get fixed at some point. Also, can you check if this bug occurs on ToER game, which I have on itch.io ?

    Yes, that's intentional that you can attack your own buildings and other units. I think there should be no restrictions by default on what you can attack. I may add some restrictions as optional in the future to prevent attacking your own units in crowded battles while clicking around. But that should be optional in my opinion.
     
  12. Norman_Reedus

    Norman_Reedus

    Joined:
    Oct 18, 2017
    Posts:
    3
    I would like that I could attack my units through the control + left mouse button, as in normal strategies :) One more thing, the building is on a gold rim, you can put 2 and more if you wish, it looks somewhat awful, if you could fix it as in the Cossacks, only one would get up would be wonderful.

    I also noticed one detail with the construction of units, THIS IS HORRIBLE. Why it was impossible to come up with a normal list snapping-in system so that there were numbers near the icon. Yes, I understand that this is an extra array for each building producing units, and when there are many types of units, the building should know that we ordered an archer from the beginning, then a swordsman, then two more archers.


    Do not take everything negatively. I understand that with such a low asset price, you could not do all this. Because gameplay designs in fact require a separate time to create.
    After all, you need to be able to also cancel units, etc. Put the mines in the Cossacks ... And I still have not figured out where to take the metal.

    Everything that I describe and would be happy to do it myself, but it is too difficult to simply enter and integrate into such a large system. I even found it difficult to UFPS, but over time I figured it out though. And then even more so.


    P.s. This is not a call not to buy or something like that. There is a certain value, optimization is really high.
    P.s.s. Have you tried the applifi impostors? What do you think, maybe this could be a good help in some cases.
     
  13. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    629
    Hmm, not sure if I understand this: what do you mean that the building is on the gold rim and that you can put 2 or more of them? Which buildings you have in mind?

    Multi-queues are still as a plan, perhaps as you say when player clicks on icon, there will be a number and a mixture of different unit types will be possible to queue. In fact it's not very big work if you prefer to change this, you can just change UI and spawner script and you will get the desired queues in a mean time. You can cancel units by pressing cancel button which appears in the menu when you start spawning. Never heard before about Cossacks but checked the pictures in Google, looks like a nice game.

    Amplify Impostors must be a new asset, just googled about it and it looks quite interesting.

    Now... These would be just quick fixes. In a mean time, I am mostly looking for the Unity ECS release out of preview. This will be quite a dramatic change with most of systems needed to be rewritten. So as a result, adding more advanced features in the uRTS at the moment would be not very useful as they would get refactored during the transition to ECS. So, stay tuned and see where it goes through the next year.
     
  14. Ragnorum

    Ragnorum

    Joined:
    Aug 12, 2017
    Posts:
    22
    A quick question.
    You can only build new buildings within the vicinity of other buildings, where do you set that radius?
     
  15. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    629
    Hi there, so this radius is currently hardcoded. For player nation buildings it is set in BuildMark.cs in LateUpdate(). The check goes through smallestDist2 and allows to build only if square distance is below 1600 (or distance below 40). For other nations it's hardcoded in NationAI.cs inside FindPosition() as neighDist < 36. You can change these numbers in scripts for now to increase / decrease distances. But they will get exposed at some point as parameters through inspector.
     
  16. Ragnorum

    Ragnorum

    Joined:
    Aug 12, 2017
    Posts:
    22
    I'm learning programming while doing this, I should just be able to make that radius value into a public variable instead and it should show up in editor right?
     
  17. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    629
    Sounds good, if you learn coding, it will give endless opportunities to customise :) . Yes, that's true, you can just make a public value and it will show in inspector. Just make sure that you do not put [HideInInspector] attribute...
     
  18. therewillbebrad

    therewillbebrad

    Joined:
    Mar 2, 2018
    Posts:
    146
    Did anyone else have compatibility issues with vegetation studio, opsive character controller, and bakery lightmapper? Deleting those three assets got things working so I can play around with this assset. Thanks for making this!
     
  19. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    629
    Hi there, I never tested these ones, so I assume there could be some compatibility issues. If you want to use these assets with uRTS in the future, you may want to dig a bit into scripting to find what's causing problems. Usually these are quite small things, like adding or removing several lines of code somewhere. The hardest bit is that you need to find them and to understand what is causing the problem.

    P.S. Glad it is working, in general it's a good practice to test each asset in empty project before combining them so you will be sure that different assets are not conflicting with each other...
     
  20. therewillbebrad

    therewillbebrad

    Joined:
    Mar 2, 2018
    Posts:
    146
    Yeah it's pretty awesome, I just chased one of your horses in VR. haha I'll poke around over the next few days and figure it out.
     
  21. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    629
    Cool, glad you enjoy it :)
     
  22. Ragnorum

    Ragnorum

    Joined:
    Aug 12, 2017
    Posts:
    22
    Hmm what does Unit Pars Type do in relation to Unit Pars?
     
  23. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    629
    So, UnitParsType is a type which holds shared parameters for all that type of units (i.e. unit name). When unit is created, UnitParsType data is not used on the instance and instead is accessed through rtsUnitId. UnitPars on the other hand has only parameters, which are specific to that unit instance (i.e. current health). This separation between shared and non-shared parameters allows us to save memory and gives some performance benefits.
     
  24. Ragnorum

    Ragnorum

    Joined:
    Aug 12, 2017
    Posts:
    22
    So if I'm adding a public variable to change the radius of where you can build... I should add it to UnitPars?
     
  25. Ragnorum

    Ragnorum

    Joined:
    Aug 12, 2017
    Posts:
    22
    Been trying all day to find a way to be able to set the Radius per building in the editor XD
     
  26. therewillbebrad

    therewillbebrad

    Joined:
    Mar 2, 2018
    Posts:
    146
  27. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    629
    I think radii or building are calculated automatically from mesh bounds or NavMeshObstacle. If you give a try with these, it should work.
     
  28. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    629
    I think you would need to do most of things manually, function by function, variable by variable since uRTS and Core GameKit are quite different. Also you want to pay special attention for optimization, i.e. uRTS does not use colliders, etc. You may also want to implement custom update, i.e. to call things at lower frequencies than the main game update. Also you may want to pick functionality which is not in uRTS but in Core GameKit Killable class.

    I would probably start looking in uRTS in UnitPars.cs, BattleSystem.cs and maybe BattleAI.cs since these are main scripts for combat in uRTS.
     
  29. therewillbebrad

    therewillbebrad

    Joined:
    Mar 2, 2018
    Posts:
    146
    Hmm so the arrows don't use colliders either? Maybe I should just ignore it and do some sort of variable sync for the compatibility needed components.

    So is there no way to use a raycast as a player to damage the enemies? My game revolves around being in the simulated battle and less on the god view of the battle. Pretty blown away you were able to do this without any sort of collider.

    I plan on going through the scripts tomorrow I've mainly been reading the doc and watching the videos the past few days. So many new concepts to learn I love it!
     
  30. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    629
    Nice to hear you exploring it.

    So the small arrows does not use colliders at all. But they still use rigidbodies and natural trajectories (you can check Archery section in docs). The targets are either predetermined at launch or searched neighbour targets via kd-Tree (for area damage). Bigger objects, like catapult stones or ballista missiles have colliders, but they only used that these objects would bounce when colliding with the terrain and produce nice effects of falling objects. So no any damage detection is going through colliders.

    Raycast is also not used in battles. Targets are found as neighbours using kd-Tree and attackers are attacking them. If targets are dead or moving far away, attackers are reset to search for new targets. But the whole search is happening using kd-Tree. This allows to find close targets (for melee) or more distant targets (for archers), while colliders would probably only give targets within collision area. And it also gives a very good performance (thousands of units).
     
  31. therewillbebrad

    therewillbebrad

    Joined:
    Mar 2, 2018
    Posts:
    146
    Hmm so do you have any good way for me as a player to be able to shoot these guys? Thanks for your explanations btw. I need to look more in to the kd-tree.
     
  32. therewillbebrad

    therewillbebrad

    Joined:
    Mar 2, 2018
    Posts:
    146
    Maybe this is kind of explaining what I'm trying to do? Do you have some sort of function built in for detection of enemy after firing a ray?
     
  33. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    629
    So, yes, if you are using not arrows but bullets, they will go in straight lines. You can take a look into selection by click functionality in selection manager and start from there. It is also not using colliders, but rather straight lines.
     
  34. therewillbebrad

    therewillbebrad

    Joined:
    Mar 2, 2018
    Posts:
    146
    Hmmm can't find what you're talking about in the selection manager script. But I'm guessing the targetpars.ApplyDamage() is the funciton I'm looking for. I'm going to run some experiments to see if I can just add this function to my raycast gun and call the applydamage function on whatever it intersects with.
     
  35. therewillbebrad

    therewillbebrad

    Joined:
    Mar 2, 2018
    Posts:
    146
    That didn't seem to work either. Maybe I need to register my playable character as part of the urts system in order to work?
     
  36. therewillbebrad

    therewillbebrad

    Joined:
    Mar 2, 2018
    Posts:
    146
    Setting up the arrows to shoot out of my gun didn't work either, I guess there's still a few gaps in my knowledge of how the damage system works.
     
  37. therewillbebrad

    therewillbebrad

    Joined:
    Mar 2, 2018
    Posts:
    146
    Hmmm so I'm starting to gather that the damage is done before any raycast or bullet prefab is even ejected and it's playing the resulting animaiton based off the results? I might not be able to make this work with my system if that's the case. Etiher way I've learned some interesting things and the 3d Sprites will definitely help me out moving forward.
     
  38. Ragnorum

    Ragnorum

    Joined:
    Aug 12, 2017
    Posts:
    22
    Here was my thinking on the buildRadius.
    Buildmark, checks all units in game, ignoring anything that isnt a building, if the marker for the new building is within 1600 from the closest building you can build.
    My thinking was, change the 1600 into a variable.
    Set a new public variable in UnitPars, it is visible in editor, but I havnt found a way of accessing it from Buildmark.
    In Buildmark UnitParsType is accessed, so I added the variable to UnitParsType, but then it wasnt visible in editor.
     
  39. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    629
    So, I would start putting some Debug.Log() in the SelectionManager code and start checking when you click on one of the units. There are branching functions there since it's doing not just selection but also other checks when you click on a unit.

    Animations are running separately from arrow shooting. And there are offsets in time, which says at what time from the animation start arrow should be launched.
     
  40. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    629
    So there are multiple steps here. Firstly, if you just want to put the radius as a parameter, you don't need UnitPars or UnitParsType. But that will give the same radius for all buildings. If you want to have different radii for each building, you would need UnitParsType. UnitParsType is using custom editor, so you also need to add it in UntParsTypeEditor if you want to see it in inspector. When checking on runtime, you will need to access UnitParsType using UnitPars. You can do that by using UnitPars.unitParsType reference or by using rtsUnitId.
     
  41. BBET

    BBET

    Joined:
    Dec 18, 2012
    Posts:
    39
    Hi,
    I have watched some of your videos, your asset looks very impressing. Before I buy the asset, can you give me some feedback, if it will be helpful for my game idea.
    Is your asset also a good starting point for a more economical strategy game, where you will have many resources that are prerequisite for building another resource in a production unity, that will be again input for a further production unity (so several levels / production trees in a production cycle)?
    Can I reuse units/workers to carry products from/to different productions centers (carry around resources, where needed, production only starts when resources are there)?
    Regarding Terrain, I would like to have easier city constructions (based on 3D or maybe 2D objects) not a big Unity Terrain - is this something I could integrate/configure? I imagine an exiting city with citizens, where is some space left for building.

    It is clear, that my requirements will not work out of the box, but I search for a valid framework/starting point for further extensions and would like to better understand, if your asset would fit. It seams that there are not may strategy frameworks in the asset store. Thanks for your honest feedback.
     
  42. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    629
    Hi there. So I guess it depends. It may work partially. But you may also need to write bits of code to achieve your points.

    It might be partially possible to use resources like you described. So let say you want to consume 100 gold in order to produce 1000 iron. So the system is already in place which handles both gold and iron. But what you would need to write would be how and when you want to do that. Let say you start putting a button on the screen and when you press a button, resources would get converted. In that case you simply implement the button callback which reduces 100 gold and increases 1000 iron in player's resources.

    At the moment I have defined as an example two sources of production centres. So for example workers are carrying gold and iron to the castle and lumber to the sawmill. You can start by looking in these examples. You may get around this one without coding. But if you need to implement more custom logic, i.e. like delays to process resources before they are delivered, you may need to get into some coding.

    Yes, you can change terrain size very easily. Just use GenerateTerrain in the inspector and change size and regenerate. Then you probably want to change to your 3d models and scale them in the way you like.

    If you still didn't bought it, you may want also to check my Tales of Eightrivers game on itch.io. It has most of the functionality what toolkit has, so you can play around and it may help you better to decide.
     
  43. BBET

    BBET

    Joined:
    Dec 18, 2012
    Posts:
    39
    Hi Chanfort,
    Thanks a lot for the detailed feedback. Sounds good, so I will give it a try. I might need some direction, where I need to make adaptions in the code. I hope that it is okay, when I come back, when necessary.
     
  44. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    629
    That's fine. Feel free to ask when / if you get stuck.
     
unityunity