Skip to content

Latest commit

 

History

History
48 lines (40 loc) · 3.9 KB

v3.md

File metadata and controls

48 lines (40 loc) · 3.9 KB

Changelog - V3

External API

  • Redesigned architecture to no longer be singleton. This was kind of an oversight at the start but was such as big change that it got pushed around until now.
    • A new instance can be created with new EntityEngine()
    • Instances are independent, and things have been designed to allow component reuse between them e.g.: the same Sprite/Collider instance be reused between two different engine instances / games.
    • A lot of neat things were broken however, such as easy query of entities for collisions. Replacement systems have been added / will be added for most of these.
  • Events are no longer single methods, but are proper event buckets. Multiple listeners can be assigned for each, and they will be called in order of registration.
    • Instead of Engine.Awake += () => {} use engine.addEventListener("awake", () => {}.
    • List of engine events is available in ENGINE_EVENTS.
    • Previously only one official Awake method was allowed, now multiple scripts can have their own awake event listeners. Great for organisation.
  • Engine timings have been reworked and are more comprehensive.
    • update event now returns a whole object that will always provide the most up-to-date timing imformation.
  • CanvasRenderer received debug options, such as drawColliders and drawEntityBounds. These can be useful for development, but are costly to draw.
  • Exposed drawRect and drawCircle global methods from rendering.
  • Spritesheets are no longer tied to any engine instance. To ensure each spritesheet has been loaded for a specific game, use spriteSheetLoader, and start the engine from its success callback.

Internal

  • Math. Lots of it. Both for 2D vectors (Vector2D) and collisions.
    • Collisions are not exported, but feel free to have gander at my misery (actually kinda proud and happy with it).

Entities

  • Added rotation property. It is in degrees (0-360) and governs both the attaches sprite and collider's orientation during rendering and collision detection.
  • Added Collider property so colliders can be attached to entities.
  • Removed GetCollisionsByTag as it's no longer possible to access this in the current architecture.
  • Added IsIntersecting, which checks collisions against a specific entity.
  • Removed Vertices as it was no longer being useful with rendering and collision system changes.

Collisions

  • Reworked collision system from the ground up
    • Previously entities were axis aligned rects, so collisitions were done according to it. However with the introduction of rotation property they were updated to properly calculate collisions by geometric shapes.
  • Introduces the Collider base class, with RectCollider and CircleCollider.
    • Colliders have independent dimensions from their entities, and can be given an offset from the entity's center point.
    • Colliders can be freely reused between entities, and will be correctly handled between user instances.
    • Intersection checks are skipped when certain conditions are met, when a non-collision can be guaranteed.

Graphics

  • Completely redesigned the rendering system to be faster
    • Previously every sprite would be rendered tile by tile on every rendering pass, which while wasn't too slow, wasn't optimal either. A lot of lookups and calculations were repeated with every frame, esentially "creating" the sprite from scratch every frame.
    • Now textures are compiled into a CanvasPattern on creation, so every sprites is cached. This is a further improvement over V2's sprite preprocessor.
  • Sprites of any kind now inherit from TextureResource which handles compilation and common tasks.
  • Although not a change but sprites can be reused freely between entities.
  • Textures render left-to-right, top-to-bottom.
    • For Sprite, this means each tile of the sprite will be compiled in a row, and repeated to fill an entity.
    • For AnimatedSprite, this means each frame will repeat to fill an entity.