January 13, 2008

Progress Check

For the MUD, I have the following features done:
  • Asynchronous TCP communications -- Multiple Telnet clients can connect, send, and receive.
  • Event Manager -- Function calls can be scheduled to run (float X) seconds in the future.
  • Logging -- Log messages get recorded in a text file and displayed on the server's terminal.
  • SQLite Database storage -- SQLite3 is now part of Python 2.5 so I'm still on my track for my goal of zero dependencies.
  • ANSI Color Tokens -- This is something I did in my BBS days. If you want a message to show in color you can enter a simple code that begins with a caret. ^y is yellow and ^Y is bright yellow.
  • Word Wrap Function -- This takes a block of text and, given a target column width, formats it for easy reading.
  • Kicking Idle Clients -- Automatically drops clients who remain inactive for a period of time.

Here's an example of the word wrapping using four paragraphs from the Declaration of Independence. The first is the text simply dumped to the terminal:

Here's the thing run through the wrap_text() function:

I wanted it book-like and easy to read so we're padding the left and right and indenting the paragraphs slightly. A way more sophisticated function would break words with hyphenation.

No comments: