7 ms·
Show HN: Interactive ECS Systems/Component Explorer for Cities: Skylines 2
Hello Hacker News! Long time reader but first time poster here...
Recently I've been diving into doing mods for Cities: Skylines 2, which been very interesting as it's one of the first games that is using ECS and that I also have a deep interest into. I've mainly used ECS via Bevy before, but this time it's Unity, but many things still work the same way.
In order to help myself and other modders to navigate the ECS Systems and Components from the decompiled code, I created this interactive D3 graph.
You can click on nodes to "navigate" to that system/component, and once you're zoomed in a particular System/Component, you get a sidebar with more details. Ctrl+click also removes nodes in case you want to temporarily filter something.
This is, in short, how it works:
1. A C# program extracts information from decompiled C# code: https://github.com/Captain-Of-Coit/cs2-ecs-explorer/blob/master/src/cli.cs https://github.com/Captain-Of-Coit/cs2-ecs-explorer/blob/mas...
2. The program outputs that info as JSON: https://github.com/Captain-Of-Coit/cs2-ecs-explorer/blob/master/data/Systems.json https://github.com/Captain-Of-Coit/cs2-ecs-explorer/blob/mas...
3. Render with D3.js: https://github.com/Captain-Of-Coit/cs2-ecs-explorer/blob/master/index.js https://github.com/Captain-Of-Coit/cs2-ecs-explorer/blob/mas...
Basically it helps people to navigate the Systems and Components references for the game.
If you're feeling brave, you can also browse the full graph which has something like ~700 nodes and ~1200 links: https://captain-of-coit.github.io/cs2-ecs-explorer/ https://captain-of-coit.github.io/cs2-ecs-explorer/ (it'll take a while to first load)
A big problem was to figure out how to make the D3 not too messy when there are large graphs, and I don't think I've succeeded very well with this, but everything I tried (link distance based on how many connections, clustering based on namespaces and so on) made it even worse.
Happy to hear what you think and what I could do better.
- deleted 3y ago[deleted]
- elpocko 3y ago[flagged]
- CaptainOfCoit 3y ago> it's one of the first games that is using ECS and that I also have a deep interest into Both, at the same time :) ECS probably been around since at least early 2000s if not even in the 90s. Edit: Wikipedia puts Thief as the "pioneer" of ECS: > In 1998, Thief: The Dark Project pioneered an ECS. (https://dev.to/ovid/the-unknown-design-pattern-1l64 https://dev.to/ovid/the-unknown-design-pattern-1l64) The engine was later used for its sequel, as well and System Shock 2.
- tapoxi 3y agoI think it's one of the first games heavily using Unity DOTS, which probably also explains its launch troubles.
- promiseofbeans 3y agoUnity's new ECS system I assume, not ECS as a general architecture
- deleted 3y ago[deleted]
- colechristensen 3y agoWhat is ECS?
- AndrewDavis 3y agoEntity component system. https://en.wikipedia.org/wiki/Entity_component_system https://en.wikipedia.org/wiki/Entity_component_system
- lolinder 3y agoSlightly off topic, but does anyone know what the status is of Unity's patent on ECS? I remember this thread [0] from a few years ago, and it looks like the patent is still valid [1], but I still see ECS all over the place outside of Unity contexts. Is Unity just not interested in enforcing the patent? Do they know they'd lose if they tried? Or am I missing a recent development? [0] https://news.ycombinator.com/item?id=28447672 https://news.ycombinator.com/item?id=28447672 [1] https://patents.google.com/patent/US10599560B2/en https://patents.google.com/patent/US10599560B2/en
- Laremere 3y agoThe patent abstract indicates it's not a patent on ECS, but a patent on methods to improve performance with ECS systems. The patent was filed in 2018, which is far after ECS was already in commercial use.
- smolder 3y agoAs sibling points out, it's about a specific way of optimizing an ECS style program. That's typical corporate software patent stuff - building a moat with patents that aren't inventive. It's like firing a shotgun into the solution space to create off-limits areas and impede newcomers.
- SeanAnderson 3y agoHere's cart's analysis: https://i.imgur.com/Kmokcmq.png https://i.imgur.com/Kmokcmq.png Cart is the creator of Bevy (ECS engine in Rust) and Sander is the creator of Flecs (ECS engine in C) Assume they lose if they try to enforce it, but don't know of any attempts yet.
- sepen77 3y agoThis is amazing
- CaptainOfCoit 3y agoThank you for the kind words! :)
- kelvie 3y agoAnyone know if mods in general work when running CS2 inside Steam on Linux? It's kinda hard to search for since there are a lot of Cities: Skyline results mixed in.
- CaptainOfCoit 3y agoThere are people who've had success running mods with CS2 on Linux + Steam. Give it a try, and if it doesn't work, jump into the Discord (linked in my profile) and I'm sure we could help you.
- speps 3y agoAs a game dev, I'm starting to feel like ECS isn't the right paradigm. Seeing this 700 nodes graph with all the dependencies screams technical debt and domino effect (changing one small system would impact a lot of other ones). Not sure if there's anything better right now, but seeing everyone copy what Unity did feels like there isn't a ton of innovation in how to build gameplay systems. Lots of engines are being made but not many games come out of it...
- intelVISA 3y agoThis is ECS Done Wrong to be fair, one imagines it'd run even worse with another design.
- CaptainOfCoit 3y ago> This is ECS Done Wrong to be fair How so? Not sure I love the approach of saying something is "Done Wrong" without pointing to something specific that gives you that impression.
- ajmmertens 3y agoJudging by the system & component names this looks to be pretty well designed tbh. There are a lot of systems for sure, but considering this is a city simulator that's kind of expected.
- rightbyte 3y ago> (changing one small system would impact a lot of other ones) Would you not expect that in a sim game though? I mean, why would you have a nice tree when everything interacts with almost everything?
- speps 3y agoOf course, but their use of the ECS seems excessive. I'd have expected a few big systems for each area of the game, clicking on Game.Simulation.AdjustElectricityConsumptionSystem for example reveals quite a lot of things that could be within one system. I bet the current design passes and queries data all over the place, very redundantly.
- lionkor 3y ago> it's one of the first games that is using ECS what do you mean by this?
- riidom 3y ago...and that I also have a deep interest into.
- wickedsickeune 3y agoIt uses Unity's ECS implementation (entity component system), part of DOTS (data oriented stack) https://unity.com/dots https://unity.com/dots
- CaptainOfCoit 3y agoAnother (flagged/dead now) comment also asked this. It's helpful to continue reading that line until the end of it. > > it's one of the first games that is using ECS and that I also have a deep interest into > Both, at the same time :) > ECS probably been around since at least early 2000s if not even in the 90s. https://news.ycombinator.com/item?id=38703926 https://news.ycombinator.com/item?id=38703926 I guess if at least two people asked this question, my initial description wasn't clear enough that it was supposed to be a AND statement.
- cstrahan 3y ago> it's one of the first games that is using ECS and that I also have a deep interest into FWIW, I did read to the end of the line, but I parsed that as two separate assertions (with “and that” being a means to introduce the second assertion): 1) it is one of the first games using ECS 2) that you also have an interest in it Rather than the intersection of: 1) the set of games using ECS 2) the set of games that you have an interest in Or, expressed another way, it’s this (how I read it): (it's one of the first games that is using ECS) and that (I also have a deep interest into) Vs it's one of the first games that: (is using ECS) and that (I also have a deep interest into) I suppose I would have written this: It’s one of the first games using ECS which I have also had an interest in. I’m fairly certain I’ve almost always seen something like “[of] which” to introduce another qualifier, whereas “and” almost always introduces a new statement that stands on its own (the exception being in more formal contexts where there’s a sentence structured along the lines of “consider such [insert class of objects here] which are both: [this] and [that]”). I think it’s the “and that” which threw me (and others here who misread you) off.