This ASP.NET MVC application (net9.0) serves as a ranking and statistics site for Left 4 Dead 2 matches.
For an example of this site in action, visit the Brazilian community site at https://l4d2.com.br/.
- Ranking System: Utilizes data provided by the "Left 4 Dead 2 Match Data API" to create a comprehensive ranking system. API Repository
- The ranking system is reset every two months by default, though this can be configured as needed.
- Previous rankings can be consulted.
- User-Friendly Interface: Displays rankings, latest matches, player rankings, and player comparisons in an intuitive and accessible format.
- Brazilian Community: Currently available to the Brazilian community at https://l4d2.com.br/.
- Steam API Integration: Requires a Steam developer key (SteamApiKey) to fetch player information. Instructions for creating a Steam API key are provided below.
- Data Dependency: Directly relies on the "Left 4 Dead 2 Match Data API" to retrieve and display player data.
- In-Game Integration: Can be opened directly within the game when used in conjunction with the l4d2_playstats_sync plugin. Configuration details for the plugin are provided below.
- Connected Players Indicator: A flag in the site header shows how many players are currently connected to the server.
- Language Support: The site currently supports English, Portuguese (Brazil), and Spanish.
- Theme Support: The site offers both light and dark themes, providing users with the option to choose their preferred mode.
- Technology Stack: Built using Bootstrap v3.4.1 and jQuery v1.12.4 to ensure compatibility with the in-game browser.
- Responsive Design: The site is fully responsive and adapts to both desktop and mobile devices.
This API is responsible for receiving data generated by the l4d2_playstats
plugin (GitHub Link), storing it in an Azure Storage Account table, and exposing the data through a REST API. You can find detailed setup instructions for this API at the following link: L4D2 PlayStats API Setup.
At times, the application needs to access player data such as profile pictures, names, profile URLs, and server details. A Steam API Key is required for integration with Steam. You can create your key through the following link: Steam API Key.
- Visit the Steam API key registration page.
- Log in with your Steam account.
- Register a new API key by providing a domain name.
- Copy the generated API key and set it in your project's configuration as
SteamApiKey
.
This application needs to be hosted on a Linux or Windows machine, or in a cloud environment capable of hosting .NET 9 applications. The publishing process depends on the chosen hosting environment, but generally, you will need to generate the binary for the project:
dotnet publish L4D2PlayStats.Web/L4D2PlayStats.Web/L4D2PlayStats.We
A551
b.csproj -c Release -o /path/to/output
The application requires a configuration file named appsettings.json
with the following structure:
{
"ServerId": "",
"PlayStatsApiUrl": "",
"SteamApiKey": "",
"ServerIPs": ""
}
- ServerId: The server ID generated by the "Left 4 Dead 2 Match Data API."
- PlayStatsApiUrl: The endpoint of the "Left 4 Dead 2 Match Data API."
- SteamApiKey: Your Steam API Key.
- ServerIPs: IP:Port of your servers. It's recommended to use only one server for simplicity.
To ensure the ranking system works properly, the following plugins must be installed on your server:
This plugin sends data generated by l4d2_playstats
to the "Left 4 Dead 2 Match Data API." You need to configure the following CVARs:
confogl_addcvar sm_stats_writestats 1
confogl_addcvar playstats_url "URL_MATCH_DATA_API"
confogl_addcvar playstats_access_token "SERVER_ID:SECRET"
- Binary: Download Link
- Source Code: GitHub Link
This plugin displays the ranking to players when they type !ranking
in the chat. It also shows the ranking at the start of a new game. Configure the following CVAR:
confogl_addcvar ranking_url "URL_SITE_RANKING"
- Binary: Download Link
- Source Code: GitHub Link
This plugin displays the player's rank above their head at the start of a new game. Configure the following CVARs:
sm_cvar sv_downloadurl ""
sm_cvar sv_allowdownload 1
confogl_addcvar patent_icon_api_url ""
confogl_addcvar patent_icon_version 2
confogl_addcvar patent_icon_max_level 15
The sv_downloadurl
should point to a FastDL URL. FastDL is essentially a public location where the Left 4 Dead 2 client can download necessary files, such as the rank icons in this case. Currently, I use a public container within an Azure Storage Account for this purpose, but you can configure it however you prefer. The rank icon files can be found here: Patents Assets.
- Binary: Download Link
- Source Code: GitHub Link
Below are some example screenshots showcasing the features of the site available at https://l4d2.com.br/.
The dark mode theme provides a visually appealing interface, reducing eye strain during night-time use.
For users who prefer a brighter interface, the light mode offers a clean and modern design for viewing rankings and stats.
Quickly view recent match results, including player performance and match statistics in an organized format.
Compare the performance of different players, analyzing key stats side by side to see who performed better.
View a player’s ranking directly in-game, providing seamless integration between the website and gameplay.