• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

comagoosie

Perennial Dreamer
53 Badges
Apr 14, 2007
8.765
50
  • Hearts of Iron IV: Death or Dishonor
  • Europa Universalis IV: Common Sense
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: Together for Victory
  • Cities: Skylines - Mass Transit
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Third Rome
  • Surviving Mars
  • Rise of Prussia
  • Cities: Skylines - Green Cities
  • Europa Universalis IV: Cradle of Civilization
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Rule Britannia
  • Cities: Skylines - Parklife
  • Europa Universalis IV: Dharma
  • Cities: Skylines Industries
  • Europa Universalis IV: Golden Century
  • Imperator: Rome
  • Cities: Skylines - Campus
  • Imperator: Rome - Magna Graecia
  • Europa Universalis 4: Emperor
  • Europa Universalis III Complete
  • Crusader Kings II
  • Europa Universalis III
  • Divine Wind
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • For the Motherland
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Heir to the Throne
  • Europa Universalis III Complete
  • Hearts of Iron Anthology
  • Europa Universalis IV: Res Publica
  • Europa Universalis: Rome
  • Semper Fi
  • Victoria 2
  • Rome: Vae Victis
  • 200k Club
  • 500k Club
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Pre-order
Update February 11th, 2016

[Work has stopped] on the web version, yes, but there are a couple forum members right now playing with a pre-alpha cross platform app of the same nature. The only thing that works solidly is dumping an excel spreadsheet of the save game data, but I have a couple ambitious ideas in the works (charts/maps/etc). If there is enough interest, I'll open a preliminary thread for people to play around with it​

Let me prefix this by apologizing because this post will be a mix of content for technical people as well as content for those that just want to see statistics for their save game!

Here's an example of a save game I uploaded earlier today
update: this one is cooler!
A multiplayer save

Introduction

As briefly alluded to – EU4 Stats is a web application that when given a save game, will generate a series of statistics that you can share with friends.

Everything is open sourced, so if you’d like to contribute to the project (in terms of code or ideas) you are more than free to! This is a pet project of mine, so hopefully someone finds this useful/interesting besides myself!

Limitations


  • The application is designed to generate statistics on a given save game and then throw the save game away, the reason being that save games take up several megabytes each and the server only has a couple gigabytes to work with. So if new features are added to the application, the save game has to re-uploaded.
  • Only tested with the latest EU4 game (as of right now it is 1.9.2, but obviously subject to change)
  • Expect backups at high load. The application is hosted on a cheap server
  • I give no guarantees, but accept all bug reports

Behind the Scenes

In lieu of a fancy diagram detailing how the application works, I’m providing a bulleted list of chronological systems that makes everything tick.

  • Selected save game is compressed if not already (JSZip used for compression)
  • Save game hits an nginx server on a DigitalOcean, which saves the file to a temporary location
  • Reverse proxies the temporary location to a Nancy server
  • Parse the file into an in-memory representation of the game (language used: C#)
  • Generate a series of statistics based on the game (language used: F#)
  • Pass statistics to a Razor template, which creates a static html page
  • Returns the url for the client to navigate to for the rendered statistics
  • Nginx forwards the request while deleting the temporary location
  • Client navigates to page and uses Datatables to render the tables with a little help of styling from Pure.

What’s Next?

This release tests the water for an application such as this. If there is overwhelming positive feedback and suggestions for improvement, I’ll continue working on this in parallel to the next version of this project. I say “next version”, but it is little more than a fanciful thought in my head. I do believe there needs to be next version due to the limitations listed above.

Being tested on only a single version of the game is a serious downfall, but this is due to the parsing of the save game. Between expansions and patches, Paradox will change the save game (add/remove/change fields), which breaks compatibility with the parser. A better approach would be store save games whole, and then pick attributes out when a client asks for it. This would also allow for statistics for a particular game to improve as the features are released. How this should be accomplished is an interesting question. Save games could be stored in S3 as is, and ran through something akin to XQuery for Paradox files on retrieval, and pushed to the client. Alternatively, save games could be converted into JSON and possibly squirreled away in a document store such MongoDb. As you can see, there are a ton of options and this will require a lot of mulling over.

Since more information will be available to the client I’m been thinking of managing it with something like Ember.js. This would make it easier to add features such as user accounts (so one could keep track of all the save games they have uploaded) and create cross savegame analysis.

I think I’m getting too excited now. We’ll see how things pan out, but of course first things first, try out the first version and let me know what you think.

EDIT: Looks like some of you guys are having a hard time uploading, let me know the error, the game version, and if it is 1.9.2, you could help me out by uploading it somewhere :D
 
Last edited:
  • 9
  • 3
Reactions:
That's really cool, thanks a lot!

Edit: when I uploaded my first save I got an "ERROR: When reading inside brackets the first token must be a left curly" message.
 
That's really cool, thanks a lot!

Edit: when I uploaded my first save I got an "ERROR: When reading inside brackets the first token must be a left curly" message.
Yeah, that error is common if you aren't looking at a 1.9.2 savegame (because only the latest patch can be supported at a time). If you tried to upload a 1.9.2 savegame then that shouldn't have happened and I'd love to look at that savegame!
 
Oh, I thought it might be that. I wasn't sure what version my savegame was when I picked it.
 
I tried my latest autosave with the vanilla. A new error message: "ERROR: The given key was not present in the dictionary."

Should I turn off any DLCs?
 
https://dl.dropboxusercontent.com/u/46623133/eu4/1820_12_31.zip

This is from the observer game I ran in 1.9.2 last week. It got the curly bracket error.

Looks like a nice little tool though. Like the sample.

Edit: Should mention, it was not a compressed save.

Thank you, I've downloaded it (so you can delete it if you wish).

Looks like I wasn't expecting army templates in save files. I'll reply back when I have a fix.

I tried my latest autosave with the vanilla. A new error message: "ERROR: The given key was not present in the dictionary."

Should I turn off any DLCs?

Interesting. The parser should work with DLCs, the error you get is when a country's name can't be found. I'll have to do some more digging.

Thank you both for testing it out!
 
Thank you, I've downloaded it (so you can delete it if you wish).

Looks like I wasn't expecting army templates in save files. I'll reply back when I have a fix.
That's a bit odd. That entire game was played in observer mode. The only time I was ever even a country was when I first started it up. Glad it helped find the issue though!
 
Whoa, how do you have an ironman file :confused:

I thought they were online only?
To find your cloud save games see this post from Bug Reports forum: http://forum.paradoxplaza.com/forum...al-copy-location-and-how-to-delete-from-Cloud

Local Ironman saves are stored in your regular save folder, so much easier to get at.


http://eu4stats.com/games/39

Here you go, everything should work! :)
Nice! If all the numbers are right, trade companies are ridiculously OP right now. Although I don't see any of the major powers listed anywhere, so maybe it's labeling them wrong as their trade companies?
 
Nice job, OP. Only suggestion I would make is to add leader stats(fire/shock/etc.) on the leader report. I'm curious how good Mahmud II Zand was to have won all 54 of his battles lol.
 
Thank you, I've downloaded it (so you can delete it if you wish).

Looks like I wasn't expecting army templates in save files. I'll reply back when I have a fix.



Interesting. The parser should work with DLCs, the error you get is when a country's name can't be found. I'll have to do some more digging.

Thank you both for testing it out!

Thank you too. This tool can br very useful when testing out the results of changes to a mod's files.
 
Just posting to give a big thumbs up to OP - nice app, will probably use it one of these days.
 
Only looked briefly, but a few suggestions for something that looks promising!

A linked table of contents
Replacing the country abbreviations with the country names
The leader list is very long, maybe make it sortable or internal scrolling just for that list

I realize it's a free app, etc. Just a few user friendly / quality of life things, great work!
 
I would've love to contribute to the statistics, but F# for the statistics is an ... interesting choice of language. :(
 
Nice job, OP. Only suggestion I would make is to add leader stats(fire/shock/etc.) on the leader report. I'm curious how good Mahmud II Zand was to have won all 54 of his battles lol.

I think I did it, you mean something like the save game I just uploaded?

http://eu4stats.com/games/48

Only looked briefly, but a few suggestions for something that looks promising!

A linked table of contents
Replacing the country abbreviations with the country names
The leader list is very long, maybe make it sortable or internal scrolling just for that list

I realize it's a free app, etc. Just a few user friendly / quality of life things, great work!

Thanks for checking it out. I really like the table of contents suggestions as that gets more useful the longer the page gets!

As far as country abbreviations go, I'm afraid they will have to stay because in order to stay compatible with mods, one can't assume they know what the abbreviations are. (The name of the country isn't listed in the save game anywhere, abbreviations are all we have to work with -- unless it is a colony -- but that's a different story).

I'm unsure why the leader list is misbehaving for you. It should only list about 15 leaders at a time. Sorting is available as well. Maybe it is your browser environment?

I would've love to contribute to the statistics, but F# for the statistics is an ... interesting choice of language. :(

Guide - Data Science with F#

I hope not :)
 
I'm unsure why the leader list is misbehaving for you. It should only list about 15 leaders at a time. Sorting is available as well. Maybe it is your browser environment?

Ah, was noscript, enabling the site fixed those things!

No idea if this data is available for you to use, but can you have a 10 biggest naval/land battles list(s), similar to the wars ones?

Also under world statistics: total number of troops and total number of ships?