
Show HN: Little Automatic Racing Game in WebGL with Three.js and Oimo.js - hvidevold
http://emh.lart.no/publish/csb/csb3d/v1/?dupCount=10&swarmCount=1&unitScale=0.2&ownPhysics=false
======
JeanMarcS
You should definitively change (or make change, I don't know if it's possible)
"game" to "demo", because it's a bit frustrating when you land on the page and
try all keys and even a Game pad (like I did) and nothing happens.

On the other hand, after the frustration, the wrecking ball version is great !

~~~
hvidevold
Yeah, sorry about that. I don't know if it's possible to change the title now
though.

Glad you like the wrecking ball :)

------
walski
What is this?! I don't get how it's a racing game.

~~~
hvidevold
Well the transparent blue spheres are checkpoints and the units have to pass
through them. There is physics for collisions and the pods turn and accelerate
towards the checkpoints. They go from one to the next. The race is infinite
though in this case. It's inspired by a 2D bot programming contest at
[https://www.codingame.com/multiplayer/bot-
programming/coders...](https://www.codingame.com/multiplayer/bot-
programming/coders-strike-back) .

------
hvidevold
Should work at 6 FPS even on iPhone 5C, but if you are on a RTX 2080 Ti try
[http://emh.lart.no/publish/csb/csb3d/v1/?dupCount=1000&swarm...](http://emh.lart.no/publish/csb/csb3d/v1/?dupCount=1000&swarmCount=10&unitScale=0.1&ownPhysics=false)
for 20k units, or more if you're adventurous. I'm getting 100 FPS on that.
It's using instanced meshes. I'm getting 6 FPS on a million units
(dupCount=1000&swarmCount=500) with ownPhysics=true, which speeds it up with
simpler physics for large unit counts.

~~~
cerberusss
How do you control it? Firefox on MacBook.

~~~
hvidevold
You don't. It's automatic :)

~~~
cerberusss
Check, clear :)

Pretty cool!

~~~
hvidevold
Thanks :)

------
twodave
Hm, I don't see anything besides the blue spheres and some kind of trapezoidal
overlay. That said, if I needed some extra warmth and nothing else was
available, I could just open this and scoot closer to my workstation...

~~~
hvidevold
Hehe.. Any errors in JS console?

------
tomhoad
What am I looking at? I've pressed pretty much everything and nothing happens.

~~~
hvidevold
Ok try
[http://emh.lart.no/publish/csb/csb3d/vWreckingBall/](http://emh.lart.no/publish/csb/csb3d/vWreckingBall/)
it's a quick hack to give you at least a wrecking ball to mess with the racers
:)

~~~
SketchySeaBeast
Well now I just feel bad.

------
quickthrower2
You can change the params e.g.:
[http://emh.lart.no/publish/csb/csb3d/v1/?dupCount=1000&swarm...](http://emh.lart.no/publish/csb/csb3d/v1/?dupCount=1000&swarmCount=20&unitScale=0.2&ownPhysics=false)

------
dgellow
I’m confused. I see a giant dragon on top of what looks like goggles, and
nothing else? May be an issue with iOS though.

~~~
hvidevold
Maybe it's a problem with mesh instancing as it is used for the racers but not
the giant ones in the middle. Do you get any errors?

------
westmeal
How complex are these meshes? I'm only getting 42 fps average but I feel like
it should be way higher

~~~
hvidevold
The models have about 1k triangles each. The code is optimized to scale to
many units (racers), but the initial rendering cost of instancing with pre-
rendered animation skeleton may be high I suspect, so it may be slow for few
units on old hardware. I could try to have different rendering paths for small
and big number of units to alleviate the problem.

------
kowdermeister
Something is wrong, I get 12FPS MacBook Pro (Retina, 15-inch, Mid 2015)

~~~
hvidevold
Yes I haven't optimized a lot for older hardware, but I think it could
definitely be done, just have to ditch the complex stuff I am using to scale
to high number of units when there are not many of them.

~~~
kowdermeister
It's not old hardware :)

------
geoah
Should the cars and riders be racing independently? :D

~~~
hvidevold
Ah hahaha they are just two types of racing pods :) . There is no car/rider
classification.

For my personal version I can use all Starcraft 2 units as racing pods, the
dragon and the binocular pod are just a couple of free ones I found on
Sketchfab and put in there to be able to publish it :)

Here are a couple of screenshots from personal version:
[http://emh.lart.no/publish/csb/million-
mutas2.png](http://emh.lart.no/publish/csb/million-mutas2.png)
[http://emh.lart.no/publish/csb/csb3d.png](http://emh.lart.no/publish/csb/csb3d.png)

