Remix.run Logo
wavemode 7 months ago

Unrelated to the central point of your comment, but I've also found that a simple entity system is usually perferable to ECS for smaller games. ECS aids performance, but performance usually isn't what you're struggling with in a small indie game. You're mainly just struggling to organize your code, and just need something simple to help manage complexity.

randysalami 7 months ago | parent | next [-]

I built an ECS from scratch back in 2019 using C#. It was my first programming project in earnest and I was 19 at the time. Fortunately, I committed to version control and sometimes I still look at it: https://github.com/randyselimi/ECSRogue

I came up with everything on my own and I don’t know how I was so inspired then. Most of the ECS code is in a folder tilted Partis (that was the name of the ECS system I wanted to develop)

randysalami 7 months ago | parent [-]

Probably my favorite piece of code is in ECSRogue/Partis/Entities/EntityIndexManager.cs. I’d love if someone with more experience could critique this code and my implementation. Keep in mind, I just transferred from community college and hadn’t even taken a single programming/data structure course

LoganDark 7 months ago | parent | prev [-]

Minecraft is an entity system and it seems to work just fine. (Fun fact: Forge Mod Loader makes Minecraft an entity component system.)

immibis 7 months ago | parent [-]

having things called entities and components isn't doing ECS. Minecraft is a traditional OOP class hierarchy of entities, which (with Forge) have a Map<String, Object> whose entities are called components.

In the technically superior Fabric ecosystem, you can add fields directly to the entity class using bytecode modification instead of having HashMap overhead on everything. Accessing them is a bit roundabout, but in a way the JIT compiler can optimize.

LoganDark 7 months ago | parent [-]

Fabric doesn't do too much on its own other than adding Mixin, which is why I didn't mention it. I do agree that it's technically superior though.

immibis 7 months ago | parent [-]

That is its technical superiority. Forge is a specific modified version of Minecraft which comes with a bunch of extra extension points. Fabric is a framework for modifying Minecraft itself, any way you want to. In Fabric, you aren't limited to the predefined extension points since almost every instruction becomes an extension point.

LoganDark 7 months ago | parent [-]

> That is its technical superiority.

I know. I never said otherwise. The fact that it doesn't do what Forge does literally is the benefit. Sorry if that wasn't already clear. It should've been.

Back before I knew Fabric, I constantly cursed Forge because (before they added Mixin as well) a mod could not modify the game in any way Forge hadn't already thought of. On Fabric I could do anything at all.

You're completely missing my point btw, the point was that the reason I didn't mention Fabric is because Forge is the one that adds a bunch of stuff to Minecraft and Fabric just lets mods do whatever they want any way they want. Forge is the one that adds a capability system just intrinsically. Fabric lets you do that if you want (e.g. Cardinal Components API) but it also lets you do anything else you want and doesn't force you to use that architecture if you don't want to.

Also hi Immibis, didn't notice your username the first time :)