miniplex
miniplex copied to clipboard
Future Packages
Drafting ideas for future packages we could provide.
miniplex-kit
Provides a collection of components and systems that are useful in many projects:
- Entity age
- Cooldowns/Timeouts
- Auto destroy entities
- Intervals
miniplex-fiber
Provides extra glue for use in react-three-fiber:
- World Inspector UI
- System Runner that integrates with r3f's upcoming
useUpdate
and provides some debugging UI
How do you see miniplex-kit working? I'm interested in understanding how entity age/cooldowns/intervals would work in an ECS (miniplex is the first I've used so I don't have all the context around them). If I wanted to implement them in miniplex today I suppose I'd store delta every tick and then act on it when appropriate. What are you thinking?
I typically build my systems as functions that receive a deltatime as their argument, and mount them in a react-three-fiber useFrame
somewhere, passing on the deltatime argument the callback receives to the system. One thing I've done a bunch of times is to give entities optional age: number
and maxAge: number
properties, and implementing a LifetimeSystem
that accumulates the received deltatime values on age
, and queues the entity for destruction if age >= maxAge
.
Things like these could be packaged into separate libraries (like eg. miniplex-kit
.) The challenge here is that the more generic you want to make these implementations, the harder it is to "get them right". A library like this that targets R3F games specifically will probably look and feel entirely different from one that tries to be usable in "any" project.