module Universe: sig .. end
type iworld_t
the type of clients
type ('a, 'b) t =
val universe : ?on_new:('a -> iworld_t -> ('a, 'b) t) ->
?on_msg:('a -> iworld_t -> 'c -> ('a, 'b) t) ->
?rate:float ->
?on_tick:('a -> ('a, 'b) t) ->
?on_disconnect:('a -> iworld_t -> ('a, 'b) t) -> 'a -> unit
starts a game after receiving the following arguments
(the last argument of type
'a is mandatory)
on_new : receives a state and a newly participating client;
returns a new state
on_msg : receives a state, a sender, and a message;
returns a new state
rate : an interval of 1 tick in sec
on_tick : receives a state; returns the next state after 1 tick
on_disconnect : receives a state and a leaving client;
returns a new state
'a : an initial state of universe (mandatory)