Search Unity

Angry AI (ml-agents)

Discussion in 'Made With Unity' started by mbaske, Dec 21, 2018.

  1. mbaske

    mbaske

    Joined:
    Dec 31, 2017
    Posts:
    473
    Fun little machine learning demo.
    https://github.com/mbaske/angry-ai


    EDIT: Updated video link.

    Btw, how do you preserve video quality when uploading Unity footage to Youtube? I used FFmpegOut to export from Unity (1080p/30fps/ProRes422), edited in Premiere and encoded the final video with recommended Youtube settings. Looks nice and crisp on my machine. However after uploading, even 1080p looks somewhat blurry and 720p is just awful. Thanks!
     
    Last edited: Nov 23, 2019
    AskCarol, arjanM, DBarlok and 5 others like this.
  2. ghtx1138

    ghtx1138

    Joined:
    Dec 11, 2017
    Posts:
    114
    Wow! @mbaske this is incredible. And thanks so much for making it available on Github. And you've used Visual Training! Wow again.
    Cheers!
     
  3. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,769
    What a cool cute project. Very well done.
    Wonder why no more responses.

    One more reason, to have forum AI dedicated section.

    How long took your to train them?
     
  4. ghtx1138

    ghtx1138

    Joined:
    Dec 11, 2017
    Posts:
    114
    @Antypodish Yes it needs more awareness. @mbaske what about posting it on Reddit Unity3d and Reddit Machine learning? https://www.reddit.com/r/Unity3D/ https://www.reddit.com/r/MachineLearning/

    Also maybe change the Title of the post to "Humans will have no chance in the coming battle with weaponized AI. Here's Proof. Start packing your stuff for Mars." :)

    PS
    1: Sorry I don't know how to get good Youtube results
    2: Yes a dedicated AI forum is a great idea and certainly would help Unity promote this exciting part of their product
     
  5. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,769
    Some of use, including me, already asked for AI forum section. No avail so far.

    Problem is, many cool project on youtube are burred down, due to bigger channels, and paid add campaigns.
    So unless you promote, or have followers, is hard to have exposure.

    As idea sounds good, unfortunately I am not getting involved, since this is another forum and another distraction for me. I spend too much time here already :D
     
  6. mbaske

    mbaske

    Joined:
    Dec 31, 2017
    Posts:
    473
    Thank you! I agree a dedicated forum section would be great.
    @ghtx1138 Thanks for pointing out the subreddits - and the title suggestion ;) Need to look into that...
    @Antypodish The bots use 3 brains layered on top of each other. The one that controls walking took the longest to train, around 3M steps with 20 agents. I usually interrupt training a couple of times to tweak difficulty and rewards a little, depending on what skills to focus on. Like walking speed vs getting up again after being knocked down.
     
    Antypodish likes this.
  7. ghtx1138

    ghtx1138

    Joined:
    Dec 11, 2017
    Posts:
    114
    Hey @mbaske

    Did you know of this guy? https://www.reddit.com/r/Unity3D/comments/8jhksl/i_made_a_mechanical_tentacle_monster_using_only/

    His video went crazy viral and he was featured on 80.lv

    I think your work is much more impressive - and not the least because you have made it available under Apache on github. People were "screaming" for tutorials on that Reddit thread. But maybe ML is too hard for people who want the "instant art button".

    Here's a link to how to embed gifs in Reddit (I saw your post) https://www.reddit.com/r/redesign/comments/80hlz6/add_inline_images_gifs_and_videos_to_your_posts/

    Maybe you need a embedded gif of a 3rd person controller running from your Angrys to get attention?

    I'm not sure what you want to do and please forgive me if I am talking too much.

    Maybe you could break up your project into bite-size tutorials and a self contained package of PF_FighterBot so people can "simply" import it into their project (not sure how the targetting works yet) . Maybe on the Asset Store? Maybe a book or website :) Maybe a Patreon page so people can support you to train more sophisticated Brains?

    Part of the problem I think is that Unity has encouraged the use of the words "AI" for many years and people don't really know what is the difference between old AI and new ML-AI. That guy was a bit not so forthcoming how he did his "procedural animation" - and despite promising to tell people how he did it he hasn't not done so as far as I can tell.

    I'm learning and trying to understand how your project is working but it is a big project and complicated for me. Here is what I understand so far:
    - "rigging" an imported model from Blender with colliders and joints (how on earth did you break apart that mesh?)
    - some kind of walking/locomotion script (haven't worked that out yet) for the imported model
    - depth sense collision avoidance (this blows my mind)
    - build a training environment and learn the walking collision avoidance brain model
    - scripts to build an arena and random falling blocks
    - the sweetest MouseControl camera controller I have ever seen
    - combining three brains into hours of fun for the whole family including Grandma

    There is so much goodness in this project and you clearly know your stuff. Anyhows enough of my fan-boy ranting.

    Cheers
     
    mbaske likes this.
  8. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,769
    While mechanical tentacle monster looks indeed cool, is not that complex in principles, as it may appears so.
    Its each of tentacles are at most operated as 3D IK. Maybe even 2D IK.
    You could relatively easily achieve such effect, with Bio-IK, or similar Asset.
    Then it probably uses Bezier line techniques for each tentacle.
    Then tentacle is rather simple algorithm, since you just need pointer of end defector of attacking tentacle.
    Finding and tracking target perhaps is rather simple, since this techniques are known for years.

    Camera need no comments of course.

    Despite anything, character perhaps is most complex of all.
    Providing animations are sorted, it appears, character grips dedicated colliers.


    In Angry AI, I love how cameras has been utilized, to track targets.
    This otherwise, is considered as relatively CPU expensive technique, in comparison to position checks, or even bunch of raycasts. But we have quite powerful machines this days and tensor flow is very well optimized, as far I am concerned.
     
  9. dragonstonguegames

    dragonstonguegames

    Joined:
    Nov 15, 2018
    Posts:
    2
    Thanks for sharing this. I'm going to have to delve a bit deeper into this space, I've worked with tensorflow on image processing and neural machine translation and just released my first Unity game a vertical shooter https://play.google.com/store/apps/details?id=com.dragonstonguegames . I'll have to work out a way to incorporate more advanced AI for the enemy ships in my next version.
     
  10. mbaske

    mbaske

    Joined:
    Dec 31, 2017
    Posts:
    473
    @ghtx1138 Thanks a lot for your kind words and suggestions. I'm actually a casual Unity user with a background in Flash/Actionscript3 development. I started looking into Unity because I was interested in machine learning, rather than game dev in particular. Anyway, let me know if I can break down any aspects of the project. Regarding locomotion, it's really just a couple of joints being controlled by the model output. I built the robot skeleton with primitives and later added the meshes as child objects.
    Wow, I would love to see the source files for this.
    The cams are indeed the biggest performance bottle-neck, especially in combination with depth and motion vectors textures. However, using visual observations was what I was going for with this project, so I kept them. But yeah, raycasts would be more efficient and probably better suited to train the model.
     
  11. nguyen_linhchi_07

    nguyen_linhchi_07

    Joined:
    May 5, 2019
    Posts:
    1
    @mbaske I sent you a message on machine learning and drone simulation, I hope you see it
     
  12. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,769
    @mbaske
    Any reason why original video of Angry-AI bots V1 is unavailable?
     
  13. mbaske

    mbaske

    Joined:
    Dec 31, 2017
    Posts:
    473
    I was trying to replace the audio in youtube's video manager. Now the video is stuck in processing limbo since a couple of days and I didn't get any response from support yet. I think I'll just reupload it...
     
    Antypodish likes this.
  14. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,769
    Just out of interest, was any issue with an audio? As far I am aware, it was fit to the presentation.
     
  15. mbaske

    mbaske

    Joined:
    Dec 31, 2017
    Posts:
    473
    While reading up on music licences the other day, I noticed I'd better not use that particular track.
     
    Antypodish likes this.
  16. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,769
    mbaske likes this.
  17. mbaske

    mbaske

    Joined:
    Dec 31, 2017
    Posts:
    473
    Antypodish likes this.