• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to organize i/o communication between a controller and i/o class  RSS feed

Piter Smith
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(Keep in mind that the i/o is using Apache TelnetClient, not because I want to use Telnet, but because that's a MUD game requirement. Not all MUD' s support ssh -- and probably never will.)

Surely there must be a cleaner way of sending data about. This is a basic type MUD game client, similar to Mudlet, but in Java, for MUD games.

Mudlet aliasing scripting is here:


which I'm trying to implement in Java.

The i/o problem is four fold fold. Basics:

capture keyboard input with the read thread (local input)
capture and print an InputStream with the readInput thread (remote output from the game server)

Additionally, the input thread will also capture "alias" type commands, ie any keyboard entry starting with a special character is an "alias" for the client, a message to the client. This is in the read thread.

Also, the readInput thread will send each line off for processing for "triggers" with regex.

The above is just a very basic MUD client.

However, the input/output seems amazingly messy and difficult to follow. There are some definite kludges in capturing the "aliases", special commands, in the read thread, so that I can clean up a bit. In general, it's just quite difficult to follow. What are some sort of things I can do to make this easier to read, and maybe a better design?

The current package structure:

├── connection.properties
├── player
│   ├── Flag.java
│   ├── GameAction.java
│   ├── GameData.java
│   └── TelnetEventProcessor.java
└── telnet
├── Alias.java
├── AliasTarget.java
├── InputOutput.java
├── Logic.java
├── PropertiesReader.java
└── TelnetConnection.java

TelnetConnection is the controller and InputOutput is, of course, the i/o. These two classes seem very clumsy, and I would like to break them up into smaller pieces, smaller classes, which just do one thing and do that one thing in an easy to see way. But breaking i/o in "input" and "output" seems a bit silly. Surely there's an organziational problem?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!