I’m writing a game in Rust for fun. It seems specs is the accepted ‘gold standard’ ECS implementation in Rust. However, I have a few concerns with it:
- Hidden limits – for example, the limit of 220 entities on 32-bit systems. Sure, you could argue that if you have that many entities you’re doing it wrong, but it’s the principle of the thing: unstated limits are somewhat alarming. That’s why the Rust documentation explicitly lists any possible panics for a function.
- Less-than-stellar documentation. Apart from the hidden pitfalls as mentioned above, specs is very, very opaque for people who come to ECS fairly new (I speak from experience) and it’s inner workings aren’t well explained either, which makes it hard to understand and extend.
- Use of
unsafe. A quick grep suggests that there are over 100 uses of
unsafein specs. I’m not an expert and perhaps it’s all perfectly fine in the end, but again, I’m writing an MMO and I’d prefer to avoid potential vulnerabilities. And 100 uses of
unsafeis a lot of room for that.
I suspect that problem #2, in particular, is causing ecosystem fragmentation (just search ‘ecs’ on crates.io for an example of what I’m talking about). People who are unable to understand specs (like myself) go off and write their own ‘simple’ ECS (like myself) and publish it (like myself), causing confusion and drawing off programmers who would otherwise be improving specs and helping newcomers.
I wish everyone could use specs. It’s a marvel of engineering (IMHO) and I’ve referenced it many times for ideas while building my own ECS. I’d be willing to switch to specs – and to help document it – if I only understood it. But I don’t, primarily because the documentation is insufficient!! Chicken and egg.
Currently, I’m considering writing a tutorial on How to Write an ECS, to help people understand ECS implementation without rolling their own and causing further fragmentation. But Specs is right there, if only I and everyone else could use it. What to do?