10 ms·
Author 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 mai
by theanzelm 8y ago
Author 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.
- segmondy 8y agoVery nice, how did you decide on your simulation? did you build a generic simulation engine you can reuse, or is your simulation tightly coupled to the objects you are simulating? It's fun seeing this, I have been recently thinking of a simulation game and wondering if to use a generic simulation library such as SimPy
- theanzelm 8y agoI build a simulation engine, based on a high performance distributed actor system library I wrote for just this purpose. It is generic, but a lot of the performance trade-offs are with Citybound's needs as the main driver.
- izend 8y agoI see you didn't use Actix or even Tokio, could you please explain why?
- theanzelm 8y agoTheir actor implementation / event loop works on a higher level than mine. Mine is super simplistic intentionally to offer high performance. Being optimised for cache locality, processing similar actors in batches, using custom allocators and having encoding-free communication, it has many parallels to data-driven game engine design or even entity component systems.
- izend 8y agocargo +nightly run of the examples in your Kay project appears to be broken, I'd love to explore using it in a future project.
- 384028345 8y agoFirst time I hear about compile times being an issue with Rust. Is that a general problem with bigger projects or can you identify language features that add specifically to the problem?
- Zecc 8y agoYou might be interested in hearing what Chucklefish, the creators of Starbound, have to say about Rust:: https://www.reddit.com/r/rust/comments/78bowa/hey_this_is_kyren_from_chucklefish_we_make_and/ https://www.reddit.com/r/rust/comments/78bowa/hey_this_is_ky... https://www.rust-lang.org/static/pdfs/Rust-Chucklefish-Whitepaper.pdf https://www.rust-lang.org/static/pdfs/Rust-Chucklefish-White...
- deleted 8y ago[deleted]
- jklinger410 8y agoInteresting that I didn't see Cities: Skylines on the inspiration list. Intentional snub? Haven't played it? Just forgot? Curious.
- deleted 8y ago[deleted]
- theanzelm 8y agoI didn't play it enough (yet) to feel comfortable putting it there, compared to the other things I listed as inspiration. I feel like it deserves a more in-depth comment/comparison. I've only watched let's plays of it so far.
- jklinger410 8y agoYou should check it out more! I love it. There are some similarities to the way your project is put together.
- zepearl 8y agoI like it as well a lot, but after several hours of playing with it I started focusing too much on some things that I consider core flaws of the game and now I'm not motivated very much anymore to keep playing... . Examples: - utility services: I keep having problems with e.g. ambulances or trash collectors that are spawned very very far from the area where they're actually needed, even if a hospital or incinerator is just around the corner. - size of buildings: I don't like the approach of having tall buildings / high-rise in developed high-value zones by default. In my opinion the size of a building should mirror only the density of the population living in that particular area, so it should be possible to have as well tall buildings in low-value zones. As well the amount of people living in tall buildings is for my taste not a lot different from the one of med/low-buildings, taking into consideration the height of the building... => how tall is a building should be a function of the people inhabiting it and not related to the value of the zone. - deaths/births waves: once my cities got big, I kept getting each time waves of people dying and later a lot of births. There is a plugin that fixes this, but this should really be part of the basic game. - traffic: this is actually already working veeeery well on multiple levels (e.g. very nice/interesting to observe how queues generate - I can observe that for hours hehe) but I do miss a logic that says e.g. "if this section of street has during a certain timespan ~95% of space occupied by vehicles then assume that there is a queue => mark that section of street temporarily non-existing for non-involved vehicles so that other cars would start looking for alternative paths" or something similar. All in all, even if Cities Skylines was already a giant leap compared to the classical Simcity-games (excluding the last one which was just horrible), I'd definitely like more "action=>reaction"/"cause=>effect" in a potential future "Cities Skylines 2" or in this case in "CityBound". Cheers EDIT: for more details search in this page for the post containing "Unfortunately, traffic management is the only part of the game that really holds up as a simulator" by "amyjess" - I just read it now and I think that I agree as well with all what's mentioned there about CS (but I honestly don't rememember anymore how Simcity4 worked...).
- pault 8y agoCan you talk about the road building engine? Are you using splines to generate the smooth curves? This is a really amazing project, I can tell you have put a ton of work into it.
- theanzelm 8y agoThere's a lot of interesting stuff going on in there. First, for the curves itself, it does a kind of naive approximation optimisation and builds a curve out of line and arc segments that tries to follow the control points as closely as possible. Then it does an intersection step between all roads and procedurally generates correct connections between all incoming and outgoing lanes of each intersection, including (somewhat) reasonable traffic light timings for each "turn group"
- sansnomme 8y agoCongrats on shipping! It looks beautiful. How long did it take you to build this?
- theanzelm 8y agoI didn't really ship it yet (got posted here by someone else), it's in continuous development for already ~5 years.
- lewis500 8y agoDo you have a writeup of the traffic simulation rules that you're using? I peeked in the code and saw the intelligent driver model is being used for acceleration. I suppose you also have a lane-changing model and such, too. Your architecture could be very useful in teaching.
- theanzelm 8y agoYes, I also have a lane changing model. What exactly would you like to see in a writeup? And which teaching setting do you have in mind?
- Dowwie 8y agoUniversity setting. Many universities in major urban areas have a school of housing and community development. They study planning, policy, design, economics, and other related disciplines. Once trained with how to create new models in your system, academics could simulate the impact of ideas they are developing in research.
- adanto6840 8y agoAh, I'd love to hear more about this! Getting traffic right is much tougher than we appreciated at first. Disclaimer: Creator & lead developer of SimAirport. I suppose we just did it "wrong" to begin with, and have since been stuck with the wrong graph / haven't put the time into fixing it yet -- but would be curious to hear high-level of how you're doing it. Our issues are primarily that we did lanes as graph nodes instead of "node capacity" so our pathfinding prescribes precisely which lane to use; when stuck in traffic we can't intelligently find our way around it without pathfinding again, but then 'quality' ends up being correlated to how often we pathfind with node-occupancy info, which obviously is a poor (and poorly performing) solution. Would love to hear your approach or if you'd be interested in talking shop at all, email is in profile! :)
- theanzelm 8y agoFirst time I saw SimAirport, looks wonderfully antsy! I'd love to discuss traffic with you on the Citybound subreddit, since I think there might be other people interested in such implementation details :)
- faitswulff 8y agoIs this your talk? https://www.youtube.com/watch?v=LiIoE8ArACs https://www.youtube.com/watch?v=LiIoE8ArACs It was great, if so!
- theanzelm 8y agoYes, that's me. Thanks!
- partisan 8y agoThat is a really inspiring talk. I suspect I’ll be playing with Rust this weekend.
- Iv 8y agoReally nice talk! And thanks for this, the actors architecture really talks to me. I am trying to find a distributed architecture that would make sense for a collaborative project I have and this could actually solve many of my problems. I had not considered that message passing could actually be very fast when done right.
- ncallaway 8y agoIt was a really great talk, thank you for that! One direction that I've seen a lot of game engines heading in lately is the Entity Component System model for a lot of the same performance reasons (cache locality of data being the big one) that you've landed on the Actor model. I'd be curious to know if you'd looked into the ECS model at all, and if you have how you view the tradeoffs between that model and the Actor model proposed in the talk. At a gut level, I get the feeling that your model seems much better suited to the distributed nature that you accomplish in your talk, and that ECS might be slightly more effective at allowing composition in an effective way. You've got so much more experience with both, though, that I'd love to hear you take if you've got one.
- malandrew 8y agoAre cities always flat?
- theanzelm 8y agoOnce most features work in 2D, I’ll extend to 3D terrain. I’ll probably have over and underpasses before that for better traffic routing.
- soperj 8y agoAlways thought it would be really cool to do a city based on no roads at all, but bike paths and public transport. Ever think this will get to the point where I can play around with that? Thanks.
- teslaberry 8y agoi live in manhattan, i'd love for you to simulate congestion pricing. i hate cars ,but i think congestion pricing as a unilateral policy is an absolutely horrible idea. what do you think? it's a simple cash grab and it's a stupid backwards ass idea, creating artificial scarcity instead of directly pursuing gains in productivity.
- inferiorhuman 8y agoIs there any documentation? The aeplay.org site looks still to be mostly developer oriented.
- theanzelm 8y agoNot really. Which documentation exactly do you mean? Code or for players?
- inferiorhuman 8y agoOh even just usage instructions. Like what are the navigation controls, etc. I zoned some things and laid down some road and wasn't sure what or when to expect it. Some of the bugs as well make me unsure if my expectations are wrong or if it's just a bug (e.g. vehicle traffic not appearing, roads and zoning going in weird shapes). Some of the links in the top-level readme are 404 as well. All in all I'm sure I'll spend a ton of time playing the game itself and playing with the source.
- theanzelm 8y agoThere is a small tutorial in the game menu and you can check the settings for keybindings.
- inferiorhuman 8y agoYeah I saw that but I'm still largely unsure about a lot of bits and pieces about the game play. Mostly it's a matter of determining what's intended behavior and what's not (e.g. the traffic jams for no apparent reason that may or may not have other cars passing them in the same lane), but also what things like those big arrows on the road (that persist sometimes).
- DoreenMichele 8y agoFeel free to ask me any questions about the project! I hope to learn to code. I just got my rejection letter from a coding school ("overwhelming demand -- we had to turn down many qualified candidates"). My backup plan is some free online coursework and probably finding a city-building game to mod or tinker with. When you say open source, does that mean it would be okay for me to futz with it for myself like that? Thanks.
- jacobolus 8y agoYes, you can futz. Here is the license https://github.com/citybound/citybound/blob/master/LICENSE.txt https://github.com/citybound/citybound/blob/master/LICENSE.t... Read about it here https://www.gnu.org/licenses/agpl.html https://www.gnu.org/licenses/agpl.html Having a license that says you can go play with it doesn’t mean it will be straightforward as a newcomer to understand the code you find or to accomplish any particular goal with your fiddling. I haven’t looked closely at this project, but I would recommend at least considering starting out fiddling with a simpler system, if you want to learn to code.
- DoreenMichele 8y agoThanks. I don't know that I will even learn Rust. I have had a Python course recommended to me. I just am trying to figure out what my options are. I've gotten serious push back at times for what I felt were innocent activities. Trying to ask the "dumb" questions in hopes of avoiding that. The links are helpful. Looking them over.
- hluska 8y agoI recognize your username and you’re a precise writer. You’d likely be quite a good developer. I’m going to give you some unsolicited advice. Start now. If you’re struggling to find a course, start here: https://www.railstutorial.org/book https://www.railstutorial.org/book Don’t worry if Rails is the right choice. You might love it or hate it, but regardless, you’ll learn things like writing tests and using version control. Good luck and have fun.
- dnautics 8y agoAmazing work! Your statement says that you have actor-based simulation model that's inspired by erlang - is there a reason why you picked rust instead of a BEAM language for developing the backend? My guess would be performance, maybe?
- corysama 8y agoYou'll like this: https://www.youtube.com/watch?v=LiIoE8ArACs https://www.youtube.com/watch?v=LiIoE8ArACs
- dnautics 8y agoRust is interesting to me but honestly, I'm going to stick to elixir because I have high confidence I can train juniors to code safely on it, and I have no particular need for performance (most of my stuff is iO or network bound)
- eggy 8y agoWrite NIFs in Rust, or C if you want to stay on the BEAM, and still get performance if you need it. Elixir/Phoenix are the Ruby/Rails of today. I do like getting low-level within the same PL, so this has truly inspired me to dig more into Rust. I am still playing with Zig though.
- theanzelm 8y agoExactly. My actor system operates on much smaller, much simpler actors. See the sibling comment for my in-depth talk on it.
- fendy3002 8y agoInteresting that you take factorio as inspiration. May I know what part of factorio that you want to add into, that seems lacking in other games of same genre like sim city? On the other hand, how do you plan for in-game scale / limit? (Millions of population, etc) and whether you have any idea about multiplayer/server (I'm talking similar with clustertorio)
- theanzelm 8y agoThe thing that impresses me with factorio is how smoothly the game challenges scale with you learning and mastering one game aspect after the other. Basically, you learn something that solves all your current problems, but that directly creates new problems, which you then have to deal with using your newfound powers. The actor architecture makes it very easy to scale the simulation across several machines and indeed run a simulation cluster that you connect to from a simple client. In fact it already almost works like that. And the only thing that's missing for multiplayer is some UI-level coordination for collaborative planning (basically preventing editing conflicts). Everything else is already "multiplayer ready".
- neilwilson 8y agoI see there is a bit in there about the city economy. Are you interested in expanding that to supporting a full monetary economy with employment, commuting and the like? That certainly interests me - particularly how the pathologies of an economy like that emerge from individual actions - and I’ve been looking at Elixir to generate the necessary actor simulation engine. Looks to me like you have that here in Rust. How could I get involved in helping to add a more detailed economy to this sim?
- microcolonel 8y ago> ...and I’ve been looking at Elixir to generate the necessary actor simulation engine. Looks to me like you have that here in Rust. I will caution that Elixir's runtime performance, particularly with simulation type code, is abysmal. Also, last time I was using Elixir, the available profiling infrastructure was really terrible; I had to buy a new workstation with 64GiB of RAM just to be able to fit the profiling artifacts from one iteration of our small model in memory, which was required in order for it to complete in less than infinite time.
- theanzelm 8y agoThere is already a monetary economy with employment, commuting and purchases. One of the things I hope to do soon is to factor out some of the variables of the economy simulation to make it easier to mod without having to understand the full codebase. Then would be a great time for you to experiment with it.
- jason_slack 8y agoI wanna help with this project. I wrote a lot of personal changes to Micropolis.
- bromuro 8y agoI was following the project since the death of sim city! Happy you made it! Congrats bro.
- incog-neato 8y agoCan you explain something about "Special recursively-compact containers"? I couldn't find any search hits for the phrase.
- incog-neato 8y agoThis is what I was looking for: https://github.com/aeickhoff/compact https://github.com/aeickhoff/compact Cool containers.