GenGame.ServerAuthoritative behaviour (gen_game v0.1.1)

This is a behaviour that you can implement in lib/gen_game_mod/mod.ex. Every functions in this module will be called when there are particular event in GenGame.

Summary

Callbacks

RPC is custom action. Payload from client will be passed as map to the function without modification. The function can either return a map or error with reason that will be forwarded to the client as reply.

Types

Link to this type

error_reason()

@type error_reason() :: atom()
Link to this type

shared_opt()

@type shared_opt() :: {:key_iterations, pos_integer()}
@type socket() :: Phoenix.Socket.t()

Callbacks

Link to this callback

after_create_account(map)

(optional)
@callback after_create_account(map()) :: term()
Link to this callback

after_create_match(map)

(optional)
@callback after_create_match(map()) :: term()
Link to this callback

after_create_session(map)

(optional)
@callback after_create_session(map()) :: term()
Link to this callback

before_create_account(map)

(optional)
@callback before_create_account(map()) :: term()
Link to this callback

before_create_match(map)

(optional)
@callback before_create_match(map()) :: term()
Link to this callback

before_create_session(map)

(optional)
@callback before_create_session(map()) :: term()
@callback rpc(list()) :: {:ok, map()} | {:error, error_reason()}

RPC is custom action. Payload from client will be passed as map to the function without modification. The function can either return a map or error with reason that will be forwarded to the client as reply.

Functions

Link to this function

dispatch_event(event, payload)

@spec dispatch_event(atom(), map()) :: {:ok, term()} | {:error, term()}
Link to this function

find_receiver()