Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Third Person Controller - Third Person, AI, Multiplayer, Mobile Framework

Discussion in 'Assets and Asset Store' started by opsive, Jan 21, 2015.

Thread Status:
Not open for further replies.
  1. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Third Person Controller
    Version 2 Available on the Asset Store


    This is so much more than just a smooth and flexible character controller. The Third Person Controller is your ultimate framework for creating ANY 3rd person game.

    Featuring a character and camera controller, combat system, inventory management, and much more! Thousands of hours have gone into developing this framework so you can focus on the unique aspects of your game.

    Use the editor scripts to create your character and items in seconds. Easily add new animations with the unique ability system.

    Designed to scale, the Third Person Controller comes with mocap animations, mobile and Unity 5 multiplayer support. Any model (humanoid or generic) can be used. It is also integrated with many assets, including Behavior Designer to add life to your AI characters.

    Features
    • Physics-based character controller
    • Smooth Camera controller
    • Character and item creation in seconds
    • Shootable, melee, throwable, and magic items
    • Over 300 Mecanim animations
    • Unity 5 Multiplayer support
    • Flexible inventory and item pickup system
    • Ability system for any set of animations
    • Move with or without root motion
    • Humanoid and generic model support
    • Health and respawner system
    • IK to correctly position limbs
    • Local coop support
    • Supports keyboard/mouse or controller
    • AI integration with Behavior Designer
    • Moving platforms
    Programming Features
    • Mobile friendly
    • Script-based Animator controller
    • Event, scheduling, object pooling system
    • Zero allocations after initialization
    • Coding structure designed to scale
    • Heavily commented C# code
    • Includes full source code
    Abilities:
    • Balance
    • Climb
    • Cover
    • Damage Visualization
    • Die
    • Dive (Underwater Swim)
    • Dodge
    • Fall
    • Fly
    • Generic
    • Hang
    • Height Change (Crouch, Crawl)
    • Interact
    • Jump
    • Ledge Strafe
    • Move Object
    • Pickup Item
    • Quick Movement
    • Restrict Rotation
    • Roll
    • Short Climb
    • Speed Change (Run, Sprint)
    • Swim
    • Vault
    Demos:

    Integrations:
    • A* Pathfinding Project
    • Adventure Creator
    • Apex Path
    • Behavior Designer
    • Cinema Director
    • Control Freak
    • Dialogue System for Unity
    • Easy Touch
    • Edy's Vehicle Physics
    • Final IK
    • Gaia
    • Horse Animset Pro
    • ICE Creature Control
    • InControl
    • Inventory Pro
    • Morph 3D
    • ORK Framework
    • Playmaker
    • plyGame
    • PuppetMaster
    • Rewired
    • UMA

     

    Attached Files:

    • big.png
      big.png
      File size:
      285.1 KB
      Views:
      7,854
    Last edited: Sep 22, 2018
    KingLlama and jimmy_doodle like this.
  2. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,314
    Nice, two question for the UI you use Ugui ? what assets do you plan to integrate soon?
     
  3. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    The asset was submitted with 4.3 so it is still using OnGUI. I can later add a uGUI package but for now I just wanted to get the core third person framework out there.

    In terms of other integrations, it'll have basic Behavior Designer tasks at launch. I have a lot of plans for this asset and AI though so expect the integration with Behavior Designer to get a lot more extensive.

    Not necessarily an integration but one of the first features that I plan on adding is networking support. Ideally I'd like to use Unity 5's implementation but we'll see if that works out or if I need to go a third party route.
     
  4. Licarell

    Licarell

    Joined:
    Sep 5, 2012
    Posts:
    434
    For IK have you given it thought about integrating a more robust system like FINALIK?
     
  5. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    I have definitely thought about it and it seems like a good thing to do. The IK that the Third Person Controller does is all within the CharacterIK component so it's really easy to remove if you want to use FinalIK. As soon as this framework is a little bit more mature I'll look into it.
     
  6. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Here's a video on setting up your character. The Third Person Controller framework is very modular and when it is all said and done there are about 15 components added to a player-controlled character. The Character Builder is a small wizard which will walk you through setting up your character.



    I also recorded a few other videos on creating objects and those videos can be found here.
     
  7. Licarell

    Licarell

    Joined:
    Sep 5, 2012
    Posts:
    434
    Looking at your wizard I had an idea... would it be hard to also setup a wizard for your animations... There are so many great animation packs out there it would be great to be able to go through setting up animations by drag and drop in the setup wizard so if you have custom animations you can replace the defaults quick and easy.
     
    RealSoftGames likes this.
  8. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    That's a great idea! I don't know how possible it is though - in Unity 4 the Animator Controller doesn't expose too much through script. I know that they have improved it with Unity 5 though so it may now be possible. My first priority will be to fix any bugs that are found and then I'm going to start on networking with Unity 5. While I'm in there I'll take a look and see if it's possible to replace the animations in the states through script.
     
  9. Licarell

    Licarell

    Joined:
    Sep 5, 2012
    Posts:
    434
    Fair enough...

    Looking forward to your asset!
     
  10. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,314
    i havent see any info in the docs but does it include a pooling system? at list for projectile and throwable?
     
  11. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Yes, it does. It'll pool any object that is instantiated which includes both GameObjects and objects derived from the System.object class such as the hit indicators that appear on the GUI which show you the direction that you got hit from.
     
  12. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    On the Behavior Designer sample pages I just added the Third Person Controller sample project. In this sample project the AI Agent (Ethan) will shoot at you when you get within range. As soon as Ethan is out of ammo in the clip he will reload. The full lists of Behavior Designer tasks are located on this page. This is just the basics in terms of the integration with Behavior Designer and there will be a lot more to come. I'll activate the link to the Third Person Controller tasks as soon as the Third Person Controller asset has been approved (I need a link to the icon for the Behavior Designer integration page).

     
  13. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    I'm still waiting to hear back from the Asset Store but in the meantime I've been fixing bugs and just added the Doxygen documentation to the site - http://www.opsive.com/assets/ThirdPersonController/API. When the Third Person Controller is released I will be submitting a day 1 update that fixes the bugs that I've found and have been reported to me as well as a few new animations.
     
  14. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,314
    do you have already implemented a function to read/load an inventory layout?
     
  15. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    On the Inventory component you can change the Default Loadout which will allow the character to spawn with the specified items when the game starts and on any respawns. Is this what you're thinking of?
    DefaultLoadout.PNG
     
  16. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,314
    not sure now, for example i use an external inventory system, you have different types of items in my external inventory, ressources, weapons etc. you can drop IUsable items on your skill bar, when you click on one, it just switch your "weapon". so what is important in fact its to set the items in your inventory list and their amount, the external inventory, would load a saved list then feed your inventory

    so foreach items in my skill bar >add ID+amount into your inventory
    would that be possible?

    PS: this inventory https://www.assetstore.unity3d.com/en/#!/content/26310
     
  17. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    I haven't used that inventory system but we should be able figure out a way to have the two assets play nice with each other.

    The two assets will have to be synchronized both when the character spawns and when an item is used. The Third Person Controller inventory system doesn't implement any interfaces but that may be a smart thing to do to allow easier integration with other inventory systems. The only problem with this is that you would then have to modify the other inventory system asset to implement that interface which you may not want to do.

    Another approach is to have an intermediate class that knows about the Third Person Controller inventory and the Inventory Master inventory. The Third Person Controller fires events when an item is used or when the character spawns so that intermediate class could listen for those events and then update the Inventory Master inventory. This would prevent you from having to modify any of the code within Inventory Master and allow you to easily update both assets without having to make any code changes.
     
  18. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    Just appeared on the store. :)
     
  19. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Man, you are quick. It literally appeared on the store 8 minutes before your post :)

    I'm uploading a new version right now so I was going to wait until that version is on the store before I said anything. I'll post a link then :)
     
  20. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    As mentioned by @hopeful, the Third Person Controller has been approved and is now on the Asset Store! You can get it here. Let me know if you hit any problems or would like to see more documentation/videos on a particular topic.

    The Behavior Designer integration page has been updated and you can get the Third Person Controller tasks on the integration page.
     
  21. im

    im

    Joined:
    Jan 17, 2013
    Posts:
    1,408
    Will you add RPG with weapons such as sword, shield, axe, hammer, dagger, bow+arrows? or other weapons such as bat, crowbar, hammer, crossbow?
     
    Last edited: Jan 28, 2015
    eridani likes this.
  22. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Bought right away. I like where this asset is going!
     
  23. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,314
    i there a way to do random animation for melee using a randomised int as parameter for mechanim?
    havent tested it yet!
     
  24. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Yes, definitely. The shooter demo has more conventional weapons and I want to include some of the more non-conventional weapons in this adventure/rpg scene to show off the generic-ness of the inventory/item system. We were planning out the new scene yesterday and that's going to be one of the first major feature updates of the asset.

    Thank you! Now if there was only more time in the day to be able to get things out quicker...

    We'll work on adding it in the next update. If you want to add it now a quick and dirty way would be to modify the OnUse method within AnimatorMonitor.cs. When the MeleeWeapon is used it will tell the animator that it needs to play an animation. It does this with the OnUse event. On this line,
    Code (csharp):
    1.  
    2. m_Animator.SetTrigger(m_AnimatorUseHash);
    3.  
    You could set a random integer parameter and then modify the attack state within the NoItem substate within the upper body layer of the animator. Again, this is a quick and dirty way to do it and I'll provide a better way to handle it in the next update.
     
  25. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Congratulations on the release! Just bought it! :)
     
  26. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Thanks Tony!
     
  27. jonkuze

    jonkuze

    Joined:
    Aug 19, 2012
    Posts:
    1,709
    I must say I'm very impressed! I didn't think someone could get a Third Person Controller Asset done right with Mecanim, but I think you nailed it! I watched the video for the Character Builder, and it's really awesome how you managed to add a Wizard, and allow us to Setup a Character through simple drag and drop. Great Job! I'm looking forward to some Melee Action w/ Animations and Weapons.

    Question, is there any basic built in AI, or do we need to purchase Behavior Designer to add AI?
     
  28. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Thank you! There is still a lot that we're planning on adding to this asset but I'm really happy with where it is at right now.

    Does a turret that rotates to face its target count? ;) All of the character AI will be done through Behavior Designer - I figured that I didn't want to spend time on a half-baked custom AI for it when behavior trees provide an excellent AI implementation and something that you can really use for any type of game. Next week I plan on adding integration with the Movement Pack so that will give even more of a reason to use it with Behavior Designer.

    We should be releasing an update this weekend for the Third Person Controller. One of the things that this update will bring is the ability to add abilities without having to modify the existing RigidbodyCharacterController class. As an example, in the current version the cover system has code spread out throughout the entire controller class. This update will make it so the cover system is in its own file and the controller class doesn't even directly know that it can go into cover. This will make adding new abilities a lot easier with cleaner code.
     
    eridani and jonkuze like this.
  29. jonkuze

    jonkuze

    Joined:
    Aug 19, 2012
    Posts:
    1,709
    Sounds Great! Looking forward to Updates. I haven't purchased it yet, but I'm sure I will soon as I get some cash in my PayPal. ^_^ Keep up the good work.
     
  30. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    I appreciate it!

    Relating to the update, I just finished with the system that will allow you to easily add new abilities. First off, for some background, the RigidbodyCharacterController component is the main component that controls the character's movements. If I do a search for 'cover' within that component, you'll see that the cover system implementation is spread throughout the entire file:

    cover.PNG

    With a system like this it makes adding new abilities (such as vaulting, swimming, or climbing) a mess because you have to consider all of the other abilities in order to add a single new ability. This doesn't make the framework too extensible so the update going out this weekend changes it so all you have to do is inherit your new ability from the Ability class and the RigidbodyCharacterController will automatically recognize the new ability. For comparison, I did the same 'cover' search and these are now the results:

    newcover.PNG

    That one search result was from a comment:

    Code (csharp):
    1.  
    2. // Abilities allow for extra functionalities such as cover or interact
    3. [SerializeField] private Ability[] m_Abilities;
    4.  
    And this is what the component inspector looks like:

    Abilities.PNG

    In this screenshot the AnimatorMonitor inspector is also shown because that component was also improved with this update. The AnimatorMonitor interfaces with the Animator controller and is what makes the trigger-based animator possible. In the current version on the Asset Store the transitions between states are hard coded which means in order to add new states you would have to hard code the new transitions. This updated component allows you to specify all of the transitions in the inspector which means it should be possible to add a new state without any scripting.
     
  31. Zultron

    Zultron

    Joined:
    Dec 26, 2012
    Posts:
    52
    If you looking into setting up network for this controller I would suggest perhaps using photon Network.. It will save you lot of time and headache and looking at script should be pretty straight forward just passing the animator values into network manager.
     
  32. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    For networking, I'd be happy if you focused on the core, non-networking functionality for now, and used Unity 5 networking when it's available.
     
  33. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
    Thinking same as TonyLi about networking.
     
  34. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Thanks for the feedback.

    After I get this next update out I am planning on adding integration with the Movement Pack. I'll also add some AI agents to the warehouse scene so you can see how it all works together. Once that is done I'll then at least start to play with networking so it isn't completely foreign to me when I start to seriously implement it. During this time our artist is working on the adventure scene.
     
  35. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    What is the adventure scene? Indy Jones stuff?
     
  36. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Yes, part of it. The purpose of this scene is to show that the controller can be used for more than just a third person shooter. This includes non-traditional weapons (bow and arrow, axe, etc) and abilities that you don't always see in a third person shooter (such as climbing, pushing boxes, destroying boxes to collect loot, etc). We have plans for swimming as well but I don't think it'll make the first version of the adventure scene.
     
    eridani likes this.
  37. Licarell

    Licarell

    Joined:
    Sep 5, 2012
    Posts:
    434
    @opsive - Chris (Adventure Creator) is modifying his asset to incorporate 3rd party movement controllers, just thinking how great it would be to incorporate this controller with that asset...
     
    hitking100 and TonyLi like this.
  38. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Great idea - I just sent an email to Chris. It would be awesome if the adventure scene could come out around the same time as the Adventure Creator integration.
     
    hitking100 likes this.
  39. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    This next update is taking a little bit longer than I had hoped so we won't be releasing this weekend. It should be within the next couple of days though. The good news is that I have all of the reported bugs fixed and have now been able to work on some new requested features. One of those was the laser sight:

    LaserSight.png

    I then decided to add a flashlight as well since it was so similar to the laser sight:

    Flashlight.png
     
    gurayg and TonyLi like this.
  40. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Version 0.81 beta has been released on the Asset Store! This version includes a lot of new features and bug fixes. This post has the full change list. I would post some screenshots of the new features but I already covered the more visual features in the previous posts... Well, I didn't post a screenshot of the health pack yet ;)



    Movement Pack integration is coming up next as well as full compatibility with Unity 5.
     
  41. im

    im

    Joined:
    Jan 17, 2013
    Posts:
    1,408
    i just imported v 0.81 and im getting tons of errors

    Button "Reload" is not setup. Please select "Update Input Manager" within the Start Window
    Button "Quick Use" is not setup. Please select "Update Input Manager" within the Start Window
    Button "Toggle Flashlight" is not setup. Please select "Update Input Manager" within the Start Window
    ...

    i did clean install but its like great many of the buttons are not defined...
     
  42. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Did you import it into a new project? Reload and Quick Use are old inputs but Toggle Flashlight is new. Go to the Tools menu and select Third Person Controller -> Start Window. Then press Update Input Manager and it'll setup the input buttons for you.
     
  43. im

    im

    Joined:
    Jan 17, 2013
    Posts:
    1,408
    wow new release is much better.

    still the animation is a little laggy, but overall very good step.

    also please add like more melee weapons.

    perhaps bat / crowbar would be nice, sword / chainsaw would be heaven

    and throw in a zombie and i got a game to play ;)

    oh i got better idea contact author of Decayed State asset
    https://www.assetstore.unity3d.com/en/#!/content/22523

    and work to make your two pages together and you got best seller cause your efforts nicely complement each other :)

    thanks in advance!
     
  44. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Thanks! Yeah there are still some animation issues that I want to fix for the next release, but I do agree that this release is a major improvement. Most of the issues that I plan on focusing on for the next release relate to the airborne set of animations and the transitions to/from it.

    Noted :)

    I was wondering how long it would take for somebody to mention a zombie ;)
    That's not a bad idea. I want to get a little bit further with the Third Person Controller before I look at integrations but I can definitely see what it takes to integrate with Decayed State when I do. From a few posts earlier, Adventure Creator will be supported fairly soon though.
     
  45. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
  46. Gametyme

    Gametyme

    Joined:
    May 7, 2014
    Posts:
    618
    Nice update! Looks like your pretty fast with adding request. Good job!
     
  47. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Thanks! We try to add requests as soon as we can. For some things it makes sense to wait (such as the bow and arrow which is an adventure scene related item) but other than that we should be able to get to it pretty quickly.

    Today I have been working on integrating the Third Person Controller with Behavior Designer's Movement Pack and it is going pretty well. I am planning on having this update out by the end of the week. I am hoping to be able to support A* Pathfinding Project and Apex Path in addition to the NavMesh, but we'll see how that goes. So far I just have NavMesh prototyped:

    EthanTree.PNG
     
  48. Licarell

    Licarell

    Joined:
    Sep 5, 2012
    Posts:
    434
    That's great news!
     
  49. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Version 0.82 of the Third Person Controller was released last night. You can see the full release notes here. The major feature for this update is the integration with Behavior Designer's Movement Pack. We also created a sample scene that uses AI and you can play it here. This scene is available on the Behavior Designer samples page. I am still working on a documentation page and video for this tree but I have attached a screenshot of what the tree looks like.

    The AI agent can attack, find health, find ammo, or patrol. This entire tree can be created without any scripting.

    ThirdPersonControllerScreenshot.png
     
    twobob likes this.
  50. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    A lot of AI suffers from this exact syndrome, so I am not picking on Behavior Designer... but I think there is a big flaw when an enemy AI is attacking or otherwise tracking the player and then when the player hides behind a wall or box, the AI instantly and immediately reverts back to patrol mode. There should be a period of time where the AI moves closer, continues to search for the player starting at the player's last seen position, etc, for at least a short period of time.

    EDIT: Also, it seems the AI is tracking the player's legs and not the head/chest area. If the player merely hides his legs behind a box, the enemy AI cannot see the player.

    EDIT2: And when the enemy AI is attacking the player and the player simply moves behind the enemy, the enemy AI loses all awareness of the player.

    EDIT3: When I start shooting at the downstairs enemy AI he starts sprinting toward a random direction away from the player, and then sometimes just starts patrolling again.

    I remember making a practice AI using behavior trees and I had to handle these very issues that I mentioned. Otherwise the AI completely ruins immersion by its lack of realistic responses.
     
    Last edited: Feb 15, 2015
Thread Status:
Not open for further replies.