Garry's Mod is a sandbox video game by Facepunch, published by Valve in 2006. When connecting to a game server, players view a loading screen while the game client downloads all of the server's custom files. This process can take a long time, and even if players have already downloaded those files, they will still be on the loading screen for some time as their client syncs to the server's game state.
PonyLiving was a very popular My Little Pony-themed DarkRP server that became the 3rd most populous Gmod server at its peak. I was an administrator and developer there, and one thing I did for the server was develop its loading screen.
Garry's Mod renders HTML in Awesomium, a now-abandoned SDK for implementing the WebKit engine. Awesomium mostly supports HTML5 and CSS3, at least for the specifications that existed when it was still in active development, but does not support Javascript ES6 or newer. When Gmod players connect to a server, their client displays a web page defined by the server's sv_loadingurl convar, which functions as the server's loading screen.
If the URL contains "%s" or "%m", Gmod will replace them with the player's Steam ID and the server's current map respectively, which can be then processed by the web page as PHP GET parameters or with some other method. Gmod will also call the GameDetails function in Javascript if it exists, passing in the server name, map name, gamemode, player's Steam ID, and other details. It will also call other functions related to file downloading progress.
I originally made this project in 2013, but I've cleaned up the code a bit for presentation here. I've fixed several bugs, reorganized the files into folders, deprecated jPlayer which I used for cross-platform autoplaying audio but browsers don't allow that anymore, deprecated gfycat.js since their API endpoint is no longer available, and updated the code for compatibility with PHP 8.1. I've also removed my Steam API key, so anyone running or using this code will need to provide their own. The original files (except the music) can be seen in the commit history.
- Themes for each season and some holidays, uses geoPlugin's API to find the viewer's hemisphere to determine the appropriate season
- Events for special dates such as PonyLiving's anniversary
- April Fool's theme is a creepy static-covered theme with jitters, text corruption, and other effects, dynamically applied through Javascript
- Random songs and loading images based on theme, with some images being rare
- Uses Steam Web API for retrieving player's avatar and username
- PHP parameters for debugging and variable overrides
- Saves logs of player joins to text files (development ended before I could move to a proper SQL database), and associates Steam IDs with IPs to discover alt accounts and ban evasion
- Logs are viewable from a password-protected page, access is saved with a cookie