HRL - Halo Race Leaderboard
HRL is developed in 3 areas:
LUA, hooking into the Halo system (SAPP) - used for events listeners in game.
RUST, Running http requests using the hyper.rs library
Laravel, Handling the Web App (http://hrl.effakt.info)
SAPP, includes with it some event listeners, mainly for "Score". Using this we can hook into the exact tick the user scores a lap.
I can then pull the last lap time from the memory of the server (Using a read_word() function).
I also tell it that only the driver can score a lap time (If the vehicle is full, we don't want 3 separate requests).
If the script detects a warp, or death, it will also not record the lap (Prevents teleporting to navs, or suiciding to spawn at a closer nav).
Using RUST and a library called hyper.rs, developing HTTP queries was rather simple, especially since I don't require the client to see whether there was a response.
All this script does is generate and send a request to the API.
This Web App has no admin area, no login system. All is does is handle the API, and return the results on the page for users to see.
On a new request, we schedule a job to run.
This job runs a request against the UDP server hosted by Halo, on the port supplied by the LUA script in order to receive the server name, and other information.
We create the Server in the database, if it doesnt already exist, We create the Map in the database, if it doesnt already exist (along with a relationship between server-map. We create the Player in the database if it doesnt already exist, along with a server-player relationship. We create a Lap Time, if the current lap time is less than the users fastest lap for this map on this server.
This is a very simple front end, as not a lot is actually required, other than Installation Instructions, and displaying data in a table.
Using DataTables, allows for pagination, filtering, and ajax to pull content (if the database gets large and not using ajax it can put a large strain on the server).