• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by Kethis Celebes · Feb 25, 2010 at 07:06 PM · ai

Rapidly training a physics-dependent AI in Unity? (unsupervised neural network/genetic algorithm mix)

Let us say that I have some problem within unity that I would like an AI to solve. Let us further say that it is the type where a learning/evolutionary approach is superior to breaking decision hierarchies (like AngryAnt's Behave) or HFSMs in general. How best can I evolve/train the AI in Unity? I am concerned about the overhead of such a process - I can run 10,000 generations to find the global optima of a 2^32 * 2^32 search space in a couple of seconds on my home computer, but doubt Unity could do the same because of how long a fitness evaluation would take.

Application scenario:

In the specific example I am thinking of, I have an artillery gun and an airship. The airship tries to dodge incoming fire from the artillery, and the artillery gun of course tries to shoot down the airship. For purposes of training the AI, the airship remains in some large torus, which is strictly inside the artillery's effective range.

The airship's up/down axis is controlled by a ballast effect (think dirigible). It can apply thrust forward and backwards, and incrementally change the direction of that thrust (within a range). It has drag and (at the moment) always remains straight up/down, only turning on its up/down (y) axis.

The artillery gun fires a shell. This shell explodes under one of two circumstances. The first of these is whenever a raycast along its direction vector within, say, 20 meters returns true. The criteria for the second circumstance the shell will explode is two part. First the shell must pass within, say, 10 meters of the airship. Second, it will explode whenever its distance of the airship is further away this frame then it was last frame.

Whenever the shell explodes it sends, say, 8 pieces of shrapnel in front of it randomly within a 30 degree cone. This shrapnel explodes on contact and moves extremely fast.

The shrapnel and the shell explosion itself both deal damage to the airship, as a linear drop off function. (Id prefer linear+exponential dropoff, but lets keep things 'simple')

I want to do unsupervised learning. I was thinking about running an ANN (artificial neural network) whose weights are genetically evolved.

Assuming that there is no delay in the artillery gun's aiming, the inputs on both of my ANNs seem to need to be position vector of airship relative to artillery, velocity vector of airship (both local space). This gives me 6 inputs. The fitness of course is how much damage is dealt (or not, from the airship's perspective). Possibly the airship could take the position & velocity vectors of the incoming shell as inputs as well. Because of the ballast effect, the delta of y axis movement scaled to the frame rate could be used as an input as well. That is as many as 13 inputs.

I was thinking about alternatively evolving one then the other... but right now the laptop Im doing my Unity development on has 512 RAM (you may laugh, or cry, whichever you feel appropriate) and fear that each fitness call would take a second or two if not implemented cleverly.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Motionreactor · Feb 26, 2010 at 01:09 PM 0
Share

Does the system have to re-learn each time the 'game' runs? Can you not do a one off pre-calc and save the results as a kind of knowledge database?

I also wonder if you are over complicating a problem. Is this for a game? What is the application context? ie, does it actually need such deep AI integrity (research paper?)?

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Ricardo · Feb 26, 2010 at 12:23 PM

Seems more like thinking out loud than a question, but still...

You may want to look into Ken Stanley's NEAT and HyperNEAT, as there is a C# implementation that you could plug into Unity. As to your hardware limitations, this approach is hardly computationally inexpensive, so you may find it at odds with your box plus running it within Unity.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Good refernce material for logic behind ai 0 Answers

some problems with my ai 1 Answer

simple AI - Beginner question 2 Answers

Enemy AI monster problem 3 Answers

Trouble with turret script 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges