Some suggestions

May 04, 2020 09:07PM
I know you're doing it for fun, but if you do decide to do it for reals (meaning be competitive with the best clients out there)
Python isn't really the best language to use since it is slow enough to introduce measurable latency when you have some
degree of load from actions/highlights/triggers etc.

The two major issues that I see:

Your msg handler doesn't match prompts. Matching prompts is the fundamental operation that has to
be correct in every MUD client, otherwise you can't do reliable per-line operations (like actions/triggers/highlights etc).
You need to take into account that server output can arrive in batches that are completely arbitrary / not neatly
terminated by a complete prompt or even new line. Example:

You can do a network read and get "OUTPUT FROM S" and then do another network read and get "ERVER ...."
The simple fix is to read and process complete lines. This fails when a prompt that doesn't end with
a newline arrives, which is why you need prompt handling to be a part of the msg handler. Ideally you have
EOR/GA autodetection and an option for user-configurable prompt that is matched by a regexp (say). You
have to be careful in how you do the regexp matching if you do decide to use it.

The second major issue is that you're using regular expressions to match ANSI color SGR sequences.
This doesn't work because regular expressions can not be used to model state machines, which is really
what you need here. Think about what I said about batched input, and you should be able to see how
your scheme fails.

Making something that sort-of-works, some of the time, is easy.

But making something that's robust is all about understanding the problem and its cornercases
(meaning having an accurate model) and then coming up with an appropriate solution. Also keep in mind all the assumptions you are making, since it’s usually assumptions that you haven’t really thought through that end up biting you..



Edited 7 time(s). Last edit at 05/04/2020 09:33PM by zoskia.
Subject Author Posted

I finished the barebones of a MUD client - what features do we wish we had?

(vಠ_ಠ)> AngryFatKid April 26, 2020 09:43AM

https://gitlab.com/bubthegreat/mudpy (n/t)

(vಠ_ಠ)> AngryFatKid April 26, 2020 11:09AM

And immediately moved it to https://gitlab.com/mudpy/mudpy

(vಠ_ಠ)> AngryFatKid May 04, 2020 05:50AM

Some suggestions

zoskia May 04, 2020 09:07PM

Re: Some suggestions

(vಠ_ಠ)> AngryFatKid May 05, 2020 10:04AM

What's wrong with what Rahsael made in Mudlet? Why compete? n/t

jalim May 04, 2020 07:20AM

This is newbie-level code, it's obvious he's doing it for fun and learning

zoskia May 04, 2020 08:53PM

^ This

(vಠ_ಠ)> AngryFatKid May 05, 2020 09:35AM

good for you

The Forsaken(VIP) May 07, 2020 03:01PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 111
Record Number of Users: 5 November 04, 2022
Record Number of Guests: 358 August 31, 2022