Marak 8e86d845a5 First pass at drone squadron behavior 3 سال پیش
..
Behavior.js b319af42f0 Refactor to use Phaser 3 Scene API #6 3 سال پیش
Collisions.js 9f89a6650c Adds signals and asteroids 3 سال پیش
Game.js b35b7ac215 Adjust mass and thrust force for ships 3 سال پیش
Input.js b319af42f0 Refactor to use Phaser 3 Scene API #6 3 سال پیش
Inputs.js a624634f4d First commit of Alien Warz 3 سال پیش
ReadMe.md 07208f76ee Adds mothership 3 سال پیش
Server.js 25cad3fc3b Ensure html extension used for web server 3 سال پیش
Thing.js 8e86d845a5 First pass at drone squadron behavior 3 سال پیش
Things.js a624634f4d First commit of Alien Warz 3 سال پیش

ReadMe.md

Geoffrey

Geoffrey is a compositional game behavior framework for Phaser.io v3+

Geoffrey helps you build complex games quickly using simple behavior based patterns.

Features

  • Manage and create game entities as Things
  • Apply compositional Behaviors to Things
  • Handles client Inputs
  • Customizable collision handler
  • Optional Authortative Server
    • Client-Side Prediction
    • UDP via WebRTC
    • Snapshot Interpolation

Functional Composition over Object Inheritance

Geoffrey utilizes a dependency injection pattern where each game object starts out as an empty Thing which can have Behaviors attached to it. Think of it as a functional composition approach for defining game objects and behaviors instead of using object inheritance.

make-me-sammich now-you-sammich

Things

A Thing is a Phaser.io Game entity such as sprite, text, or group. Geoffrey can create Things that appear in your Game using Thing.create().

Thing.create

Creates a new Thing which is registered in the Things object. Returns a Phaser game object with an attached G scope.

The G Scope

Each Thing will have a property called G. Anything related to our game logic ( and not directly to Phaser.js ) will be stored in the G scope. This is super useful when creating or modifying game content. You can also modify G values live while the game is playing directly through the console.

Behaviors

A Behavior is a set of functions which are applied to a Thing. Behaviors can export these properties:

Behavior.config

Used as default configuration scope for values used inside the Behavior

Behavior.create()

Called once when the Behavior is first applied to the Thing.

Behavior.update()

Called every event loop of the Game.

Behavior.remove()

Called when the Behavior is detached.