0 votes

I am making a racing game as I am learning Godot. Naturally, I wanted to have the player race against AI Agents who have the exact same physics/controls as the player. However I am not sure how to best go about doing this. I am not necessarily
looking to hand held answers here. If you could just point me in the right direction, that would be greatly appreciated!

First, should I have created the controller and physics of the player outside of the Player Node? Right now, all of the code that controls the player is within its KinematicBody2D script, but would it have been better to have separated the controls and physics into their own Autoload scripts that the Player, and in turn, the AI reference? Is this just good practice to do so regardless?

Part of my problem is figuring out how to tell the AI to use the Input controls that I've given to the player. The tutorials I find on AI control give the AI very basic physics, which makes sense because the tutorials are limited in scope. However, I don't want the AI to just move at a constant rate, but to use the steering directions, boost input, and other Inputs that make them feel and act like an arcade race car. The input controls affect the physics of the car (such as, if you are boost, then your steering_angle is reduced, making it harder to turn), so it seems vital that the AI uses them.

Finally, if you couldn't tell, I am a beginner in Godot and coding in general. Should I just avoid Player Bots for now and focus on learning the other parts of the system? Would it be better to first get comfortable to make AI that don't mimic the player physics and behavior?

Thank you

in Engine by (18 points)

you posted it two times, delete one

sorry about that, I didn't mean to. I hid the other post.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.