• entries
557
1237
• views
423432

# Oh Teh Commandx0rz!

336 views

Yes, I was right. I was up early. But not as early as I could have been, thankfully. So I got up at 9am, after 4 hours sleep...

First up, congratulations to Drew_Benton who got to #1 on the Top 50 Rated Posters list. We'd been fairly close for a while, at around positiong 6 to 8, and then he flew past from 6 to 1 in a little over a day. I'll have to try to be more helpful I think [wink]

Stuff I got done to the MUD today:
• Actions are now completely implemented, as are commands to add, remove, and edit them
• Kick/ban controls are in place
• Banking is in place
• There's now a very brief TOS when you register (basicly saying you can't sell anything in the game for real money)
• Commands added to allow admins (I.e. me) to change the flooding parameters on a per-user basis
• TA2 and Druink protocol .who's are done - although .ta2who is only used by Pouya's TA client, PClient v3. I'll do a plugin for DruinkIM soon, which will use .druinkwho to display avatars. Which reminds me -
• Avatars are done. You can set your avatar image URL, and .druinkwho will tell capable clients who has avatars, when they changed (for caching), and where to find them. I'll eventually have an avatar upload page on my website I expect
• IP banning is in place - Untested, but the code is identical to my old MUD, and it worked fine in that
• .serverstats command added, which shows pointless information like uptime, data sent / received, and database sizes
• You can change your E-Mail address and website URL from in the MUD
• .stats is done, so you can get info on other users

And, for your enjoyment, here's the entire command list, dumped from .help:
Quote:
 action action's actionlist actions addipban afk balance ban busy colors colours deleteaction deposit desc druinkwho e east email help ipban iplist kick listipbans loadscript look makeadmin makemoderator makeuser me me's mes mutter n newaction north password quit reloadscript removeipban review s sayto serverstats setactiontext1 setactiontext2 setavatarurl setdesc setemail setfloodmax setfloodreduce setidletimeout setmaxbuffer setpassword setprotocol setshowname setwebsite shout showname shutdown south stats ta2who tell tempban unban verifypassword w website west who whois widewho withdraw @ @@
Note that some commands are aliases for others (e.g. n is an alias for north, @ is an alias for who). Also note that some of the commands are moderator / admin / server only. In the real .help they're highlighted different colours, and you can only see commands that are at your permission level.

Also, I discovered that my MUD's been randomly crashing. I thought my idiot future brother-in-law had been closing my MUD somehow, via VNC, so I added some logging at shutdown. And that log never got written. Now, what's odd, is that the executable just exits, no error code or anything like that. I suspect it might be because I'm running the debug .exe on my server in order to make the most of assert() and so on. However, I'm not entirely sure what happens when you hit a __asm{int 3;} when you're not attached to a debugger. Perhaps that's the problem.
Anyway, my solution to the problem is to stick a Sleep(1000) in the main loop, and log every tick. At this very moment, my hard drive is filling up with useless logging at the rate of around 50 bytes per second. At this rate I'll hit the 4Gb limit in a little under 3 years, and since the MUD has been crashing on average after 10 hours or so, I should be ok.
I also thought it could be a threading issue. I have 4 threads running at once:
• The main thread - where all the processing goes on
• The database sync thread - where I do MySQL UPDATE statements to update dirty users
• The accept() thread - calls a blocking accept() to accept new connections
• The recv() thread - polls the socket every 100ms for data (And if there's nothing pending, checks if it's exit event is set)
However, the accept thread is blocked (unless it's crashing when someone connects for some reason), as is the database thread. And if there's noone connected, then the recv() thread is sleeping for 100ms and then waking up, doing nothing and going back to sleep again.
So, I don't really know. Once the server crashes again, I can narrow the logging down a bit, and hopefully in 2 or 3 itterations I'll find the problem.

Anyway - the end result is that the MUD is running very slowly just now. You can still use it if you want, but you'll have to wait at 1 second on top of your ping time for anything to get done.

Well, I'm going to procrastinate for a while, and then attempt to have an early night.

EDIT: What the hell, have a screenshot:

EDIT: Thumbnailed screenshot, since it was breaking the tables

You definitely need to leave the debugger attached to find where the app is crashing, at the very least you'll get some information on the debug output window that may shed some light on what's going on. Or you could even use remote debugging, it's great.

TA CLONE!!

Quote:
 You definitely need to leave the debugger attached to find where the app is crashing, at the very least you'll get some information on the debug output window that may shed some light on what's going on. Or you could even use remote debugging, it's great.
Unfortunately, it runs on my server, which doesn't have MSVC installed on it. And it's perfectly capable of running for hours without crashing (It's been going for almost 24 hours now, and it hasn't crashed).

I managed to get it to crash once. My logging says that it crashed outside of the main loop, which means that it must have been another thread, since all that's outside the main loop is the window message pump and a Sleep(1000). So, I changed my asserts to use a custom assert macro. Now it pops up a message box if it fails.

Oh, and yes - I just used the Town Hall as an example, since I have no immagination :P The description of the Town Hall is "The town hall. Nothing much. Ripped from TA..."

Here, have the rooms file:
[Room 0]
Name = <-31><-1>T<-0><-31>own <-32><-1>H<-0><-32>all
Desc = The town hall. Nothing much. Ripped from TA...
Text = A sign reads: "No littering"
Flags = Town
East = 1
South = 2
OnEnter = TestScriptEnter
OnExit = TestScriptExit

[Room 1]
Name = <-cff0000>T<-ce50019>e<-ccb0033>h <-c980066>B<-c7f007f>a<-c650099>n<-c4c00b2>k
Desc = The bank. Do banking.
Text = A sign reads: "No littering"
Flags = Bank
West = 0

[Room 2]
Name = <-35><-1>The Shop
Desc = The shop. For uh... shopping?
North = 0



## Create an account

Register a new account