Questions about how I should approach creating Player Bots (offline play)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By cardboard_bones

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

you posted it two times, delete one

Shlopynoobnoob | 2020-10-01 20:16

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

cardboard_bones | 2020-10-01 22:08