An EV power curve in the browser
/race runs a drivetrain model, not a throttle. Most browser demos fake the drive — a fixed acceleration shove that feels right. This one models the motor, because the motor is part of what the product is.
The curve every EV has
Electric drivetrains have a two-phase character:
v < v_base F = T·G / r traction-limited — flat torque
v > v_base F = P / v power-limited — pull fades with speed
Below base speed the limit is what the wheels can take — constant torque,
constant acceleration. Above it the motor has no more watts to give, so force
falls off as P/v. It's why EVs feel violent at launch and merely strong at
highway speed.
The code
function driveAccel(v: number): number {
return Math.min(LAUNCH_ACCEL, POWER_PER_MASS / Math.max(Math.abs(v), 0.5));
}
One line is the whole curve: min() of the two phases. The constants come
from the vehicle class — a 1:10-scale racer runs ~1 kW on ~3 kg, which is
~330 W/kg. That number sounds wrong until you watch a real car in this class
do a standing backflip off the throttle. Small electric vehicles are the
most power-dense machines on wheels.
The honest ceiling
There is no top-speed clamp worth talking about — the clamp that matters is
physical. Linear drag bleeds speed each frame (v̇ = −k·v), and with the
drag constant tuned for the class, the car finds its own equilibrium at
~24 m/s ≈ 86 km/h: the speed where P/(m·v) exactly equals k·v. Top speed
is a solution to an equation, not a constant in a config file.
That also means the demo degrades honestly — run onto grass and the drag constant triples; the car bogs down to a crawl for the same reason a real one would: the watts run out before the will does.