RanvierMUD / ranviermud

A node.js based MUD game engine
https://ranviermud.com
MIT License
796 stars 247 forks source link

Document full lifecycle from server startup to a command being run #331

Closed shawncplus closed 5 years ago

shawncplus commented 6 years ago

There are currently no docs that describe how, once you run ./ranvier things actually happen. This is an important process to understand if one is to rewrite/change any of the lower level bundles: login/command execution/etc.

  1. ./ranvier
  2. Ranvier loads in all game data and registers server listeners (link to http://ranviermud.com/extending/server/) on the GameServer object
  3. Ranvier emits startup event on GameServer object

This is the end of any hard opinions by the core. With that said, it would be helpful to demonstrate how the example ranvier- bundles handle it from there as a point of comparison.

  1. ranvier-telnet and ranvier-websocket bundles register startup server event listeners. Each starting some network server to listen
  2. In either case the telnet/websocket connection listener does state.InputEventManager.attach(TransportStream); which binds the connected socket with ranvier input events (link to http://ranviermud.com/extending/input_events/)
  3. Server startup listener fires intro event on the TransportStream. This kicks off the listener bound to that event inside ranvier-input-events/input-events/intro.js
  4. intro.js displays the MOTD then events continue to be fired as described in ranvier-input-events/input-events/README.md until they end at commands.js
  5. commands.js handles the actual player command loop, leveraging CommandParser
  6. End

This should probably be added as a new Lifecycle page and linked from the Get Started.

shawncplus commented 5 years ago

Finished