Search Unity

RTS Starter Kit [WIP]

Discussion in 'Works In Progress - Archive' started by N1warhead, Jan 25, 2015.

  1. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    Hey guys, just wanted to make a WIP thread for the RTS Starter Kit I am creating for the Asset Store.

    RTS Starter Kit is a (STARTER) kit for games like Command and Conquer.
    If this has any AI, it will not be very sophisticated, it will be basic AI (IF I decide to put it in here) as this is a STARTER KIT.

    Features -

    Infantry System -
    Select teams (Player, Enemy, Ally, Mutant, Animal)
    Soldier Type (Light, Medium, Heavy)
    Ability Type (Runner, Advanced Armor, Stealth, Assassin, Engineer) (What I have for now)
    Weapon Type (Semi Automatic, Burst Fire, Full Auto, Missile Launcher, Melee, Animal Bite)
    InfantryLogic_easySetUp.jpg
    The above information is just classification data only.
    Makes for quick easy to deal with Units as every unit has the same script.

    Each unit uses Unity Nav Mesh Pathfinding for ease of use.
    So in other words, all terrains must have Nav Mesh Baked.
    RTSKit_Infographic.jpg


    Camera System -

    The Camera system features FOV zooming (To make sure you never bleed into obstructions)
    Camera will rotate 360 degrees left to right, move every direction with WASD. Q and E rotate camera left and right.


    Vehicle System -

    There will be setups for tanks, etc. In this starter kit.
    Just as Infantry, set it up for the options in the menu and done.

    Structure System - To be made. (after Infantry is done)

    The Structure system will be just like Command and Conquer games for the most part.

    (Power Plants, Refinerys (for money), barracks, weapons factories, etc)
    Keep in mind, these buildings will not be real buildings, but simple Geometric shapes.
    To show how they are set up, which need I say again, everything will be 1 one script.
    (Infantry one script, buildings one script, vehicles one script).


    Menu System -

    There will be an entire menu system that C&C Games have E.G. -
    Build buildings, purchase new Units, etc. - This will be a bland Menu so you can put your
    own graphics, Icons, etc. And will also feature a radar at the top like most RTS games.

    Information - Important!

    If you look at the Infantry Logic photo, it shows the ease of use how to set things up.
    Where it says Player for team, you select which team this Unit is on, then just set it up from the other 3 options and your character is set up. The Structure System will work the same exact way, Select which team it belongs too, and set up the few options and it's done.

    When I say (one) script, I don't mean one script running entire game, I mean all units will share the same type of script, so it's not a million different scripts floating everywhere, I'm trying to make this as easy as can be to set up, even setting up new teams, units, etc. Will be very easy to create scripting wise as I will provide bare bones scripts that show how the Setup system works.

    A lot of the hard stuff is done with this, still a few tweaks I have to make to get the systems working properly, but I can not give a release date at this moment in time, it could be done in 2 days, a week, it depends how fast I get through the breakthroughs on here that I'm having trouble with getting around.


    Have any ideas that could make this even better?

    Let me know on here so I can try to implement it!
     
    GarBenjamin and johnsteinberg like this.
  2. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    Anything you guys would like to see me implement into this?

    I'm almost done completely with Unit Selection and movement and stuff.
     
  3. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    RTS Starter Kit now offers the choice between Mecanim and Legacy Animations for your Units in game.
    And also Unit Selection SFX (You know, like you click on the enemy and they make a sound).
    The way this works is, if this script detects an Animator Component, the Legacy Animation slots will be null.
    That way you don't intertwine two different animations.

    But I made it this way so users have a choice in how they decide their Animation workflow.

    Here is how the Infantry setup looks (as of this point in time) will continue to be more stuff!.
    InfantryLogic.jpg
     
  4. TheRealFuzz

    TheRealFuzz

    Joined:
    Jul 17, 2012
    Posts:
    308
    Hey, looking good!

    I have a few ideas if you need them:

    - Fog of war
    - Cover system
    - Resource gathering/generating
    - Research/upgrades
     
  5. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    Thank you! I'm taking my time on this, I want this to be great.


    I definitely plan on a FOW system (Fog of war).
    What do you mean exactly by cover system? - Like hiding?

    I definitely plan on adding at least the base essentials of Resource gathering, etc.
    As this is going to somewhat mimic Command and Conquer games, (the harvester that gathers the Tiberium) kind of thing for money, so I'm going to be creating at least the base essentials that ways players can still make it the way they want.

    - I'll definitely code the research, etc and stuff into it, but again, this isn't an actual game, it's just the bare essential code, well, I mean not exactly just code. Everything will be in demo scene, everything will be prefabed, etc.
    So there will be basic structures that look well, you know very basic and to the point, I'm not creating this kit to just click and build your games, I would, but then everyone would be making the same cloned game over and over.

    What I'm doing is, doing all the hard work of systems, (Building Construction, Currency, Controls, Unit Control, Manipulating Unit statistics based on given data, E.G. > gets a secret crate > gives him super armor. by having Super Armor > he looses a bit of speed to accommodate extra weight of armor, etc.

    Now I may, or may not make AI, I have been thinking long and hard on this, the problem with creating AI, especially RTS AI, is it has to be very specific, how can I make an AI tailored to everyone's needs? I can't, that's why I am confused on where to go with AI.
     
  6. moure

    moure

    Joined:
    Aug 18, 2013
    Posts:
    184
    Well one of the most important features of any rts is its pathfinding system. In more detail units formation,flocking and steering, dynamic obstacle avoidance, units being able to stay in stand pose and prevent other units from passing by, etc. I see that the only thing you mention in the original post is the use of unity navmesh, which i don't think its enough by itself to cover the basic needs of an rts game.
    If you are targeting for an advanced kit, i would suggest you to take a look at flowfield pathfinding (supreme commander and Planetary Annihilation) or the way pathfinding is done in games like starcraft or age of empires. Of course a complete rts pathfinding solution could probably be something worth of its own plugin since its a very complex matter, though i thought i should mention it :)
     
  7. TheRealFuzz

    TheRealFuzz

    Joined:
    Jul 17, 2012
    Posts:
    308
    Have you ever played Company of Heroes? It has a cover system where say a unit is behind sandbags he will get a defense/armour bonus compared to if he was out in the open.
     
  8. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    I'll see what I can do with a custom Path FInding :).
    I got used to the pro version of Unity which has obstacle avoidance, I just haven't gotten to the formation's, etc yet. Which I will definitely be working on that :).

    I'm not sure yet if I'm going to make this a 100% finished product, as I still want to leave room for users to create their games, not create a game that everyone else has made, so this may just stick as a starter kit level..
    That way people can still create their own game, just have a lot of this done, the main thing they'll have to focus on (MAYBE) is their own AI. Everything else will be made, and won't be hard to add stuff into it if you just so happen need to add something new :)

    Hey, I think I've played it before I honestly don't remember, the main RTS Games I play are Command and Conquer games. But I understand what you are saying, I'll definitely see what I can do about putting a cover system into this kit, it shouldn't be too too hard to implement.
     
    Last edited: Jan 26, 2015
  9. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    Update -

    I am still working on the Infantry (which is most of the work)

    However, I decided to go ahead and start some of the Structure Logic (Buildings).
    Remember this is a Command and Conquer style RTS Kit.

    Is there any other Options you'd like to see in the photos?
    ArmorType.jpg
    BuildingType.jpg


    Hope to hear some feedback from you guys!
    (I will do video demonstrations when I feel it's worthy of being seen).
     
  10. TheRealFuzz

    TheRealFuzz

    Joined:
    Jul 17, 2012
    Posts:
    308
    Nice work. How about an option to deconstruct/recycle buildings to get 75% of the resources spent on the building.
     
  11. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    I will definitely be adding that feature....

    I will get to features like that later in progress of this. Right now I'm trying to get all the basic functionality of everything
    created.

    E.G. - if this is a powerplant, give us 25 power, if this is an Advanced Power Plant, give us 45 power kind of thing.
    or if this is barracks, then, which units do we want only the barracks to unlock?

    hope more people get interested in this product I'm working on.
    I haven't yet seen an RTS kit for Unity released.
    All I ever see is the bits an pieces of some things released.
    Like the Camera, but never a complete starter kit.
    Keyword here *Starter Kit* not *Complete Kit* lol.

    But the way I am setting this up makes it pretty easy to create new categories and stuff.
    :)
     
  12. TheRealFuzz

    TheRealFuzz

    Joined:
    Jul 17, 2012
    Posts:
    308
    I guess some basic units at the barracks could be riflemen/machine gunners, snipers and rocket launchers. Vehicle factory could have jeeps/armoured cars, tanks and aircraft if you intended to add that.

    Keep up the good work :)
     
  13. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    The Building Type property doesn't make sense to me. If I'm making a prefab that I'll instantiate into the world when a building is placed then wouldn't the prefab itself be my building type? What does that property do?

    Also - how does a user add/edit that list? Do they have to go into the source code? How would a user modify the resistances associated with a particular armor type?
     
  14. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    Of course LOL... It's all gonna be set up with ease. :).



    Well I'm doing it this way so you don't have to have a million scripts floating around, 1 script can control all the logic of
    every type of building.

    The ENUM Selection is for classification, the building can be whatever you want, but if you want it to have a certain type of health + armor, and also what do you want this building to unlock, what special features does this building do, is it an outpost? If it's an outpost, then we can give our Units some extra abilities if they are near it.
    Yeah I know I could easily make multiple scripts, but to avoid confusion, I'm doing all in one scripts.
    That way it's easy to set up, instead of having a gazillion scripts for every single thing.
    E.G. - Unit Movement Script, Unit Targeting Script, Unit Shooting, script, Unit Pathfinding script, etc.

    I'll show how to Set up new types of buildings, it's very simple.
    BuildingType.jpg

    But for the sake of this, I will do Advanced Guard Tower.

    AGT.jpg



    Here is how Armor is changed.
    Armor.jpg

    I hope that cleared up some confusion.
     
  15. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    So I have to go modify your source code to create a game with your framework?

    If I have to write my own code to support different building types that aren't included anyway then wouldn't my code go in its own script?

    I also see that you tie the name of the method to the enum representing the type of building. Where and in what context does that method get called? If I made a new one do I need to go into your source code and add/change those method calls?

    --

    I think you've made a critical error in how you're organizing your data. You're saying "If this is an outpost then we do these things" but what if I want my outpost to do something different? Or I want to do the same thing an outpost does on a different building? Things should be organized based on what they *do* not what they *are*. Does an outpost provide an aura buff? Then a script should exist called AuraBuffApplier. The user should be able to add this to *anything* and choose which buff to apply and who it applies to (owned units, enemies, allies, all, etc) along with the range, the effects associated with it, whatever else.
     
  16. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    It's just a starter kit, not a complete kit.
    I did it this way intentionally that way people can still create what they want, not create the same exact game by cloners.

    So yes there is still going to be work involved to create your game, just some of the base *starter* stuff is done for you.
    I would have done like UFPS and just created an entire framework to create your game, but the differene is, FPS games are FPS games, there's really nothing any different about them, (you know what I mean LOL).

    But an RTS game on the other hand, there isn't any that are totally alike, so I can't exactly please everybody with it.
    What if I decided to make an AI and they wanted an completely different kind of AI?

    Now that doesn't mean there isn't any work for the user using this package.
    It just means that some stuff is already completed to get you moving forward with the other features that can only be made the way you like.

    Well, the outpost was just an example, the ENUMS are there just for classification purposes only.
    That way, if you select that building type, you can organize it within the script, and be like okay, this is an outpost.

    The enums are called in the awake and start function.
    Then once they go through the start and awake function, they are only called to their primary function from the Update function while others get ignored.
    E.G. -

    AdvancedGuardTower ();
    void AdvancedGuardTower();

    I haven't yet gotten to abilities, that's why I was asking for opinions on things, right now I am just setting things up.
    I could easily make any ability work with anything if I really wanted, I was just using the Outpost as an example, I'm still just setting things up.

    I actually like the ability on any structure idea, but again, I was just using the Outpost structure as an example.
    It's moreso for classification purposes.
     
  17. moure

    moure

    Joined:
    Aug 18, 2013
    Posts:
    184
    I see what KelsoMRK is saying and i agree with him. To give you an example of a kit you can check songtan's tdtk and tbtk which imo are one of the best on the asset store. Instead of having specific units or building tied with specific atributes you get a building or unit creator interface in which you create your own buildings/units by selecting through a number of premade and custommade atributes/abilities.
    As an example you can see in the attached image the editor tool to create the tower defence buildings (image borrowed from the asset store) . I think thats the kind of functionality Kelso is talking about.
     

    Attached Files:

  18. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    Indeed.

    Random checking of enums scattered through a codebase is going to be absolute hell for anyone who needs to modify those enums. Just using your armor example - if I don't want "Light Armor" and I remove it then I've just broken your solution.
     
  19. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    This is why I have not made an RTS framework yet, even though I have a pretty extensive one myself. I simply can't think of a way to make a good RTS framework "extensible" enough, or flexible enough for other people.

    I know there's got to be a way to do it. So that's good feedback KelsoMRK.
     
  20. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    Sorry guys, I've been really busy lately. Sorry for the lack of responses.

    Yeah I'm starting to realize this is an almost impossible task because how can I make this set up where anybody can make what they want without hard coding, after all that's the point of a kit, to prevent hard coding. This may be a dead end product, I mean well to make something, but you make a good point.
     
  21. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    You were on the right track - I just disagreed with your general approach and your mindset. A high level framework like this should never mention specific types of anything let alone hardcode checks against them in the codebase. I can talk a little bit about our approach - which is more to facilitate modding and less about creating a framework in Unity.

    RTS games are great candidates for data-driven design which is why they are so mod-friendly to begin with. So a framework should simply facilitate the interactions between those pieces of data. Starting at the bottom we have a list of damage types which is literally just a list of names. Anyone can add to this and it just sits in a file that gets loaded so there's no checks against specific damage types in the code anywhere. Next there are a list of weapons which deal one of those damage types. We have checks to make sure the damage type a weapon deals is actually included in the list of damage types. Next is a list of armors which have resistances against those damage types. So in the game code when a unit A attacks unit B we simply say - hey unit B tell me how much resistance you have against unit A's weapon damage type. That gets subtracted from the weapon's damage and that's how much damage unit B takes. Next comes units. The only thing that designates an infantry over anything else is a flag in the data file for the unit. We don't "load infantry" and then "load vehicles" - we just load units. Then we have structures - again just a list of data. References for prerequisites and whatnot are checked after that, so a unit doesn't declare a bogus structure as a prerequisite etc etc.

    Flags or additional data blocks in those files configure special functionality for that thing. We can add some data to let a vehicle act like a transport and carry other units around. We can make structures unlock units and tech. We can make units deploy into another unit or structure. The *functionality* of those things is handled in the framework - not the implementation of the units and structures themselves.

    You can take a system like this as far as you want. For example - the older Command and Conquer games had the concept of a locomotor which determined how a unit moved around in the world. So you'd give a unit the infantry locomotor and he'd cut corners really hard and turn around instantly but give him a vehicle locomotor and he'd use a turning radius. Give him a plane locomotor and he'd fly around the map. They made the decision to decouple movement behavior from the unit itself. We chose not to do that and rolled part of that into the infantry flag on the unit itself.