The source for the project I made for my AMAZE Driving-Characters-in-PhysX Talk

edited in Tutorials
image

I gave a talk at AMAZE JHB on building characters in Unity and driving them with PhysX.

Like I said during the talk, as I navigated through the example project I'd built, there's loads of ways to configure joints and forces to produce gameplay, I was just showing off one way to do it.

That said, here's the Unity 5.4 project for anyone who's interested to paw through and meddle with and (hopefully) learn from. I had a request afterward for the source, and it seemed to a helpful thing to do.

http://www.callofthevoid.com/AMAZE/AMAZE_PHYSX_TALK_How_To_Dematerialize_Completely.zip

The project has a couple of scenes in it, as seen in the talk at A MAZE. The final scenes have two characters that can walk around in them, and there's a kind of faceplant jump that they can do. It's very simple, but hopefully it provides an idea of how a PhysX driven character might be constructed.

I'd of course be super stoked if anyone built upon this project (please show me if you do). There's a little bit of code in there that is common in Free Lives projects, but I presume everyone who contributed to it is happy for it to be reused. Please use this project in whatever way you wish.

image

For anyone who wants to use this code in a commercial project, and needs all the legalities squared away, you may use this under the Creative Commons Attribution 4.0 International License. You can read the full license here.

Basically: You can use this code in whatever commercial product you like, and make whatever changes you like, but mention me in the credits (Evan Greenwood), and mention if you modified the code. And also include a link to the license: https://creativecommons.org/licenses/by/4.0/legalcode

(Don't worry about this legal stuff if you don't have to, it's just here in case it's needed, one person actually did need it)

Comments

  • Hmmm... I wonder how well 100 of these little guys would perform ;)
  • Awesome! Thanks so much Evan. I actually meant to ask if you were still planning on releasing this.

    I can't wait to play around with it! :D
  • Thanks for releasing this, the directory and file structure is very neat. :)
  • Hey Evan thanks for letting me steal your lighting setup :) Very nicely put scenes to see the differences!
  • edited
    Not nearly 100, but 26 characters fit in that ring alright:

    image

    This would be a lot better of course if collisions with other characters knocked characters down (I mean if there was more interaction between them).
  • Was the talk recorded by any chance? Would love to watch it.
  • It was I think. Though based on previous A MAZE events, it takes a few months for them to go up.
  • Awesome thanks!
  • @vince Our recording camera was stolen, so no recordings this year :/.
  • Nooooooo! Haha it's cool thanks for letting me know. Playing around with the project and although a little unsure in places, I am finding my way around.
  • edited
    Stoked! Der_Kevin (on twitter) already made a small game with it! https://twitter.com/Der_Kevin/status/776795125498404864

    image
    Thanked by 2blacksheepZA Moga
  • Not nearly 100, but 26 characters fit in that ring alright:

    image

    This would be a lot better of course if collisions with other characters knocked characters down (I mean if there was more interaction between them).
    It looks oddly satisfying...
    Thanked by 1Moga
  • jackshiels said:
    It looks oddly satisfying...
    That might not seem that odd when you consider an entire entertainment industry (American Wrestling) is built on big dudes jumping on top of other big dudes.
  • Thank you for doing this @EvanGreenwood , are there any slides from the event or on Goose Stepping ?
  • edited
    jackshiels said:
    It looks oddly satisfying...
    That might not seem that odd when you consider an entire entertainment industry (American Wrestling) is built on big dudes jumping on top of other big dudes.
    o.0

    Still waiting to see a release of that minigame you showcased at EGE.
  • edited
    Super necro, but thanks a lot for this @EvanGreenwood! Made a quick prototype of physics based mech legs, although I'm not sure that is what it looks like :P

    image

    p.s. Candle Light's "Custom Handles" is no longer around, but the latest Unity beta has built in support for showing joint restrictions.
    Thanked by 2Moga NickCuthbert
  • Oh rad! That's a cool jiggly thing!

    That looks a lot like a plumbus btw image
    Thanked by 2notsimon207 Moga
  • Thank you. Going to do a magic trick with it today / tomorrow.
    Thanked by 1EvanGreenwood
  • Thanks for your lecture and sharing your knowledge with the gamedev community. Mr Evan, I am actually trying to make some mobile game based on your lecture. Hope you will like the final effect, please check the gif https://gfycat.com/WellmadeYellowEagle
    Thanked by 2roguecode konman
  • @roguecode thanks haha! It is a pure fun to create this small game :D
  • edited
    @Dummy Damn that's cool!! I love the post-apocalyptic fog and the background. The slow motion attacks are super stylish!

    I really hope you work on this further, it looks super rad!

    These cool uses of the talk/sourcecode make me want to do more talks like this :)
  • edited
    @EvanGreenwood here you can see some more action https://gfycat.com/PartialGrossAuklet and some funny death at the end ;-) You inspired me to create some physic-based simple game and I am really glad to read that you like it. In the future I wish I could create such a fantastic and unique games as you do.
    EDIT: I forgot to add the special attack as well https://gfycat.com/CorruptGroundedCanary ;-)
  • That's super cool!

    Have you seen One Finger Death Punch? It does this type of gameplay super well. Love that the badguys all drop piles of cash... Planning on putting in upgrades?
  • I know One Finger DP, an awesome game. I am thinking about some small but fun upgrades like leaving a grenade after death, probably different weapons/skins/special attacks. Will share the beta and the release here for sure so you can test it :)
  • Looking forward to trying it out!

    Obviously share when you feel ready, but I'd point out that early feedback is useful and it's much easier to perfect something if you've tested it (i.e. being a perfectionist is only useful if you actually know what 'perfect' would be).

    Also, if the core of it is good it's easy to get people to try it again. If the core isn't good then spending lots of time tweaking the frills to 'perfection' won't be a good use of time.

    I'm saying this as a serial perfectionist :)

    Also, hope I'm not coming across as condescending, I don't know your level of experience.
  • @EvanGreenwood I know you're a busy guy but if you have any iPhone device and some time I would be really glad to send you the actual build, so you can check the feeling of the game. I am following you on the twitter (@tap_hero) so maybe chatting there about the test would be an option :-)
  • Can you do an Android build?
  • edited
    Unfortunately I am fighting with the optimisation.

    I have pretty good results on the iphone devices (I've reduced drawcalls by baking meshes and added some faked shadows). On the android still the physics is quite consuming. I am focused on the appstore at first, will try to fight for the next world-wide feature :)

    It is not possible for you to check it on the iOS?
  • I have one colleague with an iPhone... But as I understand it the process of getting a build onto an iPhone is a bit involved, it's not as simple as copying the build across. (I haven't done mobile game development in years :/ )
  • edited
    You're right, android is only sending the build file. In the iOS I need the UDID number of the iphone (it is visible in the iTunes, so you have to attach the mobile to the mac) and then I can add the device to my profile and create some adhoc build. Little bit more annoying but I got used to it.

    @EvanGreenwood if you would like something for the android, I can send you a really fun "sandbox" boxing I made with your character movement. It will be my next game for the mobile :-)
    EDIT: I've sent you the private message
  • @EvanGreenwood
    Thank you so much for the project, although I could not find a video recording of the talk, the project file helped me a lot.

    I used a lot of concepts that were in the project to build a prototype for a physics based fighting game. It uses control scheme similar to that of gang beasts, but the player can move each hands independently in any direction they want, so this allows the player to do various kinds of slams, throws, pull, push and fling after grabbing the opponent.

    I also added a climb system and a grapple hook system to the character controller, right now I am still exploring fun things that can be done with this character controller.

    I also made a game based on this character controller for Ludum Dare 40 game jam, https://ldjam.com/events/ludum-dare/40/house-party
    Some Gifs of initial prototype
    https://gfycat.com/@richard141289/library
    Itch.io page
    https://richarddilip.itch.io/house-party

    Once again thank you so much for sharing the project.
  • @richard141289 That's sooo freaking rad!

    Nice work as well on the characters. And I love that grabbing and punching. The punching in particular is really well "animated" :)

    Thanks for sharing your work. Are you thinking of going further with this project?
  • @EvanGreenwood Thank you so much. For punching animation, the wind up pose is done by setting the Target Rotation property of the configurable joints, and then I add force to the hand to punch.
    I will be going further with developing the character controller, by adding more animations, and experimenting with different types of movement, like swinging, wall crawling etc. as for games, I am currently working on a multiplayer fighting game like powerstone, using this character controller.
  • Stretch Armstrong!!! Sorry, had to :D

    I love the sort of Noby Noby Boy texture look of things. Looks so rad! Please keep going
  • @richard141289 oh hey! Didn't know this was a SA thing! I asked for a mac build on LD to no reply :) The system looks really cool, would love to give it a try :)
  • @EvanGreenwood Hi, I am back with some progress regarding to the game I posted in this topic. I am working on the main screen, still the work is in progress but wanted to make a little show off (need to make 2 skins for the 4th backgroung, add shadows on the last one and make the rest of the UI xD). https://gfycat.com/HideousPartialDinosaur
  • edited
    @Dummy That's looking super cool! I love the attention to detail in the environments.

    Is this a level select then?
  • @EvanGreenwood this will be connected with the main screen. You can see the entry at the beginning, it will be played once when you turn on the game. I am going to add some play/options buttons and then immediate gameplay will begin :) I had the biggest fun with your characters, now it is a boring phase hehe
  • Ricard. If you dont mind sharing. How did get the hands to grip and move freely on this?
    @EvanGreenwood
    Thank you so much for the project, although I could not find a video recording of the talk, the project file helped me a lot.

    I used a lot of concepts that were in the project to build a prototype for a physics based fighting game. It uses control scheme similar to that of gang beasts, but the player can move each hands independently in any direction they want, so this allows the player to do various kinds of slams, throws, pull, push and fling after grabbing the opponent.

    I also added a climb system and a grapple hook system to the character controller, right now I am still exploring fun things that can be done with this character controller.

    I also made a game based on this character controller for Ludum Dare 40 game jam, https://ldjam.com/events/ludum-dare/40/house-party
    Some Gifs of initial prototype
    https://gfycat.com/@richard141289/library
    Itch.io page
    https://richarddilip.itch.io/house-party

    Once again thank you so much for sharing the project.
  • edited
    @EvanGreenwood I have finished the game, it will be released on 3 May. Thank you for the inspiration :-) here is the app preview of the game Going to make some more fun prototypes based on it. Hope someday making so fun games as you do :)
  • This looks rad! I love the arrow thing you've got going for control instead of driving the character directly (at least that what it looks like).
  • That's super rad! Where can I get the game on May 3rd?
  • @EvanGreenwood it will be available in the AppStore, actually there is a pre-order now https://itunes.apple.com/us/app/agent-wonky/id1336941594?l=pl&ls=1&mt=8 I am really glad you like the apppreview :-)
  • edited
    my game will be released next week :O
    one more thanks to @EvanGreenwood xD
  • Hey guys!
    First off I just want to say thank you to @EvanGreenwood for the talk and for providing this amazing project and source code. Secondly I just want to say congratulations to @dummy for the game release!

    @dummy I just wanted to ask you: how did you code the spin move that the guys with the masks have on do? I have been trying to do something similar using AddTorque on the chestBody but its not working and I am at a complete stand still. Could you please share how you got the move working? I would be ever so grateful if you could show a snippet of your source code or even just wrote down some pointers in here!

    Thanks again and I hope I can get a little game out in this style to show you guys soon!
  • edited
    @Chajies One of the things to bear in mind with AddToque is that rigidbodies have a maximum angular velocity... adding torque doesn't do much if the amount of torque added would for a single frame increase the angular velocity above the maximum (because it gets clamped).

    You can get much faster spins if you increase the maximum angular velocity, the default is 7, so "rigidbody.maximumAngularVelocity = 100;" should allow things to be much faster.

    Another thing to do is increase the maximum just a bit, and then add a smaller torque over a longer period (so a torque multiplied by the delta time over a few seconds). You don't really want your maximum torque to be much higher than necessary (because the other rigidbodies will struggle to keep up, and collisions might cause large angular jiggles).

    You might also want to increase the maximum for all the rigidbodies on the character. (if the whole thing is spinning)... but it's the one that you're adding the torque to is the one that usually has it's torque clamped by Unity.

    Hope that's the problem you're facing (otherwise it might be something to do with your character setup?)
    Thanked by 2konman Chajies
  • jousting on tall poles above a pit of spikes?
    Thanked by 1EvanGreenwood
  • @Moga Sounds good!
    Thanked by 1Moga
  • edited
    About 7 months took me to create next game, this time it is some sort of idle game. Modified the code to fit the core-idea behind it (I have also fixed a bug in walking code, sometimes the character hanged without move). Check out the video, it is still not finished, just a prototype.




    Hope @EvanGreenwood to check the effect and would owe him for a respond :)
    PS. @Chajies I responded in your profile, sorry for the delay.
Sign In or Register to comment.