Search Unity

Third person cover controller

Discussion in 'Assets and Asset Store' started by EduardasFunka, May 23, 2017.

  1. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Yeah, or you could use a big sphere collision and using overlap function with some specific layer to get all objects you need. And call it at regular intervall instead of each frame.
     
  2. AshyB

    AshyB

    Joined:
    Aug 9, 2012
    Posts:
    191
    Got inventory pro working with this. It was harder and more work to set up inventory pro than it was to set up the actual integration.

    screenshot_36.png screenshot_37.png screenshot_38.png screenshot_39.png screenshot_40.png
     
    angel_m and EduardasFunka like this.
  3. AshyB

    AshyB

    Joined:
    Aug 9, 2012
    Posts:
    191
    @Ukvedys in the Gun.cs script can you make the fire() method virtual so we can override it and handle the ammunition part ourselves, or better yet just make everything virtual ;)
     
    StaticWave likes this.
  4. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    @AshyB thx to share. What part or what .cs files you had to touch for the integration ?
     
  5. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Yep.
    I have my own FPS controller, and i would need it to work with AI , the player fps doesn't use any cover system.
    Using some modular player script with functions we can call or Unity messaging system would really allow to use the plugin in our own way.
    Instead of be forced to stick to make only "Uncharted" gameplay games :rolleyes:
     
  6. AshyB

    AshyB

    Joined:
    Aug 9, 2012
    Posts:
    191
    Had to make my own script to place on the player to bridge the gap between both assets. Had to edit the gun.cs to fix the reload() method and the way it used ammo - from what I can remember.

    Yeah I was just gonna say, adding simple little events to the scripts would make things easier when it comes to updating. For example, right now I need inventory pro to spawn some stuff when the AI dies, so in the CharacterHealth.cs script I had to put a unity event public UnityEngine.Events.UnityEvent OnDeath; and then in the OnDead() method call it if (OnDeath != null) OnDeath.Invoke();

    Just little things like that would be handy so we don't have to touch the files as much. :)

    screenshot_42.png
     
    Last edited: Nov 2, 2017
    zenGarden likes this.
  7. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Yep, Messaging functions or some script premade generic function calls for AI would be usefull, so anyone can expand the game functionnality to it's own gameplay needs.

    It's needed to be able to make it work with any player controller, also for VR where you have a very different controller.
     
    Last edited: Nov 3, 2017
  8. AnthonyMyers

    AnthonyMyers

    Joined:
    Jul 25, 2014
    Posts:
    28
    My wish I would like to see a simple friendly pedestrian addon or tweak to the ai ie. taking cover and cowering or running around alerting every one
    (I tryed to set this up with the ai gui check boxs (sorry i dont have the patients to mess with the script )
    it kinda worked but instead of running for cover the enemy follows you around like a side kick witch is kinda cool in its self maybe if I could get him to attack the other enemy ais now that would also be cool hmmm )
     
  9. AshyB

    AshyB

    Joined:
    Aug 9, 2012
    Posts:
    191
    Id say he could. Just set him to a different team or to the same team as you and he might attack other ai. Havent tested it myself.
     
  10. DoenitZ

    DoenitZ

    Joined:
    Oct 23, 2012
    Posts:
    16
    I agree to this

    Yes, I was referring to the fact that the profiler states that those late updates have overkill methods being executed, but havent digged deeper at the moment. It seems I will be having to do this then

    Yes, I also agree to this, is just that the one I had bought, is the one labeled "mobile", and from the get go, one would think that an asset labeled "mobile", actually has improvements and optimizations to work for "mobile".
    Maybe it should be renamed as "lite" or something, instead of mobile, if it hasn't been optimized.

    I am not feeling well with giving it a 5 star rating to a "mobile" asset that actually doesn't work as well in mobile. The desktop version is awesome, and I will give it 5 stars. But sadly, the mobile version is not, and it needs rework. I would gladly pay more for an optimized version for mobile, but maybe the confusion comes from thinking that "mobile" just means "stripped down version", when actually, it doesn't... so there goes my 3 stars then...

    Well, time to grab my optimizing gloves and start coding then. I will try to update the forum for whatever optimization I find.

    Thank you all!
     
    AshyB likes this.
  11. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Yep, it needs some work.
    For example i don't like dragging the button to have the weapon fire, instead there should be some auto fire when the player is rotated towards ennemy.
    Same for character movement is looks clunky, not enougth reactive and turning could be better, perhaps modifying player parameters it will be better.
    Last issue is the AI , some of the AI is more agressive and many times comes too close to the player and is unable to fire anymore, this must be some bug.

    Overall , it works well enought , and it's a solid base to make some good mobile game, or use it as some base to make some fps game.
     
  12. DoenitZ

    DoenitZ

    Joined:
    Oct 23, 2012
    Posts:
    16
    I do think that this kind of mods can be done easily, which is one of the strong points of this asset: is easily configurable

    But here is where I have my doubts on the mobile version, the performance is not good, and this asset is not "easily optimizable".
    At the moment, my only... let's call it "complaint" (but is actually just a "name your things as they should be named" thing), is that a "mobile" asset, if it doesn't work "optimized enough" (i.e. Have a demo scene that works on mobile "as is" good enough - at least achieve 30 fps on that demo -) then it shouldn't be a mobile named asset

    That is all, for the desktop version, as I've said, great asset! :)
     
  13. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    I read the code and there is a big performance issue with "Positionning" Class about "ApproachACovered" function

    Basically it can perform per Update() 18 calls to:
    - NavMesh.SamplePosition
    - NavMesh.CalculatePath
    - Physics.Raycast ( AIUtil.IsInSight call to IsObstructed method)

    Code (CSharp):
    1.    public static void ApproachACovered(AIController controller, ref AISituation situation)
    2.         {
    3.             for (int a = 0; a < 18; a++)
    4.             {
    5.                 var angle = coverAngle - 180f + a * 10;
    6.      
    7.                 NavMeshHit hit;
    8.                 if (NavMesh.SamplePosition(position, out hit, 1.0f, NavMesh.AllAreas) &&
    9.                     AIUtil.IsInSight(controller, hit.position, situation.ThreatStandingTopPosition))
    10.                 {
    11.                     NavMesh.CalculatePath(controller.transform.position, hit.position, NavMesh.AllAreas, path);
    12.  
    13.                   ...
    14.                    ...
    15.  
    16.                     }
    17.                 }
    18.             }
    19.  
    20.          ...
    21.  
    22.         }
    The plugin should have this number as a parameter to let us tweak the value for better performance.

    Some possible optimisation :

    1) Separating Navmesh and Physic.Raycast in a task shedule system

    When the AI calls "ApproachACovered" , this call a shedule system that calculate for example 1 Physic.raycast each 5 frames for example (same for Navmesh functions).
    Once all 18 results are calculated, the task system returns it ot the AI, so the AI can continue to another beahviour.

    2) Using a grid of points instead of making 18 raycast on 180°
    Creating a virtual grid of positions like 8 positions around the character, the AI can already navigate , you can define the grid how it is positionned in front, sides or around the player for movement.
    This could also be combined with a task shedule system as it will also use Physics.Raycats for los checking.

    3) Use A* pathfinding plugin

    It is multi threaded, lot more efficient than Unity navmesh and you can use multiple systems.


    And simply let use choose a parameter number of raycast we want to make, there is no need to make 18 raycasts to find a good path, it can work with 5 to 10.

    Anyway, there is some update in the works, and perhaps some parts like this one will get some improvments.
     
    Last edited: Nov 5, 2017
  14. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    @Ukvedys can you give us an update on what’s next ?
     
  15. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Im trying to position the gun so it doesnt overlap my guys hat, when I move TallCoverRight the left hand moves, but when I adjust TallCoverLeft the other hand wont do the same, is it meant to ?

    Another strange thing is as I move the camera around in the editor, sometimes the hands jump to a different position, anyone seen that?
     
    Last edited: Nov 5, 2017
  16. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Also how would you fix something like the gun going through the leg, when I use different models, the hand holding the gun is going through the thigh of the character, but im not sure how to fix that sort of thing.
     
  17. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    HI,

    To fix that you need to change animation. do you have expierence with maya or 3d max or motion builder? these can modify fbx files. maybe even Blender can do that.?
     
  18. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    HI,

    We working on Big AI patch that supported by our new client. we will give you smaller version soon. where we adapt AI for the bigger patch. Also we will give you our game tools that we added to 2.5d Platformer to move platforms enable disable objects. collect objects etc.
    Will write more about that in couple days. Future is bright!
     
  19. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
  20. AshyB

    AshyB

    Joined:
    Aug 9, 2012
    Posts:
    191
    Your hands and gun going through things is completely dependent on your character, bones and animations used.

    For tall cover left/right did you assign the transforms?

    The thing where the hands change based on camera is to do with this asset. I get it too. Haven't needed to fix it myself yet but if i ever do i'll let you know how
     
    Last edited: Nov 6, 2017
  21. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Hi @Ukvedys

    About the next release, will you allow us to use our own player system and controller and get it working with your AI system ?
    For example i have an Fps project with my own controller and i only need your AI system to work with it.
     
  22. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    We plan to release just AI so it will be possible for you use any controller. And you dont need to buy separate package. third person or top down will have same AI
     
    Last edited: Nov 7, 2017
    angel_m and Mayureshete like this.
  23. Mayureshete

    Mayureshete

    Joined:
    Jan 18, 2014
    Posts:
    198
    thats awesome...
     
  24. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Ok, sounds good. I hope this won't impact existing users and force them to buy some additionnal package :rolleyes:
     
    f1chris likes this.
  25. Deleted User

    Deleted User

    Guest

    I purchased this asset. and am having problems converting the .fbx animations files to an earlier version,.....What version are these files in? and if I send invoice number, can you batch convert to an earlier ,fbx version...I am using the last version of the stand alone .fbx converter, all of your files error out, on conversion..I am trying to avoid opening each one, and converting with maya LT..my end goal is getting them in an older version of motionbuilder, 7.5, for Stored Takes..

    hoping.....

    Patrick
     
  26. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    HI sure send me invoice I will try to find a solution for your 7.5 motion builder.
     
  27. Mayureshete

    Mayureshete

    Joined:
    Jan 18, 2014
    Posts:
    198
    i think he meant to release just AI package who just like the ai and dnt want to buy the whole third person cover controller
     
  28. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    Yes. but you will have same AI if you have Third person cover or topdown.
     
    zenGarden likes this.
  29. tamzi

    tamzi

    Joined:
    Sep 22, 2014
    Posts:
    6
    i dpnt know if this was and has been asked here. BUt of i own TDCS Mobile and i wish to upgrade to TPCS do i lose the TDCS or do i get to own both?

    I have never upgraded an asset so i would not know. Thank you for your replies.
     
  30. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    You will get both once you upgrade.
     
  31. tamzi

    tamzi

    Joined:
    Sep 22, 2014
    Posts:
    6

    Upgrading......



    DONE.
    I am now a member of RedBee.(Full)
     
    EduardasFunka likes this.
  32. Deleted User

    Deleted User

    Guest

    I started a private conversation with you, sorry to bother you again , I already took the day converting/exporting to motionbuilder..sorry, just forget it...thanks P-
     
  33. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Prototype characters ready for AI plugin and performance testing.
     
    Last edited: Nov 9, 2017
    EduardasFunka likes this.
  34. somosky

    somosky

    Joined:
    Feb 15, 2014
    Posts:
    138
    Hi I'm thinking about picking up this project. Is there controller support (Xbox) out of the box or would I need to add that support in?
     
  35. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    HI
    we did not map any controller. It is up to you guys to adapt to your games
     
    f1chris likes this.
  36. somosky

    somosky

    Joined:
    Feb 15, 2014
    Posts:
    138
    So I'm looking at the Third Person Controller script and it looks like most of the input is located in there with KeyCodes so essentially what I need to do is change the code from Keys input to Button input and then setup my input names is that correct?
     
  37. somosky

    somosky

    Joined:
    Feb 15, 2014
    Posts:
    138
    So why did you decide to code everything with Keycode as opposed to Buttons? If anyone wants to change anything in the project you have to recode the Third Person Controller script as opposed to having to just change the Input Manager. Also what scripts control the Zoom and Firing of the guns? I want to add controller support and have to change the input from Mouse 0 and 1 to my buttons I've created in the input manager. I've got movement working properly I can't seem to figure out what scripts control the zooming and firing though. Thanks.
     
  38. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Has anyone tried using this with RFPS? I'm giving it a try, but it may not be as straightforward as I hoped so I'm wondering if anyone has some advice.

    [EDIT]
    I've gotten it to where the AI can damage RFPS player now so I think I can get the other part now as well.

    [EDIT]
    I was able to get it all working. A bity tricky, but working good.
     
    Last edited: Nov 13, 2017
    GWStudio likes this.
  39. Luistrotamundos

    Luistrotamundos

    Joined:
    Mar 9, 2017
    Posts:
    17
    anyone knows how to contact developers. I sent them an email and they do not respond
     
  40. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    Hey Goodmorning sorry was away on weekend. Check your email soon going through support now.
     
    Luistrotamundos likes this.
  41. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    Zooming and firing is controlled in the same third person controller script. All inputs to the CharacterMotor are done via methods that start with the word Input, like motor.InputFire(), motor.InputReload() and so on. You can search for those and modify the script.
    However, we have actually changed how the input works in the upcoming version of the asset. All of the input code will be in a specific input class and more flexible to change, stay tuned.
     
    zenGarden likes this.
  42. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    When are you planning to upload the new update ? It will be AI rework and the new input system ? New features as well ?
     
  43. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    I understood :
    1) Ai will get improved
    2) Input will be separated from character motor : you can use your own input control
    3) AI will be available as separate package without player ; to let you use your own player system and controller.

    About new features i wish there was other AI common types like melee berserk, pump gun guy, missile launcher, AI not using covers like big robots lol
     
  44. Matt3D

    Matt3D

    Joined:
    Apr 12, 2013
    Posts:
    32
    @EduardasFunka

    So I think the purpose of this system is meant to be a starting point for third person cover games, everyone who buys this will need to modify and/or add to the system to suit their needs, as every game is different. And right now I see a alot of requests in this topic for more specific functionality other users need for their games.

    One feature you just pointed out users have to do themselves is controller input for example.

    More functionality is of course a good thing, but for example the AI and networking features you are working on aren’t needed for the game I’m working on. You could endlessly add to this system new features users request.

    Therefore I think focusing on customization/extending the system, such as implementing events as requested earlier so we can call our own code rather than modifying your source code should be a priority. And perhaps adding in options to change/disable features users may not want.

    For example
    -crouching as toggle or hold
    -disabling the grenade throwing
    -disabling the weapons (my game for example has no guns)
     
    Last edited: Nov 14, 2017
  45. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    @EduardasFunka I'm trying to set up my own AI agent, but he's not working as I would expect. I'm following the character setup video and filling in the gaps by analyzing the existing AI prefab because there isn't a video on setting up AI. My AI looks pretty much like the prefab AI, but doesn't have weapons yet. The problem I am seeing is that the AI runs up to the player and starts bumping into him. After a few of these bumps, the AI ends up on the ground horizontal and never recovers. It just runs around flat on the ground and spasms.

    upload_2017-11-13_6-48-14.png

    It's hard to tell what's wrong since the video doesn't cover setting up AI at all. Also, I have to criticize the video because it's very hard to follow because the entire time you are just mumbling like you're talking to yourself. I really can't understand a word you're saying so I had to pay close attention to what you were clicking on and so forth.
     
  46. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I found out that the issue happens really quick if the AI tries to run up any slope in the terrain. Here is a video.

     
  47. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    The plugin exampels runs on horizontal floors, perhaps something has not been tested like terrain.
    It is not some terrain issue with layer setup or some raycast problem ?
     
  48. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    No, I thought about that too, but if I drop in the prefab AI it runs around fine on terrain and never falls down.
     
  49. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Can you just lock the rotations on the rigidbody?
     
  50. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Good idea. Maybe that's what the prefab AI is doing. I can't try it now, but will give it a try tonight. Thanks for the idea.

    [EDIT]
    That was it. I didn't even think to check that. It would be nice if there was documentation on setting up AI. Anyway, thanks for helping. It is much appreciated.
     
    Last edited: Nov 14, 2017