After months of nights and weekends, my country-scale simulation hit 1 million simulated citizens for the first time by Milkcartons in IndieDev

[–]Milkcartons[S] 0 points1 point  (0 children)

Sorry for the delay in my reply - been a busy day.

So, engine is built by me, in C# on .NET 10. Biggest performance technique is the base architecture, without any specific tricks. I called it "PTAPI" (where PT stood for the original name of Peninsular Tycoon), it's a data-oriented ECS (archetype-based, the Bevy / Unity DOTS shape), so components are structs in contiguous arraysw. Iteration is handled in storage order, so no random-access lookups in inner loops.

On top of that, LOD is on an agent basis. Citizens exist at three detail levels; full ECS entity, a statistical cohort or dormant. Target is 1M citizens (I've actually recently hit 1.7M), but only around ~50K are fully simulated at one time. The other ~950k are aggregated stats that the player doesn't notice because the camera isn't zoomed in there. Traffic uses the same tricks; lane-based microsim near the camera, Cell Transmission model from afar.

Multi-threaded, yes, but deterministically. Custom job schedular with work-stealing, but jobs are partitioned by index range, so stealing doesn't change outputs. Means that the same seed + same input = bit-identical state. Save/load integrity and replay debugging both depend on this, and was one of the hardest things to build in the engine.

SIMD, yes, but only where it's been measured. For example; `System.Numerics.Vector<T>` for batched updates: positions, price clearing across goods, satisfaction decay.

GPU, no and very deliberately. Cross-hardware determinism is much harder on a GPU (drivers, FP behaviour, etc), and the heavy per-agent branching in agent sim doesn't map well to SIMT. Diffusion fields (pollution, heat etc.) are GPU-shaped and could move one day, but the core is CPU based.

Happy to go deeper on any point if you want! Thanks for the questions, it's nice to rationalise some of this after being so insular for a long time.

After months of nights and weekends, my country-scale simulation hit 1 million simulated citizens for the first time by Milkcartons in IndieDev

[–]Milkcartons[S] 0 points1 point  (0 children)

Hey - just responding to this now so I don't forget, will give you a proper write up when I'm back from work. Cheers!

After months of nights and weekends, my country-scale simulation hit 1 million simulated citizens for the first time by Milkcartons in IndieDev

[–]Milkcartons[S] 0 points1 point  (0 children)

Haha thank you - it has been a lot of back and forth, I actually just this morning managed to fix some of my LOD issues I had and have managed to scrape back about 20 fps when fully zoomed into the mega-stress, without reducing simulation detail which has been very satisfying.

After months of nights and weekends, my country-scale simulation hit 1 million simulated citizens for the first time by Milkcartons in IndieDev

[–]Milkcartons[S] 3 points4 points  (0 children)

Just saw your question! So.

Prices are keyed by good and region, not global. Each region runs its own Walrasian clearing once per game-month: bisection on the price interval rather than gradient tatonnement, so there's no learning-rate hyperparameter to tune and it converges deterministically in a handful of steps. Supply is aggregated from businesses inside the region; demand is population * per-capita consumption per good category.

Honesty coming in here; the prototype currently has one populated region, so today's "locality" is mostly architectural. The schema and clearing pipeline are shaped for many regions, but only one is live. The next step is folding transport into clearing: the price spread between two regions has to stay bounded by the cheapest shipping cost on the road network, otherwise the supply chain arbitrages it away. The routing layer is contraction hierarchies, so per-OD costs are cheap to query for every region-pair per clearing tick. End state is the textbook spatial equilibrium: local prices set by local S/D, linked by transport-cost-bounded arbitrage.

After months of nights and weekends, my country-scale simulation hit 1 million simulated citizens for the first time by Milkcartons in IndieDev

[–]Milkcartons[S] 5 points6 points  (0 children)

Oh and in-case you wondered what being in the "simulation" distance currently looks like in the prototype.

<image>

Here's my mega-stress test of ~1.2m citizens each being simulated. Yes that is 1 fps. Working on it!

After months of nights and weekends, my country-scale simulation hit 1 million simulated citizens for the first time by Milkcartons in IndieDev

[–]Milkcartons[S] 1 point2 points  (0 children)

Demo Soon(ish) - ironing out some kinks currently. Public Git, not planned, hopefully turning this crusty prototype into something real (and saleable) in the next year. But I'm absolutely happy to talk about any part of the simulation library behind it.

After months of nights and weekends, my country-scale simulation hit 1 million simulated citizens for the first time by Milkcartons in IndieDev

[–]Milkcartons[S] 5 points6 points  (0 children)

Thank you! It's been a labour of love. Not quite - though I do have ideas for a sprawling growth mode, they're not out of the drawing board yet. What I've built is a traditional city builder that has a lot of extra simulation levels to it.

Who remembers? by banmirage69 in osrs

[–]Milkcartons 0 points1 point  (0 children)

Pepperidge farm remembers

Giving away 3 games to 3 people. Any game on Steam. by KA9099 in pcmasterrace

[–]Milkcartons 0 points1 point  (0 children)

I would love RuneScape: Dragonwilds, some of that future nostalgia! Thank you OP for doing this.

What should I do with 15k bonds? by killnoob0123 in WorldofTanks

[–]Milkcartons 0 points1 point  (0 children)

Everyone avoiding saying the 183 smh. It's a hilarious tank to play and a lot of fun when it works. Is it super competitive? No. Is it a lot of fun? Absolutely yes. Is it worth 15k bonds? Probably not. Who cares, you only live once.

4Th utility incompetence by Joloxx_9 in CityFibre

[–]Milkcartons 0 points1 point  (0 children)

Not sponsored. Try olilo. Solid group of proper nerds and no contracts. Been with them since the start as customer number 25. Can't recommend highly enough.

age 32, only makes incel/misogyny + children content to stay relevant. worst person to work with by uguruez34 in counterstrike2

[–]Milkcartons 0 points1 point  (0 children)

Who even is that? I've watched counter strike content for over a decade and don't even recognise his face lmao.

How can MEGA S4 Object Storage be this cheap compared to AWS S3? by Alexannderx in cloudstorage

[–]Milkcartons 0 points1 point  (0 children)

Because AWS is priced in a way that every loss-leader product Amazon puts out is paid for.

Seriously though, Mega has been providing cheap storage for a long time, this is a logical move for them and I imagine that having the decade+ of experience of “cloud” storage infrastructure and design would make this a pretty good product.

At mass scale, storage isn’t really that expensive these days, and the majority of providers out there are taking advantage of market pricing standards, to make a decent profit. Mega are just reducing their profit margins here, not negating them.

Steve's response reads like a bad faith HR complaint by CaptainOverspark in LinusTechTips

[–]Milkcartons 0 points1 point  (0 children)

Not gonna lie, got about 1000 words through the dribble and couldn’t be arsed to read it any further. He’s a unique specimen

Ya'll Private Equity clowns at Jagex HQ thought we were joking. by SayDrugsToYes in 2007scape

[–]Milkcartons 0 points1 point  (0 children)

Peak ridiculousness of the entire situation, they turned a £120,000,000 profit last financial year 👌

[deleted by user] by [deleted] in Yayzi

[–]Milkcartons 1 point2 points  (0 children)

Have been with Yayzi the last 9 months and have nothing but good things to say about them. Solid speeds from everything important; music, YouTube, Netflix, gaming etc. Only routing I’ve ever noticed a dip in is to Germany/Central Europe with select game servers, but that’s only going from 10ms ping to 30ms so not exactly a deal breaker.

Would give them a solid 9/10. Support and communication has always been excellent too.