News for hackers. Stuff that matters.
Re:CityBound – An open source city simulation game in Rust by brink on Friday April 05, 2019 @12:06PM (#19583869)
I love what this is trying to achieve; I'm a Cities Skylines fan. But why did he choose to do it in webgl in the browser of all things? At first I thought he chose Rust for performance reasons, but then it looks like he completely negated that by choosing to run it in a browser.
Re:CityBound – An open source city simulation game in Rust by untog on Friday April 05, 2019 @12:15PM (#19583983)
WebGL is just a subset of OpenGL, really. So the combination of Rust and WebGL is probably incredibly flexible in terms of the platforms it can run on.

I can't think of an inherent reason why running in the browser would be a performance suck. WebGL performs wonderfully, and Rust compiles to WASM. Rough edges right now to be sure, but looking ahead it seems like a great choice.

Re:CityBound – An open source city simulation game in Rust by kemayo on Friday April 05, 2019 @12:11PM (#19583935)
Two really different performance domains to be concerned about?

This sort of fine-grained simulation is expensive, whereas rendering of the fairly-simple sort the screenshots imply just isn't.

(I'm assuming that the backend Rust server is doing the expensive simulation stuff, and just sending the display data to the client.)

Re:CityBound – An open source city simulation game in Rust by gmueckl on Friday April 05, 2019 @12:17PM (#19584007)
The simulation state can be huge. Streaming all of it would be pretty bad. Streaming only parts leads toneedless latency when other data is required. WebGL is not the smartest choice to me. Running things locally with only input replication between players should be the better choice. But this requires a 100% reproducible simulation.
Re:CityBound – An open source city simulation game in Rust by theanzelm on Friday April 05, 2019 @05:11PM (#19587084)
The whole idea behind dumb client/simulation server was to be able to support cities too big to be simulated on one machine (the simulation server can be distributed). I already have quite sophisticated streaming logic that basically makes sure only deltas of everything are streamed. Latency is not really an issue in this kind of game, for most player inputs I can even do simple optimistic prediction on the UI side, which works fairly well.
Re:CityBound – An open source city simulation game in Rust by gmueckl on Friday April 05, 2019 @07:40PM (#19588092)
Latency semms to be an issue to me when new data is requested that has not previously been streamed.

Honestly, sending deltas always seems like a bad idea to me as this allows subtle synchronization issues to derail simulations bit by bit before the divergence is big enough to be noticable.

Re:CityBound – An open source city simulation game in Rust by setr on Friday April 05, 2019 @12:38PM (#19584311)
Im not sure how WebGL would impact syncing simulation state across clients

Or how opengl/vulkan/etc would be better (I also dont see why they’d impact client syncing)

Unless webgl does something more than rendering..?

The same data is (eventually) required for any rendering engine, regardless of how you sync the simulation

Re:CityBound – An open source city simulation game in Rust by gmueckl on Friday April 05, 2019 @07:31PM (#19588038)
Sorry I meant WebGL only as a shorthand implying a web stack with a server, a browser and JavaScript. That was an bad choice of words on my part. It was not meant to single out WebGL as a rendering technology.

However, more sophisticated APIs could allow more techniques for offloading more of the filtering and mapping steps of the visualization pipeline onto the GPU. Even some simulation could be accelerated, although it's often not worth it in practice.

Re:CityBound – An open source city simulation game in Rust by petepete on Friday April 05, 2019 @12:30PM (#19584187)
Originally it was written in JavaScript, then rewritten in C++, then a few months later in Rust.

https://github.com/citybound/citybound/wiki/Development-Hist...

Re:CityBound – An open source city simulation game in Rust by meritt on Friday April 05, 2019 @12:54PM (#19584495)
The simulation runs on the server. The client side (browser/webgl) is a dumb client.
Re:CityBound – An open source city simulation game in Rust by Bluecobra on Friday April 05, 2019 @01:59PM (#19585323)
That’s pretty neat. I remember when SimCity (5) came out and being extremely disappointed that the underlying agent system was a complete farce. If I recall correctly, think they had to “cheat” because they couldn’t scale performance on lower end hardware. With this you can just spin up a faster EC2 instance if you want a bigger city or region. I can totally see small groups of hardcore players coming together to pay for a dedicated host.

It sure beats swapping SC4 files on file sharing services for “region play”.

Re:CityBound – An open source city simulation game in Rust by theanzelm on Friday April 05, 2019 @01:02PM (#19584602)
Exactly. And I do use Rust compiled to WebAssembly to do lots of the "render preparation" work (converting streamed simulation states into render buffers), which makes it pretty fast.
Re:CityBound – An open source city simulation game in Rust by netsharc on Friday April 05, 2019 @07:11PM (#19587892)
C:S is limited by your CPU/memory, imagine having the calculations be done on a big server. But I guess you'd have to have a subscription to the game so they can pay the cloud services, and it wouldn't be cheap if your city needs a lot of (server) CPU power.
Re:CityBound – An open source city simulation game in Rust by excepttheweasel on Friday April 05, 2019 @12:10PM (#19583924)
Rust can compile to WASM, and I would assume would outperform vanilla JS.