Sand simulation

https://vector76.github.io/sandsim/

Interested to hear your thoughts!

Code at https://github.com/vector76/sandsim

Approximately 24 hours, approximately 25k lines of code, (TypeScript + Rust)
Number of lines of code (not counting English) written by me: 0

8 Likes

Neat! Another project by your AI Orchestrator https://github.com/vector76/raymond ?

Curious what model(s) and plan you’re using.

Am using Github Pro+ ($39/month) but they’re switching from ā€œPremium Requestā€ to a token based model june 1st. So, inference is going to get a lot more expensive for prompts that trigger long running work. Maybe my math is off, but with their new billing model the FluidTouch port I’ve been tinkering with would cost $1000+ :poop: instead of ~$30 last month (ignoring my time…).

About a week ago I built a dashboard (https://github.com/vector76/cc_usage_dashboard) to track my Claude Max (20x) usage against my allowance, and according to that, I burned about $500 in VC money (most, but not all of that was spent on the sand simulator). The $200 per month subscription gets you what would be approximately $2000 in credits if you were paying retail API rates.

I have a hard time using all my allowance so I use Opus 4.7 1M context for everything.

And yes I’m using raymond to keep the machine fed. Bit by bit, building on it. Trying to get to the point where it can stand alone instead of needing other supporting tools to be convenient. Raymond is a nice engine but it’s not a nice car at the moment.

By the way the green zones on the charts trigger a ā€œslackā€ mode so if I am under-spending my quota, it could trigger low-priority or low-value tasks to use up the extra allowance before it expires. It works but I haven’t used it yet.

1 Like

We have Enterprise at work.

I’ve been warning people for months that eventually this day would come, and companies would have to start charging the true cost… and it’s not cheap.

I’ve been playing with it a bit to see where we’ll land.

I’ve had a single Opus request, 3 Premium request units, burn through 60 million tokens.

Something I could do on the old plan 330 times per month for $40, would now be $300 minimum, if we assume all those tokens were input tokens, and nothing was cached.

A day of reckoning is coming soon :slight_smile:

The copilot team is really gonna have to start laying off the features and start focusing more on getting those token counts optimized.

There needs to be a lot more transparency and control for what affects these things

4 Likes

Awesome idea.

I spent last few hours of April’s billing cycle trying to use before losing unused Requests on lower pri projects. Spinning up 6 agents to use Opus 4.7 for backlogged projects quickly hit session limits. So, I ended up not fully utilizing monthly credits. Your idea to continually enqueue lower pri work throughout the month is great. Cheers for sharing!

Yeah, their Request based business and billing model seemed too good to be true.

Jun 1st :sob:.

Personally planning to code like crazy before we start getting billed the true cost, and have to optimize meaningful work per token.

1 Like

Yes! Especially for all the lessons and mistakes, best to do that when it is cheap! The products (like sand sim) are cool but secondary, and I’m mostly after the experience.

2 Likes

Claude does not give you a lot of free traffic anymore either. It’s like, two prompts and you are done.

Anyone using these workflows would be very wise to model and predict what the (not free) costs will be when the providers try to charge appropriately to their own expenses.

My work teams have started to look at this, it’s startling.

3 Likes

For people that just want to play with it:

I can say this is the coolest, most accurate sand simulator I’ve seen.

It seems to be running in real time. I wonder how fast it can run if it just tries to show the final result?

I haven’t played with it too much. I want to try it with some of the rmrrf patterns we had and compare to the real thing. But it certainly looks a lot more accurate than the lines in sandify.

@bobnik, what do you think?

Jamie, I had a strong feeling I had nerd sniped you when I said the preview is very hard to make accurate. :slight_smile:

100%!

A speed multiplier and pause and scrub was in the original roadmap I think but that part is not implemented yet. I haven’t tried optimizing speed vs fidelity and I don’t even know if feedrates in the gcode are respected. I haven’t tried it.

I haven’t tried but a few patterns but one thing I did notice is the ā€˜square’ pattern followed by the spiral pattern basically erases the square, but there is a subtle shadow of where the square had been, similar to how wipes leave a barely perceptible shadow of the previous image. This blew me away when I first saw it.

5 Likes

Yeah. That’s great. I haven’t read the code. Do you know what it is drawing and what it is basically doing to simulate that? Is it doing actual particle physics or some approximation?

It is not simulating individual grains. What I asked for was a radial displacement model with repose relaxation afterward. The ball is segmented into 32 pie slices and for each slice, at each timestep, it computes the displaced volume which is the sand surface above the lower surface of the ball. It then distributes that sand radially outward, filling closer cells first and continuing outward until all the displaced sand is allocated. Then it does repose relaxation which can distribute the sand further out. The total volume is conserved.

At least, that’s the idea. A relatively simple kernel that leads to surprisingly accurate result. I haven’t read the code either. :grimacing:

The AI wanted to start with a simpler displace-sideways model first, then add ā€œbow-waveā€ calculation afterward. But the specific behaviors seemed dumb and I figured they would already emerge from a radial-displacement model, which shouldn’t be any more difficult than a displace-sideways hack. So I just went with radial displacement from the outset and it worked out ok.

2 Likes

This guy is killing it on the tokens per request ratio lol

https://x.com/theo/status/2051218167780041147?s=46&t=r2unVE94tGok0mrgjeoXLw

3 Likes

That loud mouth is ruining it for the rest of us that were quietly Request maxxing…

Love the Sand Sim. Tweaking the default settings using the neat options helped make the animation run smoothly on my 8yr old Android (Galaxy 8).

Already considered finger mode, and/or RGB LEDs :slight_smile:

3 Likes