Remix.run Logo
wavemode 2 days 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 4 hours 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 3 hours 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 2 days 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 15 hours 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.