carlescliment/php-mud-server

Mud server written in PHP

dev-master 2014-04-26 23:14 UTC

This package is not auto-updated.

Last update: 2024-11-09 16:58:34 UTC


README

Brainstorm:

  • When a new connection is received, it dispatches a NEW_PLAYER_EVENT
  • A player is a class that contains a CommunicationBridge.
  • The CommunicationBridge contains the socket itself, and is able to send messages to the player.
  • When a message is received, it dispatches an INCOMING_PLAYER_MESSAGE_EVENT.
  • The app converts the message into a command and pushes it into a command stack.
  • There is a thread, it is the clock, and dispatches a NEW_TURN_EVENT every second.
  • When a NEW_TURN_EVENT is received, the app will collect all the commands in the stack, makes whatever it needs to, and sends the proper messages to the player.