Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How Would I Train A Neural Network To Avoid Obstacles Around Itself?

Asked by 4 years ago
Edited 4 years ago

I want to create an A.I. that can only walk forward and that can go to the left or right. I can't get around how people are able to get a neural network to learn by itself so that the A.I. doesn't do the same mistake.

Let's say i have an obby I want the A.I. to complete using neural network: https://drive.google.com/open?id=1gQxrQjHfZnDTp584GR6g6wUMxVbBySsh

I added a BooleanValue in the game.Workspace.Dummy named "Completed" and to change to true when it touched the end part. I also tried to understand how a neural network works and came up with something like this:

local input1 = 0
local input2 = 0

local bias1 = 0

local hidden1 = 0
local hidden2 = 0

local output1 = 0
local output2 = 0

wait(5)
repeat

    --[[
        I got stuck in here
    ]]

    game.Workspace.Dummy.Humanoid:MoveTo(game.Workspace.Dummy.HumanoidRootPart.Position + game.Workspace.Dummy.HumanoidRootPart.CFrame.LookVector * 2)
    wait(0.1)
until game.Workspace.Dummy.Completed.Value == true

Could I get some help about how would I train the A.I. to complete the obstacles?

1 answer

Log in to vote
1
Answered by
starmaq 1290 Moderation Voter
4 years ago

Not gonna lie nice stuff you got! This is the first time in a while that I actually so a rather advanced question nice stuff you got!

The Making of a Neural Network

This part is the biggest part, you really just have to learn how to make a nerual network! The part you're interested in is how would you train this bot to avoid obstacles.

Just in case you actually don't know how to make a neural network, here are some good resources! This one is quite complicated! This is a good series! (although its written in Python)

How would you train your neural network?

So, first of all, let's talk about what would you chose an input for your neural network.

I always like to think of the input neurons, as the factor that's changing the final result. For example, if you had a handwritten digits recognition neural network, which is a very common example, the input neurons would be the pixels of the image of the handwritten digit, beacuse if you think about it, the colours of the pixels are the ones that determined how the image looked. Another cool example is, making a neural newtork for a bot that's supposed to shoot a target, the inputs would be the change factors: the looking direction of the bot, and how much time did he charge the bow, these two factors change the landing position of the arrow!

For your case, it's rather simple! This really helped btw!

So, what the inputs would be: 1. go forward 2. go right 3. go left As you would've expected, but an even more complicated question is, how would the neural network even function? How will it make desicions? Because really the go forward right left aren't random values between 0 and 1, they are either 1 meaning do this action or 0 meaning don't do this action, so it's really difficult to know how the layout of the NN would look like. An even harder question is how will you create training inputs for this neural network! You would have to manually make obstacles, which would be painful to do!

So really, the Neural Network idea is cool, but it's just too hard to implement here, I'd suggest you use a simple pathfinding alogorithim or something. Goodluck!

Ad

Answer this question