Car engine "simulation" [Customizable with code]

This is a dyno graph;

In the car scene, it shows us two very important things: the progression of engine power and torque with the engine speed. This information is used to ensure consistent power delivery and deduce how powerful a vehicle is.

So why am I telling you this? Well, have you ever wanted to look at dyno graphs in makecode with a fake simulated engine to match? No? Well I made it anyway - this is a project I made out of boredom a few months ago and I was planning to turn it into something a little bigger but I never got around to it so I figured I’d release what I’ve already made.

Controls

B button - ignition (hold ~1sec to start the engine; press to turn it off)
A button - add throttle
- change gears (currently useless)

Try it out yourself! It’s fun to rev the engine and watch it bounce off the limiter. The engine even makes a sound that’s relative to the engine speed.

Customization

I mentioned customization in the title, and while it’s true, it’s not super convenient. You do need to edit the game code in JavaScript but damn near every line of code has been documented with comments to make it easier to do so. If you want to mess around my suggestion would be to increase the limiter value (all of them) and change the sound of the engine by selecting a different wave type. Just don’t forget to add new values in the power curve table and extend the graph size in the constructGraph function :]

I’m curious to see what people will do with this. Maybe nobody will care, but as usual all the code is free to use in your games and projects! If you want to modify it or make something cool and you need help understanding the code feel free to ask and I’ll try to answer (as long as I’m on the forum that day, lol)

Until next time!

10 Likes