I'm going to put forward the opinion that there is actually no netcode at all in a MUD server.
I've seen the phrase 'netcode' thrown about quite a bit in multiplayer gaming - usually as a criticism of how poor it is in a particular game. What this means is in respect of multiplayer shooters; that the other players 'rubber band' a lot, or shots placed on target on your screen don't land on the server. This is an artefact of latency - your local view of the game is different to the server's, and 200ms is a lot of time (in server frames, at least). The games where the netcode is praised usually use a combination of interpolation or extrapolation of other player's positions, as well as an amount of forgiveness about how actions are resolved.
A MUD server is different. Unlike graphical games, there is no client. Sure, you use a client to access it, but that client is just your favourite flavour of telnet
. And that's literally all a MUD server is; a port you connect to and type commands into. The server is the game, and has no code at all about communicating with the client. As a response to a command, it just spits more text out of that port. On the other end could be a telnet
client, or a Braille display, or a TTS interpreter or a line printer. The server doesn't care.
Some more modern specialist MUD clients offer local functionality; like mapping, scripting, triggers, etc, but they all just connect to the server and submit text commands. The clients don't know anything about character 'position' like graphical game clients need to (other than they are in your room / not in your room).
Unlike MMORPGs, a MUD is also highly likely to be single-instanced; holding the same view of the world for all players at once. Commands are reacted to by the server in the order they arrive and are usually* executed completely (as in one command from one user needs to end before another starts).
And yes, latency is also present on MUDs (and can be quite a problem sometimes), but not in the same way as I described for graphical games. Also, due to the speed at which we type and submit commands, it is a lot slower process in general than moving your crosshair over the head of an enemy and clicking.
An example of latency in a MUD might look like;
> look
You are in a maze of twisty passages, all alike
Steve is here
> kill steve
Steve leaves to the east
You cannot see a 'steve' to attack
In this example, you saw that Steve was in the room, but between you pressing [enter]
on your command and the server reacting to it, it had already reacted to Steve's command to move out of the room.
To answer your question directly;
An example I've seen for what makes MMOs difficult to code is that something as simple as a player placing an item on the ground can lead to an enormous number of messages being sent.
Yes, and no. In this example a player drops an item on the floor. The MUD server knows which room you are in, so it scans the player list for other player characters that are in the same room. To each one, it might send the message
joshisanonymous has dropped the McGuffin on the floor
That's one message sent out to each connected player that is in the same room as you. The server can achieve this in less than a millisecond, if its data structures are set up correctly.
And the message is just that - a simple string of text. In an MMO the 'message' is likely to be a complex serialised object containing; the action (something was dropped), the position (in world coordinates), what it was (an item ID, its world graphic (ID), its icon (ID), what sound to play, how damaged it is, whether it is a special version of this item, etc). A lot of that info is also being tracked and known by the MUD server, but the message to the players is nothing more than a string. They need to interact with the item in order to know more about it.
*I say 'usually' as I'm not aware of the internals of most MUD servers. However even if they are multi-threaded, the world view needs to be consistent - only one person can pick up that item off the floor so if two players try to go for it, only one can get it.
Footnote: if you are considering writing a MUD server for this day and age, make sure that you either build in TLS encryption to the server itself, or pipe it through something like stunnel
.