r/threejs • • 5d ago

Demo Open Source 400hz sim racer running in web gpu

Post image

The pre demo version of probably the most advanced sim racer running in web gpu is available in itch.io with the name Open Grid or through GitHub or directly in: https://open-grid.racing

I would really appreciate it if you can give me some feedback on features and bugs the game has and also your opinion on if you would like to see this game getting finalized. You can also contribute to the game directly through my GitHub: https://github.com/Konstantinos-Chatzistavrou/Open-Grid

Don't forget to star the repo to stay updated with any updates because this project is only 5 weeks old.

Don't be too harsh 😅, thank you!

17 Upvotes

14 comments sorted by

1

u/Infinite_Throat4432 2d ago

the z-fighting is insane, the sound is off putting and the shaders are a bit weird i think in general it does the job of acting as a racing game but none of the aspects are done to a level that's relevant to be played?

1

u/kochas231 2d ago edited 2d ago

Correct that's exactly why I haven't released it anywhere major yet and only on itch.io. As the post says this is a pre demo that is just a very early demonstration of what's possible inside a chrome tab. Also I would like to learn more about the issues with engine sounds. Did you play it from the actual website which has the latest version? Did you use the actual recorded sounds setting? Cause those are actual sounds that don't really sound unpleasant.

1

u/qwertyalp1020 1d ago

Seems okay, but why do you need 400hz physics if the handling is not like a sim? Not trying to bash it or anything.

1

u/kochas231 1d ago

Fair question, thanks for asking nicely. 400 Hz doesn't make it a sim by itself. It's there so results don't depend on the timestep: braking distance changes by 0.0025% between 400 Hz and 1000 Hz in my tests, and the stiff parts (tyre carcass, wheel hop) run at higher sub-rates ( up to 2000hz )

What's meant to make it feel like a sim is the tyre model (Pacejka Magic Formula latest and older formulas and using Project Chrono's open tyre data, with relaxation lengths, thermals and wear).

But I'll be upfront: the calibration isn't proven on actual wheels yet. I tested it with a dual shock 4 on beginner handling though and I must say it felt nearly identical to Gran Turismo 7 which is definitely good progress. Only one car (the GT3) is tuned against real lap times, the rest are original cars. It's all written down here, including what's not validated: https://github.com/Konstantinos-Chatzistavrou/Open-Grid/blob/main/docs/physics.md

What car and input were you using (keyboard, gamepad, wheel, mobile)? Assists change the feel a lot, and if it feels arcade I'd like to know where.

1

u/ChanhyoungLee 5d ago

Opened it in desktop Chrome and stayed on the menu. Before I clicked anything, it downloaded about 60 MB in under half a minute. About 20 MB of that is five asphalt and concrete normal maps.

I read the header of asphalt_02/nor.ktx2. It's 2048x2048 UASTC with Zstd and 12 mip levels, and Zstd only takes about 14% off the top level (4.2 MB to 3.6 MB). Plain UASTC doesn't compress much. Basis has an RDO pass for UASTC so Zstd can do more, for example basisu -uastc -uastc_rdo_l 1.0. Ground seen from a low camera may also look fine at 1024, which is a quarter of the pixels.

Both 1k HDRs (urban_street_01 and shanghai_bund) also load on the menu, about 3 MB together. If each map uses only one, you could load it after the map is picked.

0

u/kochas231 5d ago

Thanks a lot for checking it and I knew something was not right with the ktx2 headers, but wasn't sure, that's super helpful.

I just pushed a few fixes for this: stopped preloading the city tiles, kit materials, and garage on the main menu (so idle load is down to ~12 MB now), made the rain HDRI lazy-load only when weather changes, and re-encoded the road normal maps down to 1024x1024. That brought the 5 road normals from ~19 MB down to around 4.4 MB, they already had RDO enabled, so 2048 was the main culprit.

Really appreciate your feedback!

1

u/ChanhyoungLee 4d ago

Ran the same check again with the cache off and no clicks. The first 25 seconds now transfer 6.7 MB in 65 requests, down from 60 MB in 209. No ktx2 or HDR files load on that screen anymore, and the five road normals are 1024x1024 now, 0.7 to 1.2 MB each. That was a fast fix.

0

u/kochas231 4d ago

5 weeks and this much progress is physically impossible without vibe coding. I am here to make sure the physics are all accurate and that it doesn't procude slop. I don't hand write all the code 😂

0

u/plus2link 5d ago

400 Hz physics only pays off if the renderer interpolates between the last two states, otherwise 60 fps shows it as notchy steering and the extra steps just cost CPU. The other half is where input is sampled: reading the wheel once per rendered frame throws away most of those steps on a 240 Hz wheel, so sampling it in the physics loop and timestamping it is what makes the high rate visible in the feel. Are you running a fixed accumulator with interpolation, or stepping physics on the render tick?

1

u/kochas231 5d ago

Yeah it's a fixed accumulator at 1/400s with render-side interpolation between the previous and current physics poses. There's also an experimental ?physworker=1 flag that moves the 400 Hz C++ WASM sim into a Web Worker over SharedArrayBuffer and interpolates the last two snapshots.

You were also right on the input sampling too, getGamepads() was indeed capping steering to the display refresh rate. I just wired up a timestamped WebHID ring buffer to sample steering per physics substep for wheels, with Gamepad API still as fallback. Haven't had a physical wheel to test it on yet though, so if you have one and feel like trying it out I'd really appreciate the feedback!

-1

u/plus2link 5d ago

No wheel here, just a pad, so I can't test it for you. One thing worth logging first when you do: the timestamp of each HID report against the substep it lands in, since some wheels push at 1000 Hz and others only send at whatever interval the driver picked, and a ring buffer that assumes a steady rate turns that jitter into physics jitter. Also worth checking what the wheel reads at centre, because a few counts of drift are common and at 400 Hz that will pull the car even when the driver's hands are still.

1

u/kochas231 5d ago

I will definitely give it a look. Thank you!

0

u/owenhargreaves 5d ago

“Reticulating…”

1

u/kochas231 5d ago

Claude: "Dilly Dallying...."