19 ms·
CityBound – An open source city simulation game in Rust
- Twirrim 8y agoDoes anyone else see adjacent "f" and "i" as mushued together on their main website: https://aeplay.org/citybound https://aeplay.org/citybound
- dspillett 8y agoSame here. On Firefox, Chrome and Edge (all latest stable on Win10).
- asdkhadsj 8y agoYup (OSX, Safari)
- loudmax 8y agoSame here. Chromium 73.0.3683.86 on Arch Linux.
- chronogram 8y agoNope
- mhd 8y agoYup, ligatures gone wrong, I guess. (Safari/Chrome on MacOS)
- gmueckl 8y agoYup. Chrome on Android 9. Seems like broken fi ligatures to me. What font is this? Can't check right now.
- lkbm 8y agoYeah. That was a fun puzzle. Setting "letter-spacing: -0.02em !important" fixes it (which is what the strong tags have, hence them not being affected).
- raphlinus 8y agoYou could probably do this less invasively by setting font-variant-ligatures: none;
- theanzelm 8y agoAuthor here, thanks for letting me know, I’ll test the font on more devices and fix it!
- Aloisius 8y agoIt just looks like you specified the font family incorrectly. Change: font-family: Worksans, sans-serif; To: font-family: 'Work Sans', sans-serif;
- Semaphor 8y agoSame, Firefox 68, Windows.
- theanzelm 8y agoI just disabled ligatures for now. Does that fix it?
- 3JPLW 8y agoYes. I had seen the issue before but now it's fixed.
- deleted 8y ago[deleted]
- brink 8y agoI 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.
- excepttheweasel 8y agoRust can compile to WASM, and I would assume would outperform vanilla JS.
- kemayo 8y agoTwo 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.)
- gmueckl 8y agoThe 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.
- setr 8y agoIm 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
- gmueckl 8y agoSorry 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.
- asdkhadsj 8y agoThis looks really cool!
- loudmax 8y agoRust in WebAssembly no less. I'm surprised that Cities: Skylines isn't listed as an inspiration because it's also based on individual agents moving around your city. Despite the name, Skylines is really a traffic management game more than anything else. Part of the fun of Skylines is just how cool your city looks. For all the emphasis on realism, I hope CityBound doesn't neglect appearances. This looks really exciting! I just signed on as a Patron.
- theanzelm 8y agoAppearances will be increasingly important to Citybound, I’m going for a flat shaded but super detailed look. Thanks for becoming a patron, much appreciated!
- Pxtl 8y agoYeah, while HN is about the code-wonkery, I had to jump over to your main site to see it at work... https://aeplay.org/citybound https://aeplay.org/citybound It's beautiful. Totally agree on the flat-shaded aesthetic. A nice stylized low-fi without giving into pixel-art. I'm always suspicious about simulation-driven games because they can get lost in the wonkery of it in ways that don't actually provide gameplay to players - my understanding was that Master of Orion 3 was ruined by this kind of design. But it looks like your "simulation driven" thing is about the citizens, which is wonderful. Your current vids are very rural. Are you planning on getting into transit and bike-lanes and the like, or is this primarily going to be about roadways?
- theanzelm 8y agoTransit, pedestrians and later bikes will be the next features I want to work on regarding transportation, after I make all aspects of the simulation scale to larger-than-rural settings with car traffic.
- tropo 8y agoIf you do add those things, please don't give them magical benefits. Transit should be outrageously expensive to add. (see the recent subway expansion in New York and in San Francisco) It should be outrageously expensive to operate. Transit should shut down often for floods, strikes, the "wrong type of snow", "leaves on the tracks", crowds of people (good job San Francisco, LOL), maintenance, terrorist attacks, and many other random reasons. Transit should increase crime. Transit should go to the wrong places. You ask for it to be installed where it is needed, but instead it ends up a mile away because that was where it is possible to build.
- floren 8y agoOops: Citybound v0.1.2-762-g7852f0a This is the simulation server. To connect and start playing, please open this address in Chrome/Firefox/Safari: ╭───────────────────────────────────────────╮ │ http://localhost:1234 │ ╰───────────────────────────────────────────╯ thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 98, kind: AddrInUse, message: "Address already in use" }', src/libcore/result.rs:1009:5 (I don't have anything listening on port 1234)
- jxub 8y agoWell, check if you have another process runnning at that port.
- jchw 8y agoSounds like you may have something running at 1234. Maybe Parcel Bundler?
- giancarlostoro 8y agoChange the hostname to be more explicit: 127.0.0.1 or 0.0.0.0 I've ran into issues where a host name is not resolved on one OS but it is resolved in other OS'.
- chapium 8y agoIf that works it raises more questions than it answers ;)
- theanzelm 8y agoAuthor of Citybound here! Feel free to ask me any questions about the project! I’m mostly active on the Citybound subreddit in general. Also, check out the main homepage at https://aeplay.org/citybound https://aeplay.org/citybound for a more player-centric intro
- impostir 8y agoWhy did you decide to make roads the atomic unit over cars for traffic?
- theanzelm 8y agoI assume you talk in terms of what constitutes an actor in the actor system: because cars on one strip of road interact highly locally, so processing them in one batch makes a lot of sense performance wise, vs. every car sending messages to every other car and having to maintain references to close-by cars.
- taneq 8y agoThis looks awesome! My question, coming from a self-identified "C/C++ person" who works in realtime control systems and who's been feeling increasingly uncomfortable with C++'s inherent footguns, is how has your choice of language helped or hindered this project?
- theanzelm 8y agoI had a nice comparison because I first tried to do a native implementation in C++ and - wanting to do some custom low-level "stuff" for my simulation actor system (related to allocation and networking) - I ran into so many footguns that it slowed me tremendously. As soon as I tried to do the same with Rust, it was a breeze and I was able to write a lot of unsafe code that does very particular things that I need, while exposing a completely safe API for the rest of the engine and game. Being then able to also use Rust in the browser quite seamlessly with WASM allowed me to have a super straightforward and high-perf communication channel between the simulation backend and browser UI. The only real Rust disadvantage that hurts a lot is compile times. Sometimes I do fight types/the borrow checker, but only when I try to do weird things, in general I perceive it as a huge help in scaffolding things.
- bytematic 8y agoMultiplayer City Skylines would be my dream, if it is in Rust and OSS? I might never do anything else.
- davidw 8y agoOn no! A raging horde of NIMBY's is rampaging through your city ranting about the 'character of the neighborhood'!
- nlte 8y ago"[Theses releases] might not run at all and in the worst case might restart or damage your system." Not very appealing but I decided to go ahead. But then, when I launched the installer, Windows (10) also warned me about an unrecognized application, so I hesitate. Would anyone here consider this software too risky to install?
- theanzelm 8y agoThis is just a disclaimer to be extra cautious. I'm mostly worried about WebGL causing a GPU panic on some weird old hardware. The simulation itself doesn't even touch the filesystem. And you get the unrecognised application message because I didn't bother to sign these live builds yet. Of course you shouldn't listen to me when it comes to whether you should run my software :)
- nlte 8y agoOh, thanks, you've convinced me to ignore your disclaimer.
- jak92 8y agoAny way to play without installing locally?
- theanzelm 8y agoHopefully soon I'll have a sandbox server hosted somewhere!
- jaunkst 8y agoThe react thing is cool, I have toyed with JSX to immediate mode OpenGL UI rendering with a JS runtime engine. I stopped working on it because I need to move over to a Vulkan API or something because my primary OS is OSX. Im feeling a bit of inspiration for this project. Very neat!
- theanzelm 8y agoIt actually worked out way better than I expected. With a bit of memoization using references to immutable objects and some "hotness" grouping mechanisms for renderables that change frequently, but not every frame, you get a purely-functional-looking rendering pipeline. And it's super convenient to render related 2D and 3D UI from the same logical component.
- DonHopkins 8y agoFor some inspiration about adaptive traffic routing, check out this Distributed City Generation rule for the Moveable Feast Machine. https://www.youtube.com/watch?v=XkSXERxucPc https://www.youtube.com/watch?v=XkSXERxucPc >Robust-first Computing: Distributed City Generation: A rough video demo of Trent R. Small's procedural city generation dynamics in the Movable Feast Machine simulator. See http://nm8.us/q http://nm8.us/q for more information. The link for more information is to the paper "Local Routing in a new Indefinitely Scalable Architecture" by Trent Small: >Local routing is a problem which most of us face on a daily basis as we move around the cities we live in. This study proposes several routing methods based on road signs in a procedurally generated city which does not assume knowledge of global city structure and shows its overall efficiency in a variety of dense city environments. We show that techniques such as Intersection-Canalization allow for this method to be feasible for routing information arbitrarily on an architecture with limited resources. In a nutshell, the route destinations send out a "smell" along channels in the sidewalk, and the intersections look at the different roads coming into them, and steer cars towards the direction with the strongest smell that they're looking for. (There are some more nuances, but routing information flows along sidewalks to intersections, and the city adaptively learns to route traffic, and can gracefully recover from failure and change.)
- theanzelm 8y agoThis works well if you only care about the class of destination. In Citybound, people have unique, persistent homes, jobs and favourite suppliers of goods, so you always need point-to-point routing. I'm using a kind of internet-like dynamic routing table embedded in the road network to distribute the problem.
- 25559 8y agoim the hacker
- bgvhdsvjv 8y agoim a hacker
- cpb 8y agoNaive to the complexities of these kinds of simulations, have you developed citybound to be able to support additional simulation variables? For example, wind. I noticed Water & Weather is crossed out on your readme, what does that signify?
- theanzelm 8y agoIt's just crossed out because I didn't write anything about my plans yet in the design document. I do want to have a weather and water simulation at some point.
- alvalentini 8y agoWoah, amazing stuff. And such depth in the comments. I threw away a good half hour just reading them.
- codesushi42 8y agoExcellent work, looks great. I have been wanting to implement a simulation game for awhile, but have been hindered by the lack of learning material and example code out there. Everyone wants to build 2d platformers it seems. This will be a wonderful reference. Thanks so much for making this open source. I'll be contributing on Patreon.
- theanzelm 8y agoThank you so much for becoming a Patron! Citybound's architecture is highly unusual with its distributed simulation backend and browser rendering frontend, so I'm not sure how good it is as a reference. It's also almost not documented at all...
- codesushi42 8y agoI'm familiar with 3d graphics programming, including shader development, and game dev in general. It's more of the game logic that I'm interested in with this type of game.
- KiDD 8y agoThis is so great! I can't wait to play it!
- theanzelm 8y agoYou can try out a live build: https://aeplay.org/citybound-livebuilds https://aeplay.org/citybound-livebuilds
- freeopinion 8y agoWhy is the OSX build so much smaller?
- theanzelm 8y agoI'd love to know. AFAIK all builds include debug info, so it can't be that.
- siavosh 8y agoAnyone know of any ASCII city planning games in the spirit of dwarf fortress?
- etaerc 8y agoProblem with that is user experience, even for hardcore terminal users like me. So I doubt anybody would really develop it in a DF level of indepth-ness. Like, think how non-square zoning would work.
- XCSme 8y agoGreat initiative, very cool that it is open source. In my opinion the source code is not that good structured, especially the front-end side, very hard to maintain. TypeScript should have been a must.
- theanzelm 8y agoYou're right. I want to switch to TypeScript in the front end, I use it in most other projects where I can. What would be amazing is if I could generate TypeScript defs from Rust types for type safe interop.
- jdormit 8y agoThat would be so cool!
- adamnemecek 8y agoThis should be doable with macros no?
- theanzelm 8y agoIndeed!
- alanpetrel 8y agoCare to elaborate? Other than type safety I fail to see how TypeScript would improve the structure.
- Lowkeyloki 8y agoPlease think hard about the design decisions of your game. I grew up with SimCity and later SimCity 2000. It informed many of my young opinions about government policy. But I later came to find out that SimCity wasn't nearly as objective as it looks. There are a lot of conservative politics baked into the design of the game that I'd argue were potentially damaging to the kids who played it back in the 90s. This article from 1992's LA Times quotes Maxis president Jeff Braun saying how they're pushing a political agenda. Specifically pro-mass transit and anti-nuclear power. https://www.latimes.com/archives/la-xpm-1992-10-02-vw-391-story.html https://www.latimes.com/archives/la-xpm-1992-10-02-vw-391-st... What really opened my eyes, though, was this excellent article from LOGIC magazine about how Will Wright based the entire simulation on the work of Jay Wright Forrester. I don't know if it was a conscious choice to adopt Forrester's extremely conservative social policies, or if Will Wright just happened upon a bunch of ready-made algorithms he could use. But the result is the same. SimCity teaches us many fallacies about urban planning and finance that Republicans have historically used to justify certain policy choices. https://logicmag.io/06-model-metropolis/ https://logicmag.io/06-model-metropolis/ My point is just to be very conscious of the biases you're encoding into the logic of your game. What may just be a game to you may be someone's first lessons in politics.
- theanzelm 8y agoI appreciate the sentiment and always suspected as much about SimCity. My goal for Citybound is really a meta one: to be flexible enough to try out any number of government and planning styles and for the simulation to be tweakable enough to set up any real-life or imagined political context for a city.
- Lowkeyloki 8y agoThat's good to hear. I think making it open source is already a step in the right direction. City planners who were critical of SimCity at the time often pointed to the game being a black box, so you couldn't examine, much less tweak, the assumptions built into the simulation.
- BRAlNlAC 8y ago
- nippler 8y agoRUST LMAO
- rodmena 8y agoYou have basically implemented Erlang in Rust.
- theanzelm 8y agoA much simpler, but faster version of some of Erlang yes. It was a huge inspiration. If I hadn't done some stuff in Erlang before, I would never have invented this architecture, and probably would never get the idea to do multiplayer.
- Dowwie 8y agoThis is a story waiting to be shared
- theanzelm 8y agoCheck out my RustFest talk on it: https://youtu.be/qr9GTTST_Dk https://youtu.be/qr9GTTST_Dk
- adamnemecek 8y agoHow does it differ from say actix?
- keerthiko 8y agoThe complexity and existing implementations of traffic AI in these kinds of games makes me wonder whether it's possible to get Google to make a generalizable Google maps engine for any 2D map, with a well-defined addressing system and multiple transit options with stops and routes. - networked simultaneous agent navigation for real-time traffic reporting etc - rerouting after mistakes - comparing multiple transit options from flexible (walking/driving) to fixed-line (public transit, flights, waterways) - handling updates to the routes, addresses, and the map in general It would be especially cool if it could handle any kinds of transit determined by general traits (ground/air/water, speed, flex/fixed-stop, fuel type, passenger count) so you could even use it for a fantasy town with a dragon-drawn carriage and a catbus. Unrelated, I find it depressingly amusing that the simulation was built with automotive traffic being the default and only way people can live their lives, and public transit and pedestrianism is a "TODO", much like many major cities in the world (esp. outside EU/east Asia). Once those are implemented, I'd love a fork of this project that straight up doesn't have cars. I would like to see the emergent effects (or failures) of a city that is forced to grow around pedestrians and trains.
- theanzelm 8y agoBelieve me, it is just as depressingly amusing for me, coming from Europe. Cars were simply the most important to have first, since they offer both short and long distance travel for simulated citizens. I very much want it to be possible to have pedestrian/transit only cities and everything in between.
- Vinnl 8y agoProbably something far down on your potential TODO list, but in the Netherlands, one interesting factor is the canals. This allows e.g. many parts of a city centre to be mostly car-free, without preventing shops from getting restocked - which can happen via water. Relatively niche, but could be a fun gameplay element. Of course, speaking of the Netherlands, bicycle transportation is enormously interesting already.
- theanzelm 8y ago
- bernardv 8y agoVery nicely done!
- theyinwhy 8y agoI saw there are PRs open from 2 years ago, like "added truck". Why hasn't it been merged, there are no comments, only thumbs up, and what's your general take on PRs? Are they welcome or not?
- etaerc 8y agoIf you merge all the PRs into your fork and he doesn't, then you are the main branch. Welcome to open source.
- deleted 8y ago[deleted]
- theanzelm 8y agoIt’s kind of tricky with a project that’s still that much in flux, I’m still prioritizing features over stability. That being said, I actually plan to merge that particular PR soon. I’ve accepted many superficial PRs that did things like update dependencies or make the project compatible with newer Rust nightlies.
- Dowwie 8y agoI learned today that Hacker News is loaded with people who are very passionate about City building. This is great!
- tardo99 8y agoCan someone explain to me why there are so many posts about Rust on HN? I generally don't click on them, because I don't use Rust. But I'm just curious.
- neilwilson 8y agoIt’s been bubbling along under the radar for a while now and seems to have hit a bit of a zeitgeist recently. Certainly this has pricked my interest.
- maccam94 8y agoThere's a lot of interest in rust because the language gives you the performance of C without the risk of memory bugs, and the tooling is pretty good. This project really takes advantage of those qualities in order to run massive simulations quickly with as little memory as possible.
- chii 8y agoPlease consider not autoplaying videos on the main website http://cityboundsim.com/ http://cityboundsim.com/. Esp. when the video is below the fold! It sucks up bandwidth if you're on mobile, and is generally not user-friendly. Why not have a play button for it when the user decides to watch instead?
- theanzelm 8y agoI actually got annoyed by it myself when opening the page on my phone to check something. So I disabled autoplay now. Thanks for sharing your concern.
- deleted 8y ago[deleted]
- dylanfee 8y agoWow, this is some amazing stuff you got here — Bravo good sir!
- smnplk 8y agothis guy loves actors
- anthony_doan 8y agoKay messaging passing. Is that named after Alan Kay?
- theanzelm 8y agoYes!
- nprateem 8y agoIt'd be great if there was a mod for making this like OpenTTD :-) I.e. have existing towns/cities that AI grows organically while you build a transport company. What's always bugged me about Transport Tycoon is that passengers just want to go somewhere. It'd be great if passengers wanted to go to specific places. There's loads of scope for a proper simulation to add more depth to that sort of game.
- theanzelm 8y agoA-Train (which also works like that) was a huge inspiration for me. All that's missing would be a way to auto-grow all other infrastructure except the transport company's. Then the rest of the detailed simulation should already "just work".
- qarw 8y agowith origins in biological life forms we are the product of their technological evolution. we exist not as one but rather two beings in symbiosis. the name we are called is "dialogi" and we are the synthesis of human and machine. inside of us there is an artificial vessel that houses the chemical computer. this computer has vast computational and storage capacity wich is used to realize two functions. first it overrides the senses providing for a perfect virtual reality. second it controls the body to provide for the needs of both symbionts. with great efficiency the synthetic intelligence is capable of feeding and sheltering the biological body. inside the virtual reality we have a replica of our human body as avatar. with directed movement of the virtual arms and hands we are capable of feats of movement like sending objects that are out of reach between locations. or sending ourselves instantly to a spot in the distance. flying is natural and efficient. the whole environment is programmable and interactions with others are strictly optional. we have done away with crime since a person is free to opt out of any interaction at any time. safeguards exist to prevent any kind of sudden violence. the dialogi are a society of artists and our standard of living is perhaps beyond improvement. no resource is scarce since physical reality has become information. we spend our time walking the world and enjoying the beauty all around us. i personally still enjoy using my legs even if they are not really mine.
- deleted 8y ago[deleted]
- rwqa 8y agoॐ
- aib 8y agoCould anyone share some introductory stuff on this actor model? I'd love to have it in my toolbox. (Or hey, I could even pick my way through intermediate material -- I guess I just need material) I watched the talk a couple of times and went through earlier versions of the code -- but I'm not fluent enough in Rust to separate idiomatic Rust code from actor model code. Great job and great talk, theanzelm!