5 ms·
Hey HN! I'm the developer of Metropolis 1998. Unfortunately the launch date in the article has come and passed, but that's how things are in game development w
by YesBox 1y ago
Hey HN!
I'm the developer of Metropolis 1998. Unfortunately the launch date in the article has come and passed, but that's how things are in game development world. :D
Some tech talk:
- Custom engine (C++) using SFML for the graphics framework, and SQLite for database/data oriented design
- True isometric engine. No 3D models, everything you see is hand drawn sprites (made to look like a 3D render ha)
- Since sorting sprites is O(N^2), I figured out a way to create a depth map for each sprite to depth sort on the GPU
- Tons of work went into the pathing code to make it efficient, since this is the traditional bottleneck in these types of games. The game can handle around 100K units and vehicles moving around (on one CPU core)
- The team is just me and a couple part time contractors for the art and buildings.
- Most recent update (some cool skyscraper construction): https://x.com/YesboxStudios/status/1978928991663776224 https://x.com/YesboxStudios/status/1978928991663776224
- Fun fact: the entire game is currently 27 MB.
- Steam: https://store.steampowered.com/app/2287430/Metropolis_1998/ https://store.steampowered.com/app/2287430/Metropolis_1998/
- YesBox 1y agoIf you dont have twitter: https://old.reddit.com/r/Archapolis/comments/1o91vme/added_high_density_residential_buildings/ https://old.reddit.com/r/Archapolis/comments/1o91vme/added_h...
- doctorpangloss 1y agoHave you investigated Unity’s “HPC#”? This is how you can write C++ in it. If you don’t even want to deal with ECS/DOTS.
- YesBox 1y agoI haven’t. One of the reasons I decided to write my own engine was to be able to organize the code/logic my way. I’m pretty sure I would have burnt out from the organizational friction of using eg unity
- lo_zamoyski 1y agoI noticed this bit in the article... "Screenshots suggest cities more complex than suburban plots are possible in Metropolis 1998." Which sounds good, but naturally, all such simulators bake in assumptions about what good urban planning is. These are the kinds that get rewarded by the simulator. SimCity bakes in the awful postwar fetish for suburban sprawl and rigid zoning, for example. Perhaps it isn't always done explicitly - game developers could very well be absorbing prevailing sensibilities and expectations about urban planning unwittingly, for example. Most people today think suburban sprawl is just a fact. They even find it desirable, as that is what they are expected to want or what they grew up with themselves. What I would like to see is a simulator based on traditional principles of urban planning or the 15 minute neighborhood or whatever. This could have the benefit of stirring the imagination of future urban planners to look beyond broken postwar patterns. (Side note: the Venice Biennale this year features more examples of sustainable architecture and green adaptations of existing buildings, which is a welcome change compared to the usual practice of the weird architecture Olympics where vain architects compete to maximize how bizarre they can make a building, which is not to say beautiful or useful.)
- PedroBatista 1y agoYes.. but: Don't forget this is a game, and the main mission of a game is to be FUN.
- lo_zamoyski 1y agoSure, but I think doing this would actually make it fun. The weird, inhuman assumptions SimCity and other simulators make, I argue, make those games less fun, because they leave you with a city that looks offensive. You're no longer managing or building a city with good vision in mind. You're just some boring manager operating within boring rules.
- kkukshtel 1y agoFrom one hand-pixeled isometric dev (https://store.steampowered.com/app/690370/Cantata/ https://store.steampowered.com/app/690370/Cantata/) to another, congrats! People really discount the complexity of doing isometric — it's a surprisingly nuanced thing to implement, especially if you want inner-tile sorting/depth, tiles that occlude others, etc. For sorting for me I ended up using geometry shaders with fixed layers to basically emit objects on top of each other and render everything in one pass. It makes things like the editor and runtime incredible fast, which looks like you did as well! Happy to see more games with this style, I think the look is unbeatable.
- YesBox 1y agoThanks! Sorting whole sprites is definitely a complicated problem and it took some time to arrive at the solution I use today.
- vivalahn 1y ago[dead]
- _fat_santa 1y agoI know this is probably super low on your priority list but any plans for a Linux port?
- YesBox 1y agoIll be looking into porting after launch, so its possible!
- em-bee 1y agoFun fact: the entire game is currently 27 MB just got the demo, this is literally the smallest game in my collection. impressive
- munificent 1y ago> Since sorting sprites is O(N^2), You probably know this already but sorting is `N log(N)` in the general case but `N` when the range of values is known and relative small using pigeonhole sort [1]. That's probably what you're doing on the GPU. [1]: https://en.wikipedia.org/wiki/Pigeonhole_sort https://en.wikipedia.org/wiki/Pigeonhole_sort
- YesBox 1y agoIt's been 2-3 years since I've thought about this. I dug around and found an article that said the time complexity (for topological sorting of sprites) was O(N^2) [1] It appears there are O(n log n) algorithms though, I just didnt come across them at the time :) EDIT: Or maybe not! I dont have time to dig into this, but it may not be accurate enough Im not sure that would work for my use case though, since you can see inside the buildings in my game (and there's see thru windows!). A bunch of high density buildings will be drawing tens of thousands of sprites within the camera's field of view. For anyone who's interested, here's the scope of the problem: Isometric projection is simulating a 3D world by layering 2D sprites in a specific order. Notably, units/vehicles in the game have smooth (floating point) movement, so they can be e.g. partially occluded by a wall or another object. My game also has pixel thin walls that can be placed on any edge of a tile. So imagine sorting a vehicle sprite behind two wall sprites (the vehicle sprites are twice as wide) as it's moving across them. All you have are rectangles to work with. Now add in a stationary plant in front the wall, and a person walking in front of the plant, the two walls, and the vehicle. e.g. There will be a time when the front the vehicle (the bottom of the rectangle sprite) is lower (i.e. closer to the camera) than a wall sprite, but the vehicle would still be occluded by the wall. [1] https://mazebert.com/forum/news/isometric-depth-sorting--id775/ https://mazebert.com/forum/news/isometric-depth-sorting--id7...
- munificent 1y agoIf you're happy with your engine's behavior and performance than feel free to disregard. But if it is something you want to noodle on... > I dug around and found an article that said the time complexity (for topological sorting of sprites) was O(N^2) Topo sort in general is O(V + E) where V is the number of vertices in the graph and E is the number of edges. If you consider your set of sprites a graph with an edge between every pair of sprites, then it does become O(N + N*N) which is O(N^2). If the only way to get topo sort to work is by treating the sprites as a fully connected graph, then it's not the right approach. Topo sort really only makes sense when the number of edges between nodes is relatively low. You'd be better off using quicksort which is O(N log N). However, since you are going to be resorting the same data each frame and most sprites stay in the same order, what you want is a sorting algorithm that works well on mostly-sorted data. In that case, I suspect insertion sort is what you want. It will roughly behave like O(N) when the data is mostly sorted. Alternatively, you could look at bucket sort. While your sprites can be freely positioned with floating point coordinates (which makes pigeonhole sort a poor fit), they still fall within a known finite range, and bucket sort is designed to handle that case.
- nonethewiser 1y agoThe art and little people walking around remind me of roller coaster tycoon. Very interesting looking game.
- treyd 1y ago> - Since sorting sprites is O(N^2), I figured out a way to create a depth map for each sprite to depth sort on the GPU Could you elaborate on this some more? This seems very interesting.
- YesBox 1y agoSee my other comment in this thread. The solution I went for was drawing a 3D box (in 2D space, i.e. in the sprite sheet over each sprite), and then using that box to calculate the local depth within the "diamond"/isometric space is occupies (er, hope that makes sense!)