Contents
Introduction
Please Note: At this time, the only way to effectively use
this capability is if you have a dedicated BYOND server somewhere.
It could be server space with a hosting provider like Dantom, or
simply your own PC which is online and running the debug server
24/7. A method to provide an email-based service to developers
without either of these options is in the works. Please let me know if you are
interested in this service.
The Debug Server
Next, determine the BYOND-space address of your debug server. If
you'll be running it on your own machine using DreamDaemon, the
address will be of the form byond://123.45.678.9:4321 where
123.45.678.9 is your internet IP address and 4321 is the port that
you always use when hosting it in DreamDaemon. If you have hosting
space somewhere like Dantom, your server address may look like
byond://dantom.space.yourname/debug. If you are running
the debug server locally, don't forget to start it up and leave it
running.
The Debug Server saves each debug logfile it receives from a player
to a separate text file. Filenames are generated somewhat randomly,
but have this basic form:
<name>.<version>.<time>.<rand>.dbg
where <name> is the canonical name of your world (taken from
world.name of the game), <version> is the world.version that
sent the log, <time> is the value of world.realtime when the
log was received, and <rand> is a random number. Because
logs are saved by world name, you can use the same Debug Server
for all of your projects.
You can periodically check the directory where the Debug Server
runs for any new log files from your players. Inspect them and
get to fixing those bugs!
Adding The Debug Messenger To Your Project
Configuring The Debug Messenger
The Debug Messenger works by saving all of your debugging output
to a text file on the player's machine. This is the name of that
file. You must define this! Best to make it something unique so
it doesn't overwrite anything else that may be in the game directory.
Example:
This is the BYOND address of your debug server that you determined above. Example:
Using The Debug Messenger
T: the text of the debug message
This proc logs a debug message. As long as DEBUGFILE is defined
above, that message will be appended to the debug file. Additionally,
if debugging is turned on for the project (#define DEBUG), the
debug message will be sent to world.log. Any time you need to
output a debugging message, use this proc.
Debug messages are always prepended with the world.time value.
T: the text of the bug message
This proc is the same as DebugMsg (in fact, it calls DebugMsg(T))
except that it also increments a global "bugs" counter. Additionally,
it prepends the text "BUG: " to the message. Use this proc when
you encounter a situation in your code that you know for sure is
a bug.
The Debug Messenger keeps a global var called bugs which counts
the total number of known bugs that occur in the game. It is
incremented any time you call BugMsg(). When the world shuts down,
it checks to see if there were any bugs encountered during the
game. If so, the entire debug log (all DebugMsg() and BugMsg()
calls) will be sent over the network to your debug server.
This example world illustrates usage of the Debug Messenger:
In the above example, we expect the mob variable "playing" to always
be true when the player is in the game. Thus if it's false in a
Stat() operation, that must be a bug, so we call BugMsg(). We also
call DebugMsg() in mob/Login() and mob/Logout() to show the value
of the mob's playing var. This should give us enough information
to figure out why the bug (playing not true) is showing up: we
never set it to TRUE!
When run, every call to BugMsg() will increment the bugs count,
ensuring that the entire debug log is sent to our Debug Server.
When we check the server directory for new log files, we'll see
this and fix the problem by setting the mob's playing var to TRUE
in mob/Login(). When we distribute the fixed game to players, we
won't get any more log files because that BugMsg() will never be
called, even though DebugMsg() is still being called. In this
case, the game will automatically delete any log file on the player's
machine when the world shuts down.
Finally, if you wish to receive debug logs even when no known bugs
are encountered, simply set the global variable "bugs" to a nonzero
value in world/New().
Odds And Ends
The BYOND Debug Messenger is Copyright © 2001 Mike Heasley (a.k.a. Air Mapster). All rights reserved.
Get the latest version at the BYOND Hub.
The BYOND Debug Messenger is useful when you wish to debug
your games that players run locally on their machines. Normally
you would have no access to any debugging information without access
to each player's machine. This library changes that by sending
debug logs to a central server, where you can later peruse them
and (hopefully) use them to help fix bugs.
The first thing you need to do to is compile the debug server.
The server code is provided as the file "debugserver.dm" included
with the library files (in the folder
The next step is to add the Debug Messenger to your game
project. The simplest way is to include it on a line by itself in
your project .dme file:
That's it.
Next, you'll want to configure the Debug Messenger for your project.
You do this by setting a couple of preprocessor macros before
the include line shown above. The following can be set:
There are two procs that you should use to communicate debug messages
to the Messenger.
DebugMsg(T)
BugMsg(T)