8 ms·
Citybound – A city building game using actor-based distributed simulation
- t_mann 4y agoOne thing makes me wonder: supposedly the fancy simulation models are supposed to make the game feel more realistic - but then the player still seems to have an extent of control that no mayor or other single individual would have (in democratic societies at least)?
- pornel 4y agoThere's a lot of fiction in these games in order to make them fun. If you had to deal with committees, contractors, NIMBYs, and real human cost of bulldozing houses for highways, it would have been a completely different game, likely a sad and frustrating one. City builders also start from an empty free land, even though true greenfield development is very rare. SimCity has famously ignored the problem of parking, because it made cities look depressingly ugly. Even in Cities Skylines people pull cars out of their pockets.
- imtringued 4y agoWhat is depressing is that city simulation games subsidize car dependency by eliminating the need to park.
- EwanG 4y agoLast update in March of last year (2021). Appears to have run into issues both in game and for the developer. Still, some fascinating ideas.
- bragr 4y agoThat's a shame, seems like a cool idea. I wish the open source community was a bit better at open project management and more resilient to projects going dormant like this.
- bioemerl 4y agoThis guy was actually announced before city skylines and after SimCity, it was reaction to the city genre dying and paradox beat them to the punch. Unfortunate, but it died for good reason.
- atoav 4y agoI hugely enjoy watching people play cities skylines. There is not a lot that is more relaxing out there.
- pabs3 4y agoSome discussion about the status here: https://www.reddit.com/r/Citybound/comments/r2z8mh/this_just_felt_apt/ https://www.reddit.com/r/Citybound/comments/r2z8mh/this_just...
- artursapek 4y ago
- your_challenger 4y agoRewriting it in Rust killed it! (Not particularly, but the dev did not even make a working prototype in JS before getting in on the Rust hype-train. He wanted to work on cool actor models, complex systems, et al and over-engineered the project. I have nothing against him. It's his project and he gets to decide what it becomes.) (He did go though a hard time - working fulltime (I think) on this for quite a while, not having a great work-life balance, etc)
- rusticpenn 4y agoI think erlang would have been a more natural choice here.
- chaostheory 4y agoJava, Scala, and C# also have a mature, distributed, actor model framework called Akka
- rapnie 4y agoGolang and .NET with https://proto.actor https://proto.actor
- chaostheory 4y agoThis looks great. How does it compare with Akka?
- capableweb 4y agoJudging by a previous thread about Citybound, the author is aware of Erlang and was used as an inspiration (https://news.ycombinator.com/item?id=19587634 https://news.ycombinator.com/item?id=19587634): > A 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.
- sriram_malhar 4y agoHow does one do simulation without synchrony and some kind of global clock? Actors and message passing aren't sufficient; at the very least one needs causal ordering, and even that won't be enough, I suspect.
- tinco 4y agoWhy would you need a clock for causal ordering? You don't need every actor to respond to a change at the same time.
- sriram_malhar 4y agoConsider: A sends a message to "x = 2" to B and C. B receives this message and sends "x = 3" to C. Now, C receives two messages one from A and one from B. It could receive them in any order. However, there is no way for it to tell whether there is a causal order or not. With a clock embedded in the messages, one can state that "x=2" happened before "x=3". (or more strictly, "x=3" def did not happen before "x=2"). Extending this, if C and D receive copies of the above messages from A and B, we want C and D to both process them in the same (deterministic) order.
- tinco 4y agoBesides that it's a very synthetic example that I don't think makes sense in the context of a city simulation, I think that it's also a bad design. You shouldn't have multiple authorities on the value of x, C shouldn't rely on both A and B to get a value for x. In the context of a city simulator, every road segment could be an actor, as well as every simulated vehicle. Two vehicles might try to enter a road segment at the same time, so they both send a message :enter(entity_1) to :road_segment_1. Then the :road_segment_1 actor decides what to do with those messages. Structuring it this way allows you to massively distribute these kinds of simulations, which is exactly why citybound attempted an actor-based approach. There's a load of overhead, and there's still issues with buffers and backpressure, but in theory you could infinitely scale a simulation this way.
- manigandham 4y agoIt's always interesting to see this approach. It's becoming more common now with more capable hardware but never seems to quite fit as it requires so many inputs and the emergent properties can be unpredictable and cause issues with the main game loop. Dwarf Fortress is probably the best example of raw simulation building to complex organizations: https://en.wikipedia.org/wiki/Dwarf_Fortress https://en.wikipedia.org/wiki/Dwarf_Fortress I've thought about building a more generic system to simulate characters that can be plugged into many of these open-world and other games that need activity to fill cities and locations.
- billfruit 4y agoDoes it simulate realistic construction times? The city building games I have seen are far to gamified in that respect.
- ChadNauseam 4y agoFor realism, whenever road work is being done they should block off the area for 6 months without a single worker ever being present before any construction begins
- 41b696ef1113 4y agoFor realism, would need block off not just the area for construction, but also the up/downstream five miles.
- hedora 4y agoThey should have different modes for different states. In California, the plots should generate more tax revenue when being built, and there should be a 75% chance the owner is bankrupted before it breaks ground. After completion, basic things that should have been checked by inspectors should go horribly wrong. (Electrical fires, sewage backups, landslides, etc.) There should be an optional environmental tax that doubles revenues and construction times, but causes massive environmental damage about 25% of the time, and attracts the mob, regardless. In other places, like rural Texas, there wouldn't be any building codes or zoning in unincorporated areas, and you'd need to maintain a fleet of aircraft to enforce property taxes. 75% of buildings would just fall over every few decades. In Texas, the entire power grid would collapse periodically. In California, there would he weekly brownouts in rural areas, and natural gas exlosions would sometimes destroy entire city blocks. When this happened, PG&E would get to arbitrarily raid the government coffers, and funnel the money into organized crime.
- St_Alfonzo 4y agoI dont know if the construction times are perfectly realistic, but I would recommend "Workers & Resources: Soviet Republic" for this aspect.
- ecdavis 4y agoHighly complex, in-depth, system simulation is like a siren song for game developers and players alike. There's this perception that an amazing simulation will be the basis for an amazing game. In practice, high-quality simulations seem to be interesting but not all that fun. See: F.E.A.R.'s Goal-Oriented Action Planning (https://alumni.media.mit.edu/~jorkin/goap.html https://alumni.media.mit.edu/~jorkin/goap.html) which had to be modified to broadcast its intent to the player, because play-testers felt the game was unfair and that the A.I. was cheating. And it also seems like players can't really tell the difference between a sophisticated simulation and a handful of heuristics with some calls to random() thrown in. From the perspective of a player who does not know how the simulation works, the latter can _seem_ like the output of a complex system. See: _Designing Games_ by Tynan Sylvester, developer of RimWorld (https://tynansylvester.com/book/ https://tynansylvester.com/book/). Dwarf Fortress, I think, is the exception which proves this rule. Anyway, I think simulations like this are really cool to build, but hard to turn into a fun game.
- w-ll 4y agoWait till the Spiffing Brit get's his hands on it.
- Forgeties79 4y agoHow “advanced” would you say _Designing Games_ is? I’m a layman with an amateur interest in game development.
- ecdavis 4y agoIt's very accessible. If you can grok the first 30 minutes of this talk you can grok the book: https://www.youtube.com/watch?v=VdqhHKjepiE https://www.youtube.com/watch?v=VdqhHKjepiE Strong recommend, if only to understand how RimWorld was designed and built.
- Forgeties79 4y agoThanks! Appreciate the insight
- kome 4y agoSimCity 2013 https://en.wikipedia.org/wiki/SimCity_(2013_video_game) https://en.wikipedia.org/wiki/SimCity_(2013_video_game) was a (bad) game that also used actor-based simulation to model city dynamics. The game was a disaster for a DRM scandal; but also the game in itself required too much computing power, and the simulation wasn't that good. edit: https://www.youtube.com/watch?v=eZfj7LEFT98 https://www.youtube.com/watch?v=eZfj7LEFT98 "Exploring SimCity: A Conscious Process of Discovery"
- Macha 4y agoAnd Cities Skylines was a better game that used an actor based model released shortly after. Some of it was an evolution of their entirely transport focused Cities In Motion series, and some of it a reaction to Simcity 2013.
- YesBox 4y agoIm working on a game in the same vein: Archapolis, a city builder with real time traffic simulation and interior views of your citizens homes (which you can customize/build yourself if you want), so you can watch them live their lives. I'd like the player to have a more hands on approach to managing the city as well. Here's a tech demo of what I've been working on: https://www.youtube.com/watch?v=7q0l87hwmkI https://www.youtube.com/watch?v=7q0l87hwmkI I created a path finding algorithm that can simultaneously path hundreds of thousands of units to random destinations at a comfortable frame rate (or around 100-200K like in the video using one CPU core). Units can choose from any of the shortest paths between two points (there are many in a grid), and from those paths, can also choose the path that matches any preferences they have. Very early stages of development still!
- Aeolun 4y agoI’m confused. The game says 55 fps, but it looks like 4? Is it just computing positions at a lower rate while rendering at 55? Anyway, from my experience with Songs of Syx, which also has large scale pathfinding, I’d like to encourage you to find a way to spread it (and other calculations) around. When you reach larger city sizes, the game becomes noticably slower on some ticks. Still smooth, but when your guys are moving at 4x speed, and everyone suddenly slows down to 2x speed (presumably because calculations take so long that running at 4x isn’t possible any more), it’s very jarring.
- fnordpiglet 4y agoProbably 4 simulation steps per second ?
- YesBox 4y agoRight now the units are moving in tile-sized increments. I'll be implementing floating point movement soon. I move the map around while the units are moving and you'll see its not at 4 FPS. I think with any quasi-infinite growth game, you are going to run into a problem of it slowing down, eventually. That's what inspired me to create this algorithm. I wanted a game that could scale, and traditionally path finding is a CPU intensive task. The video I linked is out of date, I'll be making a new one soon. Now: building the path finding graph is now stored in a vector (i.e. array) instead of an unordered_map (and still has constant time access/find). This cut CPU cycles by 66% since a vector doesnt use linked list/pointers/store a hash, and reduced RAM requirements by 75%. Then I parallelized that part of the code base. So for my 6 core machine, I can find all the all-pairs, all-possible shortest paths in a 50 x 50 grid of roads in 10 seconds. This is about 13 square miles of city if each block is the size of a Manhattan block. I'll be working around this time by implementing a planning mode so it only updates as needed.
- edfletcher_t137 4y agoI built a minimal city sim in HTML+vanilla JS a couple years ago and similarly used a "microscopic transport simulation" (you can see roads get "redder" as traffic increases during peak times) and a similar model of having households seek out their requirements. Everything on a much smaller & simpler scale obviously, but clearly I've though about how neat it would be to see something larger along these lines. This project looks like exactly that. Absolutely love it, will be following closely and hoping it matures into something wonderful. (https://pc.computerpho.be/ https://pc.computerpho.be/)
- Reflecticon 4y agoLooks a bit like A-Train back in the day, which I played religiously!
- dzogchen 4y agoLooks like you can only build highly inefficient, economically infeasible car-dependent suburbs with this game.
- lloydatkinson 4y agoI’m not one to usually judge a game by it’s visuals but it’s simplified pastel coloured dumb UI really doesn’t give a good first impression.
- theanzelm 4y agoHi! I’m the developer of Citybound. I’m happily surprised to find this on HN again. The project is currently on a hiatus because I’m focusing on building a startup, but Citybound is an will always be my 100% passion and “anything goes” research project. I’m not on a computer today, but I will try to get back to everyone who posted in this thread. If you have any other questions about the project or the tech please just reply to this! (Side note: the main way I built a wonderful community for Citybound was to directly reply to each and every comment whenever it got interest somewhere - a tactic I can highly recommend)
- capableweb 4y agoHas/is the community contributed anything directly to the game/simulation/code base or are you referring to a community of players? Looking back when I used to follow the project, it has mostly seen like you've been the sole developer with only sporadic contributions from others.
- theanzelm 4y agoI had one person join as a significant contributor for a while early on. Unfortunately life circumstances brought us apart, I only reconnected with them now after many years. There were a couple other direct contributors to the code, which always made me really happy, but the idiosyncracy of the codebase made it hard for others to contribute more than housekeeping/refactoring. The rest of the community contributed through lots of in-depth discussions, ideas, what-ifs etc. I'm really grateful for all the interest and thoughtfulness my community always displayed.
- breakbread 4y agoDude. So happy to see you get posted here. I was following you for a while on Reddit, but don’t know why I stopped. Anyways, I love this project.
- theanzelm 4y agoThank you, that means a lot to me.
- lopatin 4y agoHas anything like this been done for simulating the economy of a country?
- adanto6840 4y agoShameless plugs for the two games I created, incoming! Both games use an "actor/agent" -based AI. The AI is driven via needs-based utility scoring & heuristics, and action/object selection uses attenuated-delta scoring; this creates agent behavior that is "opportunistic". The AI itself is largely based on prior work, substantial portions of which I believe can be (at least largely) attributed to Don Hopkins, who I see posting here pretty regularly. :) SimAirport - https://store.steampowered.com/app/598330/SimAirport/ https://store.steampowered.com/app/598330/SimAirport/ SimCasino - https://store.steampowered.com/app/1158420/SimCasino/ https://store.steampowered.com/app/1158420/SimCasino/
- namrog84 4y agoDo you have any good reference/links for wanting to learn more about implementing or doing something with utility scoring and heuristics? Or any of the tech behind those games? I'd played SimAirport but would love to learn more about the tech because I am a hobbyist gamedev