A page that contains live updated ingame information is something I have always found really cool but never been able to create myself. One day though, I came across Valve’s game integration out of sheer luck. After looking into it further I realized it didn’t require much, it did however require a NodeJS server which I was, at that point, not very familiar with. I took a look at it though and after a couple of failed attempts at getting it to work I gave up.
I then later returned to this project after learning more about POST requests. A friend also suggested that I should investigate if I could use PHP to collect the POST information and I could indeed, something that totally changed the game for me. Now I was able to use something I was fairly familiar with to parse the information the game sent me.
After investigating the POST requests by using posttestserver.com (Excellent tool to investigate POST requests, highly recommend it) I found out exactly what the game was sending me. I then proceeded to create a HTML page that through JS Ajax was being updated every second with the correct information. The POST request I received was directly thrown into a text file with JSON-format, a very naive approach but I knew no other way at that point. In the beginning I ran into problems with caching, I couldn’t get the files to not cache every now and then and therefore I put the project to rest until I could obtain more knowledge about Ajax request as this was my first ever attempt at AJAX.
After another couple of months I returned to the project once more, destined to fix it all this time. I started by making a proper PHP file that correctly parses the POST request with added security to make sure it can’t be spoofed (not that it would make a huge difference). I then made a nice looking HTML file with an interesting design that is right now being updated every 500ms when a game is in progress.
I am fairly happy with the result. There are still improvements that could be done, I could build the page for multi-personal support that would allow my friends to have their own live updated page that also links to a main page where you can view everyone’s performances in comparison to each other. These are however ideas for the future when I come back to the project in a couple of months. The live updated page can be found here: slypeog.com/steam/gameint