Implementation of the game service used to operate the game engine

Hierarchy (View Summary)

Constructors

Methods

  • Create a new player session middleware for Express

    Returns ExpressMiddleware

    Middleware instance for Express

    This middleware does this following:

    • Associate a player session of type T with a request, based on the provided X-PlayerSessionId-header.
    • Regularly persist player sessions as JSON-files on the file system

    Keep in mind this middleware is not secure by any means, meaning the X-PlayerSessionId-header can be easily manipulated.

  • Exectute an action and get its result

    Parameters

    • alias: string

      Alias of the action to execute

    • gameObjects: GameObject[]

      List of game objects to execute the action on

    Returns SyncOrAsync<undefined | ActionResult>

    Result of the action or undefined when unhandled.

  • Get a game object instance by its alias

    Parameters

    • alias: string

      Game object alias

    Returns undefined | GameObject

    Game object instance or undefined when not found

  • Get a list of game objects instances by their alias

    Parameters

    • aliases: string[]

      List of game object aliases

    Returns GameObject[]

    List of game object instances. Can be empty when no game objects were found.

  • Get the contents of the player inventory as a list of game objects instances

    Returns GameObject[]

    List of game object instances. Can be empty when no game objects were found.

  • Register an action class

    Parameters

    • actionClass: ActionClass

      Action class

    Returns void

  • Register a game object class

    Parameters

    • gameObjectClass: GameObjectClass

      Game object class

    Returns void

  • Reset the player session

    Returns void