Skip to content

u/justanotherguyithink

In this archive from Jan 2017 to Aug 2019

17
posts
37
comments
15
media
585
score

Top posts

Top comments

I split it into two aspects, vertical and horizontal. Vertical being the speed and horizontal being the steering.

I decided to use the same system I use to track car position to also guide the AI. Each little yellow square you see is a node on the track. To manage the steering, the car aims towards the next upcoming node, then once it gets close to it (within 20 units) it starts to aim towards the node following the one it was originally aiming for. This gives pretty solid curving.

Speed is managed quite simply. It gets the current position along the nodes, and if it is 3/4 of the way, it gives input to slow down, breaking harder as it get's closer to the corner. Then once it switches nodes puts the foot down again.

The AI controls input rather than directly controlling the car if that makes sense. So it doesn't control the speed, just emulates a player pressing keys etc. This I found plugs easily into my existing car controller, and gives a more realistic aspect which the player can emulate, as the car isn't cheating in terms of faster acceleration.

If this doesn't make sense, let me know. I can't explain things all to well

4 points

Subreddits

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.