miniplex

A ๐Ÿ‘ฉโ€๐Ÿ’ป developer-friendly entity management system for ๐Ÿ•น games and similarly demanding applications, based on ๐Ÿ›  ECS architecture.

MIT License

Downloads
15.2K
Stars
764
Committers
10

Bot releases are visible (Hide)

miniplex - [email protected]

Published by github-actions[bot] about 2 years ago

Patch Changes

  • 877dac5: Fixed: Make use of useIsomorphicLayoutEffect.
miniplex - [email protected]

Published by github-actions[bot] about 2 years ago

Patch Changes

  • c38d7e5: Fixed: A couple of components were using useEffect where it should have been useLayoutEffect.
  • 54bb5ef: Fixed: no longer re-renders once after mounting.
miniplex - [email protected]

Published by github-actions[bot] about 2 years ago

Patch Changes

  • efa21f2: Typing tweaks.
miniplex - [email protected]

Published by github-actions[bot] about 2 years ago

Patch Changes

  • efa21f2: Typing tweaks.
miniplex - [email protected]

Published by github-actions[bot] about 2 years ago

Patch Changes

  • c12dfc1: Fixed: Improved typing of createEntity.
miniplex - [email protected]

Published by github-actions[bot] about 2 years ago

Patch Changes

  • c102f2d: New: <ArchetypeEntities>, a new component that (reactively) renders all entities of the specified archetype.
miniplex - [email protected]

Published by github-actions[bot] about 2 years ago

Patch Changes

  • 1950b9b: General cleanup and typing improvements.
miniplex - [email protected]

Published by github-actions[bot] about 2 years ago

Patch Changes

  • 551dcd9: The createECS function now allows you to pass in an existing World instance as its first argument. If no world is passed, it will create a new one (using the specified type, if any), as it has previously.
miniplex - [email protected]

Published by github-actions[bot] about 2 years ago

Major Changes

  • 4016fb2: 1.0!

Patch Changes

miniplex - [email protected]

Published by github-actions[bot] about 2 years ago

Major Changes

  • 4016fb2: 1.0!

Patch Changes

  • 410e0f6: The World class can now be instantiated with an initial list of entities like so:

    const world = new World({ entities: [entity1, entity2] })
    
miniplex - [email protected]

Published by github-actions[bot] about 2 years ago

Minor Changes

  • 769dba7: Major Breaking Change: The signature of addComponent has been simplified to accept an entity, a component name, and the value of the component:

    /* Before */
    world.addComponent(entity, { position: { x: 0, y: 0 } })
    
    /* After */
    world.addComponent(entity, "position", { x: 0, y: 0 })
    

    The previous API for addComponent is now available as extendEntity, but marked as deprecated.

  • b8b2c9b: Breaking Change: The API signature of createEntity has been simplified in order to improve clarity of the API and reduce complexity in both implementation and types. createEntity now only supports a single argument, which must satisfy the world's entity type.

    This will only affect you if you have been using createEntity with more than one argument in order to compose entities from partial entities, like so:

    const entity = createEntity(position(0, 0), velocity(1, 1), health(100))
    

    This always had the issue of createEntity not checking the initial state of the entity against the world's entity type. Theoretically, the library could invest some additional effort into complex type assembly to ensure that the entity is valid, but there are enough object composition tools available already, so it felt like an unneccessary duplication.

    Instead, composition is now deferred into userland, where one of the most simple tools is the spread operator:

    const entity = createEntity({
      ...position(0, 0),
      ...velocity(1, 1),
      ...health(100)
    })
    
  • cb6d078: Breaking Change: When destroying entities, they are now removed from the world's global list of entities as well as the archetypes' lists of entities using the shuffle-and-pop pattern. This has the following side-effects that may impact your code:

    • Entities are no longer guaranteed to stay in the same order.
    • The entity ID storied in its internal __miniplex component no longer corresponds to its index in the entities array.

    This change provides significantly improved performance in situations where a large number of entities are continuously being created and destroyed.

  • 4d9e51b: Breaking Change: Removed the EntityID and ComponentData types.

miniplex - [email protected]

Published by github-actions[bot] about 2 years ago

Patch Changes

  • dd047e9: This package now loads miniplex as a direct dependency; it is no longer necessary to install miniplex as a peer dependency.
  • Updated dependencies [769dba7]
  • Updated dependencies [b8b2c9b]
  • Updated dependencies [cb6d078]
  • Updated dependencies [4d9e51b]
miniplex - [email protected]

Published by github-actions[bot] about 2 years ago

Patch Changes

  • 1422853: Fixed return type of useArchetype.
miniplex - [email protected]

Published by github-actions[bot] about 2 years ago

Patch Changes

  • 5ef5f95: Included RegisteredEntity in ArchetypeEntity. (@benwest)
  • c680bdd: Narrowed return type for createEntity (with one argument). (@benwest)
miniplex - [email protected]

Published by github-actions[bot] about 2 years ago

Patch Changes

  • 74e34c7: Fixed: Fixed an issue with the new iterator syntax on archetypes. (@benwest)
miniplex - [email protected]

Published by github-actions[bot] about 2 years ago

Patch Changes

  • 1cee12c: Typing improvements, thanks to @benwest.

  • 65d2b77: Added: Archtypes now implement a [Symbol.iterator], meaning they can be iterated over directly:

    const withVelocity = world.archetype("velocity")
    
    for (const { velocity } of withVelocity) {
      /* ... */
    }
    

    (Thanks @benwest.)

miniplex - [email protected]

Published by github-actions[bot] over 2 years ago

Patch Changes

  • 821a45c: Fixed: When the world is cleared, archetypes now also get their entities lists cleared.
miniplex - [email protected]

Published by github-actions[bot] over 2 years ago

Patch Changes

  • cca39cd: New: Archetypes now expose a first getter that returns the first of the entities in the archetype (or null if it doesn't have any entities.) This streamlines situations where you deal with singleton entities (like a player, camera, and so on.) For example, in miniplex-react, you can now do the following:

    export const CameraRigSystem: FC = () => {
      const player = ECS.useArchetype("isPlayer").first
      const camera = ECS.useArchetype("isCamera").first
    
      /* Do things with player and camera */
    }
    
miniplex - [email protected]

Published by github-actions[bot] over 2 years ago

Patch Changes

  • cb09f35: Fixed: When you're passing a complete React element (through JSX) to a <Component>, you were not able to set a ref on it. This has now been fixed.
miniplex - [email protected]

Published by github-actions[bot] over 2 years ago

Minor Changes

  • 0f01a94: Breaking Change: <Collection> has been renamed to <ManagedEntities>.
  • 0ad0e86: Breaking Change: useEntity has been changed back to its original functionality of returning the current entity context. useEntities has been removed.