Racing Game in ClojureScript
github.com
github.com
I am also curious how Clojure(Script)'s persistent data structures work out for data structures that update 30 or 60 times per second. That's a lot of allocation and deallocation
That being said, it would be interesting to know how much of a penalty you pay as N gets big using a deeply nested persistent record vs a flatter component system with immutable persistent structures vs a pile of mutable structures.
Here is the original HN post about Cloact: https://news.ycombinator.com/item?id=7037038
You can see people comparing it to Om.
Here is a blog post of his from 2013 that mentions Om: https://swannodette.github.io/2013/12/31/time-travel/
And yeah, Reagent "won" because it was way simpler but I'd find it hard to believe that it wasn't influence or inspired by Om.
Edit: a sibling mentioned the React ART library and Ink, which are other good examples of the same thing. You can also see same principle used for many of the React animation libraries -- they use the same semantics, so they interop with "normal" React code just fine, but in actuality they're using the underlying animation APIs directly, bypassing the repatively expensive reconciliation process.
- Framerate isn't wonderful (20 - 30 fps on my laptop, which will happily run graphically more intensive JS demos at 60fps usually), and I see you're using React: is using a relatively heavy framework the best way to go here? Possibly this is fine and the optimisation is required in other areas instead (e.g., are you creating loads of garbage?),
- Car physics and handling is way off: clearly for this game realistic handling probably isn't the goal, but it's bad by the standards of more recent arcade racers (Burnout et al, Cel Damage for something that has a slightly similar aesthetic), or 1980s style 2D racers like OutRun (or more recently 80s/early 90s-esque racing games).
It's certainly an interesting demo - and, as I say, I love the way it looks - but in terms of demonstrating ClojureScript as a viable platform for game development, definitely needs more work. And in terms of this being a game, it's a long way from that: no objectives, no other drivers (depending on the objectives, may or may not be required), no hazards, pickups, etc., no sound, and so on.
If you read the README, React is kind of the whole point of this demo:
"This project is a showcase for the feasibility of React in gaming."
We'd need to know the cause of the performance issues to know whether it has succeeded or not!
Something I'm curious about is whether the frames are dominated by game logic (ClojureScript/React) or by graphics. If your laptop doesn't have a discrete card, and the author hasn't taken steps to optimize the graphical side via culling, etc, then your fps may not be representative of ClojureScript/React-based games in general
Looks pretty amenable to hacking with the boy.
I know we're using an engine, but still shocking how little code it is.
Edit: here https://github.com/pmndrs/react-three-fiber
https://github.com/pmndrs/racing-game
The original project is feature-complete as a racing game
I know indentation is subjective, but is this file the canonical way of indenting Clojure? I find it hard to read.
Was expecting to get my course time at least...
The world state seems to be limited to the 2D velocity and 2D position of the vehicle. There's no instability in the vehicle, no loss of control, no loss of traction, spins, brakes locking up.
I guess my point is there's nothing going on under the hood. This could be done in any language that's got an OpenGL API. (or D3D, GLES, Vulkan...) I'm not sure what the takeaway is.
(it looks cool though)
I generally do this every year or two but recently I've been doing a lot of work on the house so it's been particularly dusty with debris from plasterboard, cutting timber, sanding, etc.
But it's also not been my experience that the typical atmosphere around C#/Java posts that show up here has been "poopoo"
> gets barely any mention here (and when it does, it's for major lang releases and it's typically poopooed hard) and you basically see ZERO threads about the news from within these huge ecosystems.
Sounds like you’re projecting or something. C# tends to get a lot of love and while you’ll probably still find some negative comments about PHP or Java here, there’s always enough people praising them for what they’ve provided.