This web application is based mostly on another mans work. Danny Fisher (dannythefool @ civfanatics.com, among other things) created a python script that parses finished civilization 5 replay files into either a fancy HTML5 document or a CSV file with all the events.
Currently i am just putting the entire outputted HTML directly to the web (albeit in a very stupid way at the moment, reading the file!). A better way would perhaps be to include the static generated file (stripping out the html header and footer) and placing the needed javascript in a separate file to be included.
Or i could store the events one by one in a database on a per-game basis? I am using mongodb at the moment so each game could have it’s own collection or something like that. I’m open to suggestions!
This application uses Ruby 1.9.2, Sinatra, MongoDb, resque, unicorn and varnish.
I just switched over to use varnish as the frontend instead of nginx and it’s working great so far. I need to work a bit on caching rules (replays for instance could really be cached pretty much forever, they do not change) I’ve also started to use a replica set for my mongodb configuration, it’s currently running on three virtual machines.
There is still lots of work to be done to the parsing python script, the best thing would probably be to make it generate just the data (it can, with CSV) then make a better front end that serves it up here. At the moment i’m storing a entire html file on disk and actually reading it (as you can see). That is ridiculously stupid, i should at least store those in gridfs or something with mongodb, that would probably make more sense + they would be a lot safer being stored across several servers.
Currently there has been about 2600 visits in total since i launched this service in late november. Currently at around 400 visitors per month. Not sure if its gaining popularity or not, I haven’t heard back from more than a few people that seem to like it.
It would be cool if the parser could be extracted/rebuilt as a library to be used from many different languages. One central updated replay parser that would work on all replays and keep up to date with game updates.
This current one is not being maintained by Danny it seems and i do not have the knowledge, the game or the time to keep it working sadly. If anyone would like to help out with anything, please by all means contact me here or anywhere you find me!
The parser will soon (ish) hopefully be updated more as MouseyPounds from the civfanatics forum has agreed to take a look at all the failed parses to fix the script to work with them. He has said that the script will probably not work with the various DLCs unless we rewrite it in a major way.
Time will tell eh?