create a deep neural network ai inside of roblox LUA using this script "local AIBody =…
- User
create a deep neural network ai inside of roblox LUA using this script "local AIBody = script.Parent -- this will be used in the deep neural network -- bodyvelocity local movement = Instance.new("BodyVelocity") movement.Parent = AIBody movement.MaxForce = Vector3.new(math.huge,math.huge,math.huge) movement.Velocity = Vector3.new(0,0,0) -- get the finish line local finishingPart = game.Workspace:WaitForChild("Finish") -- this will be used in the deep neural network as an input -- shoots 5 rays local distance = (AIBody.Position - finishingPart.Position).Magnitude -- this will be used in the deep neural network as an input local params = RaycastParams.new() params.FilterType = Enum.RaycastFilterType.Blacklist params.FilterDescendantsInstances = {workspace.Baseplate} local directionEMLR = script.Parent.EvenMoreLeftRay.Position - AIBody.Position local directionLR = script.Parent.LeftRay.Position - AIBody.Position local directionMR = script.Parent.MiddleRay.Position - AIBody.Position local directionRR = script.Parent.RightRay.Position - AIBody.Position local directionEMRR = script.Parent.EvenMoreRightRay.Position - AIBody.Position local ray1 = workspace:Raycast(AIBody.Position,directionEMLR,params) -- this will be used in the deep neural network as an input local ray2 = workspace:Raycast(AIBody.Position,directionLR,params) -- this will be used in the deep neural network as an input local ray3 = workspace:Raycast(AIBody.Position,directionMR,params) -- this will be used in the deep neural network as an input local ray4 = workspace:Raycast(AIBody.Position,directionRR,params) -- this will be used in the deep neural network as an input local ray5 = workspace:Raycast(AIBody.Position,directionEMRR,params) -- this will be used in the deep neural network as an input -- movement functions local function RotateLeft() -- this will be used in the deep neural network as an Output AIBody.CFrame = AIBody.CFrame * CFrame.Angles(0,math.rad(5),0) end local function RotateRight() -- this will be used in the deep neural network as an Output AIBody.CFrame = AIBody.CFrame * CFrame.Angles(0,math.rad(-5),0) end local function MoveFoward() -- this will be used in the deep neural network as an Output movement.Velocity = AIBody.CFrame.LookVector * 10 end local function MoveBackward() -- this will be used in the deep neural network as an Output movement.Velocity = AIBody.CFrame.LookVector * -10 end local function StopMoving() -- this will be used in the deep neural network as an Output movement.Velocity = Vector3.new(0,0,0) end" (you will use this script to make the deep neural network / DNN) ive marked some stuff that will be used as inputs and outputs. if the ai is 5 studs away from the finish line then it gets a big reward and it restarts. the ai also restarts after 10 seconds. make sure the ai actually works. the ai should learn from his previous mistakes. the ai gets a reward for being close to the finish line. the ai gets less reward if its near any bad parts located in the workspace.BadParts. (5 studs away from it) it should use the rewards so that it would know if its doing good. the ai should use the rays as his vision. print out their reward. and they stop moving forward when one of the rays tell them their 0.5 studs away from a wall or something. (THIS SHOULD BE A REAL WORKING NEURAL NETWORK USING Q LEARNING) you should create everything for me ALSO REMEMBER TO PUT THE LOOP INSIDE A SPAWN FUNCTION AND USES TASK.WAIT INSTEAD OF WAIT
- Assistant