Component Session

hypersurge edited this page May 31, 2015 · 3 revisions

When gameplay experience requires some stateful persistence - e.g. when returning to the game, or even between Scenes the Session can be used to store the game state.

As all games are different, and all state persitence requirements different the default implementation of Session is somewhat abstract, and therefore arguably of limited use.

Things you should know about Session

  • ASession comes ready to run (it's created automatically in the default Factory).
  • Session automatically saves game state to a SharedObject / LocalStorage.
  • Session is the unspoken evil of application design - somewhere arbitration must exist, somewhere concrete values must be retained. Therefore assume each project should extend ASession for its own requirements:
    • Inject Session properties into Scenes from within Factory (good).
    • Or cast IKernel.session in situations as they arise - e.g. Scene or Entity (bad).
    • Or throw good sense out the window and go global! Access via a Static and use dynamics or untyped to turn Session into a true Global (ugly).
  • Implements ISession.

Did you know?

  • ASession can store multiple user sessions, stored by id.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.