Please visit our donations page for more details.
1. Introduction
A lot of server admins want this and we have it: a message of the day (MOTD) that seamlessly fits into the standard Team Fortress 2 chalkboard, but offers a lot more flexibility. Good news: we have decided to share it with you.
To better Illustrate what I'm talking about, here is a screenshot of the MOTD when you join our server #2.
As you can see, we provide more information on our MOTD than usual, but at the same time we can keep the layout clean.
2. The Basics
You can customize your message of the day through the file motd.txt in the tf directory of your dedicated server folder structure. If this file doesn't exist you can simply create it.
Let's start with a simple example and put some text into your MOTD.
This is a simple MOTD. Welcome to our servers.
Then your MOTD will look like this.
Looks pretty and was simple, right? So why would anyone need something else? Well, imagine you would want to put your clan logo into the MOTD. Or maybe you would rather have a two column text layout. Those things can't be achieved with this method.
3. Using HTML
The next step is to use HTML in your MOTD. Yes, you can simply put HTML content into the same file and the Source engine will render it using the Internet Explorer engine.
So, let's put some basic HTML with some styling into the file and see what happens:
<html>
<head>
<style type="text/css">
<!--
body {
background-color:#676570;
color:#ECECEC;
font-family: Verdana;
}
-->
</style>
</head>
<body>
<h1>Welcome to our servers</h1>
<p>This is a simple HTML MOTD for TF2</p>
<p style="float:right">It allows us to do some styling.</p>
</body>
</html>
Well, now we have the flexibillity of HTML, but it doesn't look as good as the simple text MOTD. Another drawback is, that the Source server doesn't allow us to link to any external files (e.g. stylesheet or image). So we need a better solution.
3. External HTML
One common practise in Counter-Strike: Source was to include a header redirect in the HTML code, so that the ingame browser would load an external file. Though this still works for TF2, it's not necessary, because the Orange Box server allows us to directly specify an external HTML file we want to load.
So we edit our motd.txt again and write something like this:
http://content.specialattack.net/motd.html
This will instruct the client's ingame browser to load this file from our webserver. Now we can use the full set of HTML/CSS commands in our external HTML file. Let's see what our external HTML file could look like:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Welcome to SpecialAttack</title>
<style type="text/css">
html, body {
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
img#bg {
position:fixed;
top:0;
left:0;
width:100%;
height:100%;
}
#content {
position:relative;
z-index:1;
margin:0 auto;
}
</style>
</head>
<body>
<img src="http://content.specialattack.net/blackboard.png" id="bg"/>
<div id="content">
<img src="http://content.specialattack.net/motd.png"/>
</div>
</body>
</html>
This is what it will look like ingame:
We have created a background image that looks like the default chalkboard, set it so that it would always fill up the whole space and overlay another image with our text above it. So now we can show anything we want in our MOTD.
Of course this method has one drawback too: scaling. Since the images have a fixed size, your MOTD will look differently on every screen resolution your clients will use. We have optimized the graphics in a way, that the scaling effects should only be barely visible. If you create your graphics in the same way we did, then you're gonna be fine, because it scales down to 1024x768 without scrolling. This way 98.3% of all Steam gamers will not need a scrollbar, which allows for a nearly seamless transition.
4. What's next?
So now that we have the abillity to put anything we want into the MOTD, what could we do next. Well, as you can see in the first screenshot, we have included live server stats. This shows what is currently going on, at our other servers and also shows you what the time left and next map on this server is. You can read how we did this, in our tutorial how to put live server stats into the MOTD.
5. Download
You can download the sample HTML and images here as zip file.
If you want to spread this tutorial around, please link to this page, not just the zip file.
Comments
Thank you very much for this
18. September 2008 - 15:05 — AnonymousNot appearing in Steam browser
16. September 2008 - 13:50 — AnonymousTaking this to a different level
1. August 2008 - 19:49 — AnonymousI can't get this working
29. July 2008 - 18:31 — AnonymousThank you very much for this
3. August 2008 - 17:51 — AnonymousNeed more information
29. July 2008 - 19:08 — demmNeed Help With IE6
6. July 2008 - 6:23 — AnonymousAs far as we know there is no
6. July 2008 - 18:48 — lacoplive server stats
27. June 2008 - 11:37 — Anonymousyes,
6. July 2008 - 18:45 — AnonymousLive Stats
26. June 2008 - 0:47 — AnonymousLive server stats in MoTD
28. June 2008 - 20:38 — lacopAwesome guide, looking
22. June 2008 - 8:24 — AnonymousYou are incorrect about your
18. June 2008 - 11:49 — AnonymousFigures
19. June 2008 - 7:47 — demmNextmap tutorial.
13. June 2008 - 3:46 — AnonymousFont type
12. June 2008 - 20:46 — AnonymousFont type
12. June 2008 - 21:05 — demmLawl Font type for ORIGINAL Tf2
20. February 2009 - 14:34 — Anonymousteh font is called TF2 Professor
its in the GCF at the TF Recources
widescreen
12. June 2008 - 20:18 — AnonymousWidescreen scaling
12. June 2008 - 20:24 — demmI'd be very interested in how
12. June 2008 - 19:31 — AnonymousI'd be very interested in how
12. June 2008 - 14:30 — AnonymousLive server stats
12. June 2008 - 19:30 — AnonymousRE: Live server stats
13. June 2008 - 9:49 — SpikespiegelYou cannot edit the .PNG
21. June 2008 - 23:30 — Spikespiegeledit.motd.png?
20. June 2008 - 19:02 — Anonymoushelp
24. June 2008 - 14:35 — AnonymousI have the same problem
4. July 2008 - 16:58 — Anonymous