Search Unity

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

    TheLetterS

    Joined:
    Jan 22, 2013
    Posts:
    31
    Right now the Third Person Controller is set up to handle the swimming ability, but we haven't created our own animations for it yet. That is coming soon in a future update.

    The 300+ animations refer to how many animations are actually included in both the shooter and adventure scene combined as of now, and these are actual animations :) The controller can handle any amount of animations.
     
    BackwoodsGaming likes this.
  2. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    Thanks for the info Sarah! Sounding definitely like an interesting candidate! Only thing holding me back from pulling the trigger is ORK integration (well and I guess getting the budget to actually buy it would help too) lol.. But at this point I think when the funds are there, this will be added to my toolbox!
     
    TheLetterS likes this.
  3. TheLetterS

    TheLetterS

    Joined:
    Jan 22, 2013
    Posts:
    31
    That's great to hear! Justin has been working on the ORK integration and it shouldn't require anymore code changes now, so we should be able to have that out in the next few days!
     
    BackwoodsGaming likes this.
  4. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Just a small clarification - swimming will be a new ability which will need new code as well as animations. What I think Sarah was referring to is the fact that the base controller class is setup to be extended so any type of ability can be added, as long as the animations are there as well. Within the adventure scene we have a spot for water already picked out - it just needs to rain :)
     
    BackwoodsGaming likes this.
  5. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    Cool! Let there be rain!!!

    That is one of the things that has been bugging me in testing another asset is seeing character walking underwater. I was really surprised that the ORK controller didn't have swimming built in and from posts in their forums, it almost sounded like it wasn't something that was going to be supported on their controller. So that was one of the things that got me looking. I mean I'm sure it could have been coded in, but having a more fully functional controller from the start sounds a bit more appealing! Looking forward to giving this one a spin once I can pick it up!

    Keep up the awesome work!
     
  6. den3d

    den3d

    Joined:
    Nov 23, 2014
    Posts:
    45
    Add ragdoll impulse when character die to increase realistic.
    This is a simplified solution do not care about instantaneous velocities but it's OK for games.
     
  7. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    @den3d -

    Thanks - I really like that change! I'll add it to my version as well so you don't have to change it with every update.
     
  8. den3d

    den3d

    Joined:
    Nov 23, 2014
    Posts:
    45
    Please keep in mind I can get velocity not only from Rigidbody but from NavMeshAgent or other also. (Enemies in my game use NavMeshAgent).
    One of solution is to define IVelocitySource interface with single Vector3 velocity { get; } property.
    Anyone be able to implement it's own velocity getter.
     
  9. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    When you use a NavMeshAgent are you calling RigidbodyCharacterController.Move so the animations match up? This will then set the Rigidbody velocity.
     
  10. den3d

    den3d

    Joined:
    Nov 23, 2014
    Posts:
    45
    Actually I use simplified set of controls for enemies (game for mobile): CharacterHealth and CharacterRagdoll only (character initially set with Character Builder).
    NavMeshAgent exclusive control character movements.
    More ragdoll case than TPC actually :)
     
  11. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    @Shawn67 - I just finished adding the ORK integration

    ORKSample.png
    You can get this integration and sample project from the Third Person Controller integrations page. The documentation to go along with it is here. All that it really takes is to add one more component to your character or camera. This integration allows ORK to take control of the character and camera when it needs it (such as during an interaction).
     
  12. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    Awesome! Just had a look at the docs and this sounds perfect! I'm assuming it is just the camera and character controller you have integrated. Definitely drooling now!
     
  13. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    That's correct. I could look at integration more components such as health but since you are able to just use ORK's health component instead of the Third Person Controller's health component it is probably easier to just do that.
     
    BackwoodsGaming likes this.
  14. witchscroll

    witchscroll

    Joined:
    Jan 17, 2015
    Posts:
    131
    this controller looks nice. i have 3 questions:
    1
    i'm developing a 3d game like sidescroll, but the player can not only move on x, but also can move on z, while camera allways look z and follow player. here is a screenshot of my game just show what i mean.

    i wonder if your controller can create such a controller or not?
    2
    i see you added integration of dialouge system. i wonder if you may add integration of localized dialogs and cutscenes or not.
    ldc
    https://www.assetstore.unity3d.com/en/#!/content/5020
    3
    is there anything special designed for fantasy game? like meele combat or npc ai ?
    good luck.
     
    Last edited: Jul 31, 2015
  15. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    @witchscroll -

    Thanks for taking a look at the Third Person Controller!

    1. Currently this is not possible but it would be easy to add. Right now there are three movement types: Combat, Adventure, and Top Down. In this case I would need to add a fourth movement type that allows you to lock the specified axis. I could probably add this change today and send you the new files so you don't have to wait for 1.0.1.

    2. For right now I am holding off on more substantial integrations. I have a lot planned with the inventory for version 1.1 so I want to get this change done before I work on any more integrations. The Dialogue System integration was actually done by the Dialogue System publisher. With that said, I am definitely open to any integration suggestions once we have a more stable base.

    3. Melee combat is included. Currently you can equip a melee weapon and play a set of attack animations sequentially or randomly for that weapon. I plan on expanding on this to include things such as combos. In terms of AI integration, it is integrated with Behavior Designer. Your AI agent can pretty much do anything that a player-controlled character can do with this integration. AI is not built-in because I'd rather focus on core character controller topics instead of AI. If I did add an AI in, it wouldn't be nearly as extensible as behavior trees so you would probably end up replacing it with something of your own anyway.

    Let me know if you have any other questions!
     
  16. den3d

    den3d

    Joined:
    Nov 23, 2014
    Posts:
    45
    I think damage force vector from shootable calculate not quite correct.
    Current ShootableWeapon::HitscanFire get raycast normal but should use fire direction.
    Code (CSharp):
    1. hitHealth.Damage(m_HitscanDamageAmount, m_RaycastHit.point, m_RaycastHit.normal * -m_HitscanImpactForce);
    Should be something like this
    Code (CSharp):
    1. hitHealth.Damage(m_HitscanDamageAmount, m_RaycastHit.point, FireDirection() * m_HitscanImpactForce);
    Please let me know if you need explanation video.
     
  17. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    That looks correct - thanks! You'll want to save off the original FireDirection because there can be some randomness due to the spread but I'll have this change in 1.0.1.
     
  18. den3d

    den3d

    Joined:
    Nov 23, 2014
    Posts:
    45
    For instance I have: pistol1, pistol2, pistol3 with the same animations.
    Is any way to share single weapon animation State with few weapons or should create separate state for each?
     
  19. Artificialized

    Artificialized

    Joined:
    Oct 5, 2014
    Posts:
    69
    Quick question With the unity networking demo ive managed to setup my network character and get him to move around but the only problem im running into is i can only play with 2 characters/multiplayer on the same computer i tried connecting 2 characters through 2 different computers and it didnt work is this because there both located on the same network?Today i was going to have my friend test my game on his computer to see if it changed anything.He isnt home right now so i guess i just have to wait :s
     
  20. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Yes - within the PrimaryItemType of each of your pistols just name them the same. They will then use the same animator substate so the same animations will be used.

    That's actually a good question. I have only tested UNET locally so I'm not sure how much help I'll be. Have you tried setting the Log Level on the Network Manager to Developer so you can see exactly what is happening?
     
  21. Artificialized

    Artificialized

    Joined:
    Oct 5, 2014
    Posts:
    69
    This is what i've done so far i Setup The Character builder with the network component i now have a fully functioning network character but when i click Lan(Host) everything seems to sync over server and work fine,then i click Lan(Client) on my other computer thats connected to the same network router all the connections are wireless and the 2 connections dont sync together meaning i cant see the other character but the connections only sync over when on the same computer.

    So for example I want to be able to play my project with my friend and have them test it out with me but i cant figure out why or how to fix this problem.Ive already tested it out with 2 computers connected wirelessly to the same router and it didnt work just waiting on my friend to get home so i can test it out on his computer to see if the connections will sync
     
  22. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Just for comparison, have you tried one of the UNET sample projects? Also do you get any errors if you set the Log Level to developer?
     
  23. Artificialized

    Artificialized

    Joined:
    Oct 5, 2014
    Posts:
    69
    No i havnt tried any of the UNET sample projects but i will now, As for when i set the Log level to developer i did appear to have some errors heres a picture below with the errors

    [/IMG] [/IMG]
     
  24. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Did you make any changes to the networking scene? Each ItemType has a unique ID so it can be identified over the network. It doesn't look like the ItemType with the 1749... ID has been added to any items as a child of your character's hand.
     
  25. Artificialized

    Artificialized

    Joined:
    Oct 5, 2014
    Posts:
    69
    Are you talking about the Demo Networking scene thats included with your asset or the one i made with your asset if your talking about mine then yes, but the only thing i changed out was the model and added the health monitor script to my networked character i basically replicated everything in the demo network scene except for the canvas and added it to my own scene i havnt added any other scripts to my "Networked player character prefab"
     
  26. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Instead of creating your own character lets first try to get things working with the included demo scene. Have you had a chance to see if one of the sample projects work? If you try the included demo scene do you get that item id error?
     
  27. Artificialized

    Artificialized

    Joined:
    Oct 5, 2014
    Posts:
    69
    Nope i ran the Network Demo Scene and dont get the item id error i just got done reimporting Third person controller into a new project tried the network demo scene on 2 different computers and it still doesnt sync the connections but its runs perfectly fine with more then 1 client on the same computer.I really appreciate you helping me with this
     
  28. witchscroll

    witchscroll

    Joined:
    Jan 17, 2015
    Posts:
    131
    thank you for your reply.
    1
    I do not need lock the specified axis for movement. the player in my game should can move on any axis freely except y axis.
    what i mean is the camera should allways look z and follow player. like the old arcade game named night of the round/ dragon and durgeon, but the camera allways follow player.
    3
    not too much to say right now. I want a more template/usable like enemy that can be placed in scene very fast and it work.
    i checked your behavior designer, it seems have no completely templates like npc archer/swordman/heavy armored swordman/rogue/mage.....i wish there is a package with player controlller and npc templates like that , then i alt few numbers and choose few options, then replace the base characters model ,then place them in a scene, then when player come encounter enemy, enemy attack ..... which means it worked.

    i will keep an eye on your project. good luck.
     
  29. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    No problem. Does the developer log output say anything useful? Have you tried one of the UNET sample projects?

    1. Ah, that's actually even easier. What you could do in this case is set the camera offset to be looking at the character from the right, and then disable the CameraHandler. Since the CameraController is enabled it will still update position, but it won't respond to player input because the CameraHandler is disabled.

    3. That makes sense. While I do think that you would be able to achieve what you want with Behavior Designer, it isn't a template so it would take some more work to setup. The obvious disadvantage of this is that it would take more time since you first have to figure out behavior trees, but the advantage of this is that your AI would behave exactly as you want it to.
     
  30. Artificialized

    Artificialized

    Joined:
    Oct 5, 2014
    Posts:
    69
    Yes ive tried the Unet sample project Move.zip the one with the 3d ball it didn't sync the connection either but it does the same thing as the demo network scene that comes with Third person controller it allows you to play with multiple clients on the same computer, but doesnt sync over when trying to run 2 seperate clients on 2 seperate computers.
     
  31. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    In that case it's a general UNET question. I would post in the networking forum to see if anybody there knows what is happening.
     
  32. Artificialized

    Artificialized

    Joined:
    Oct 5, 2014
    Posts:
    69
    Thankyou i figured it out on my own all i had to do was go under Network manager in the scene and go to Network info and go to Network Address and change this out with my actual ip address and also switch out the Port address and put my actual port address in there instead of the 7777

    This allowed me to connect to my Client on Computer#1 with Computer#2
    Now i can play/test my game and multiplayer functionality on any computer
     
    opsive likes this.
  33. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Ah, that makes sense. It's great to hear that you figured it out!
     
  34. Artificialized

    Artificialized

    Joined:
    Oct 5, 2014
    Posts:
    69
    Thankyou :D all thanks to you for making this amazing asset!
     
  35. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    An update to the Behavior Designer - Tactical Pack has been released. This update adds Third Person Controller integration which allows you to attack and take damage while in tactical formations.

    ThirdPersonController.png
     
  36. den3d

    den3d

    Joined:
    Nov 23, 2014
    Posts:
    45
    Is it possible to play separate reload sound for each gun?
     
  37. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Currently there isn't a reloading sound option but I'll add it for 1.0.1. This version should be released within a couple of days.
     
  38. den3d

    den3d

    Joined:
    Nov 23, 2014
    Posts:
    45
    Tried your suggestion and got error:
    ArgumentException: An element with the same key already exists in the dictionary.
    System.Collections.Generic.Dictionary`2[Opsive.ThirdPersonController.ItemBaseType,System.Int32].Add (Opsive.ThirdPersonController.ItemBaseType key, Int32 value) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:404)
    Opsive.ThirdPersonController.Inventory.AddInventoryItem (Opsive.ThirdPersonController.ItemBaseType itemBaseType, UnityEngine.GameObject itemGameObject) (at Assets/Third Person Controller/Scripts/Inventory/Inventory.cs:318)
    Opsive.ThirdPersonController.Inventory.InitInventory (Opsive.ThirdPersonController.Item[] items) (at Assets/Third Person Controller/Scripts/Inventory/Inventory.cs:296)
    Opsive.ThirdPersonController.Inventory.Awake () (at Assets/Third Person Controller/Scripts/Inventory/Inventory.cs:281)

    Each pistol has the same ItemType so you can't point what exactly pistol would like to use - Defaul Loadout for example.

    I see the only good solution is to define pistol1Type, pistol2Type etc, then clone and rename animations.
     
  39. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    That's right - you'll need to specify a new ItemType for each pistol. Every Item needs its own ItemType otherwise you'll get that error. This isn't directly related, but in 1.0.1 I've changed it so the Item Name is specified within the Item instead of the ItemType. This makes it more consistent with the rest of the animator state values.

    Edit: to expand, you'll just need to create a separate ItemType. You don't need to clone and rename the animations.
     
    Last edited: Aug 5, 2015
  40. Cscompo

    Cscompo

    Joined:
    Jun 30, 2015
    Posts:
    3
    Hi,
    Firstly, Your asset is awesome, very easy to use.
    Secondly, do you think a Inventory Pro integration is possible ?
     
    Last edited: Aug 5, 2015
  41. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Thank you! I do think that Inventory Pro integration possible, though I'd like to get a little bit further with the current feature set before I add it. Version 1.1. will allow you to dual-wield items and that is going to require current inventory changes. I don't want to start on Inventory Pro integration when I know that I'll need to do it over again after version 1.1.
     
    Archania likes this.
  42. giraffe1

    giraffe1

    Joined:
    Nov 1, 2014
    Posts:
    302
    is the ai 1st person shooter AI demo's up to date? the animations look very strange. Are these easy to modify?
     
  43. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    I waited to respond because we are submitting a new version and this update has a lot of animation tweaks. I just uploaded a new version of the AI demo - let me know if the animations still look strange.

    In terms of modifying the animations, yes, all you need to do is replace them within the Animator controller. Unity has a general overview of how the Animator controller works on the Learn site. Now that we have this update complete we will be making a video showing how to replace the animations specific to the Third Person Controller.
     
    Licarell and BackwoodsGaming like this.
  44. Licarell

    Licarell

    Joined:
    Sep 5, 2012
    Posts:
    434
    @opsive Is there a way to like knock out the npc... like say a stun particle, paintball, etc... that would knock out the npc but not kill it... I'm trying to do a non-lethal game...
     
  45. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Looking at what the mechanics of what a knockout actually is, I'm guessing that you'll want to play a new animation and prevent the character from moving. You could create a new ability that does this, and then trigger it from the behavior tree when the agent gets hit. This ability would stop automatically after a certain amount of time. It would look something like:

    BehaviorScreenshot.png

    Where the Idle task represents the rest of your tree.
     
    Licarell likes this.
  46. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    The Third Person Controller version 1.0.1 has been sent to opsive.com purchases and submitted to the Asset Store. This version includes bug fixes and minor features. You can see the full release notes here.

    When you update and hit play the first thing that you'll notice is that you'll get a warning in the console with your existing ItemTypes:
    The ItemName field has moved from the ItemType to the Item component. This was the only Animator field that was set on the ItemType so I figured that I would make things more consistent and add it to the Item component along with the other Animator fields. All of the demos and integrations have been updated with this change.
     
  47. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    501
    Download from Opsive, import into new empty project, and get a bunch of errors about networking components:

    Assets/Third Person Controller/Demos/Network/Scripts/DemoNetworkManager.cs(10,39): error CS0246: The type or namespace name `NetworkEventManager' could not be found. Are you missing a using directive or an assembly reference?

    and so on and also about 'NetworkMonitor' this is the DLL version and not the source code. Miss a step? Running 5.1.2f1. I don't care about networking but looks like if I just delete the unhappy wrappers other files complain.
     
  48. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    With the Asset Store you can upload a specific package for each version of Unity and with the opsive.com purchases I just sent the 5.0 version. I'll figure out a better way of doing it next time, but for now if you import the source code you'll be good to go. Alternatively I can send you a 5.1 DLL if you would rather have that.
     
  49. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    501
    I'll download the source code, maybe in the future instead of a unity package have the link grab a zip with 5.0, 5.1 etc unity packages in it?
     
  50. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    I'm thinking that I'll do something similar to what I used to do with Behavior Designer: include all of the versions of the DLL, and then have a script automatically select the correct version based on the Unity version. I submit three different versions to the Asset Store: 4.6, 5.0, and 5.1. I don't want to include these three packages in zip because the file size would be three times what it needs to be.
     
Thread Status:
Not open for further replies.