• 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.

EU4 - Development Diary - 31st of October 2017

Good morning all. We're back with another dev diary. As mentioned last week we have been working on something behind the scenes. In a nutshell, we have put a tonne of work into multiplayer, to tackle some long-standing thorns such as Hotjoin and Cross-platform issues. Many users have raised issue with these functions not working well, or indeed at all, and with good reason! Like last week, I'll hand the mic over to the man responsible for the bulk of this, @Alexivan

################

Hi. I’d like to start by saying that multiplayer support for our games is not an easy task, and sometimes we dev’s joke that it would be easier to simply cut that feature. But, seeing people having a great time playing together inspires us to continue supporting it. Not to mention that we love playing ourselves in our Dev Clash MP.

EU4 has a lot of complexity when it comes to multiplayer as it has the largest amount of configurations MP can be played on among our games, the factors being:

Platform
DLC configurations
Hotjoin
Start dates/save game
Custom nations
World randomization
Random new world

Our efforts so far have mostly concentrated on hosting a game with 1444 and continuing a save game. During the development of this update however we’ve put some more effort on making MP work across all the different configurations, in the priority order of the list. I’d like to share some wisdom about some of the issues we’ve encountered and methods we use.

When we started working on the MP for the upcoming 1.23 Persia update the goal was to get hotjoin working again. Hotjoin is basically copying over the current state of the game to the newly connected player which in theory is a pretty simple thing to do. There are two parts of the gamestate that need to be synchronized: all the data that is saved in the gamestate, and all the data that is not. We’ll call these categories persisted and cached.

Starting with the persisted data we noticed that saves were not being saved as they are read, meaning we modify the savegame while reading and writing it. While this works for the standard setup as everyone applies the same changes when they all load the game it causes hotjoin to desynchronize as only the hotjoiners are doing the changes.

We added a console command called check_save to help us find this issue, it’s a console command that saves the game, loads it up, and saves it again. This helped us find most of the issues with savegame inconsistency. Most of the issues here came from calling gameplay logic when reading the save, so reading a country government could for example apply some modifiers or reset some variables. Otherwise it was mostly variables not being written/read properly.

For the cached data we had to do a couple of things. First we added a recalculation step which happens when you load a savegame or a hotjoiner enters the game, this step recalculates all the cached data. A lot of the data in this step was derived from the persisted data, which worked fine. Some however was dependent on other cached data, causing things to be recalculated differently, we solved this by moving all cached values into a separate container so we could easily clear all cached data before calculating it, guaranteeing the same results.

Another issue with persisted data would be load order dependencies. There are two common issues here, the first one being that objects that were loaded sometimes put themselves in a list. This causes the list to be sorted by the order of objects being loaded, rather than whatever order they were in when saving the game. Once these lists were identified the easy fix was to simply sort the lists in a deterministic order. The second issue is that objects being read from the savegame are sometimes referencing other objects in the savegame, which haven’t been read yet. The thing we do here is save the object ID mentioned in the save and dereference in a step after the save has been loaded.

After check_save resulted in the savegames with no differences, we started running MP tests to find more issues. One thing that helps us a lot with this is the randomlog, which is a tool we use to help us track desynchronized computation sequences. The way it works is that we add lines in the code which prints to the randomlog, when a desync happens we can then compare the randomlog data of the host to that of the desynchronized client and see what the client did differently. This shows us what happened incorrectly, but usually isn’t enough to pinpoint why. If we can’t figure out what happened we add more entries in related code to try getting closer to the source issue. This can be a slow process where we sometimes have to add more logs lots of times to help us find the issue, especially if the desync doesn’t happen consistently due to multithreading or the desync being a rare case.

As QA time for finding desyncs is limited, testing was slow, and we still knew we had a lot of desyncs to find so we had to start automating tests. For this we updated the standalone server build and improved on the script we use to help us find desyncs faster, this also allowed us to run the automated tests over the weekends and nights and fix during the days, which greatly improved our efficiency, the script was also updated to restart when an issue has been found, generating a lot of different desyncs.

As we now could get multiple desyncs with logs and data we needed to improve our method for collecting desync data, so we copied over the OOS dumps system from stellaris. This system copies over data relevant to the desync into a unique folder inside Paradox Interactive/Europa Universalis IV/oos folder. The name of the folder is a unique hash describing the desync and can be used to match the desync between clients and host.

All in all, I’ve been working on all this for the last 7 months with a lot of help from the team, a lot of systems had to be fixed and specialized solutions had to be invented, it’s been quite a bigger task than I initially expected. I was hoping to get it to a perfect state for this release but it’s not quite there yet.

So if you get desyncs I recommend letting us know, try giving us as much information as you could and more specifically how the game was set up, the OOS dump, and any savegame you might have loaded. If you manage to get desynced consistently I recommend starting the game with the “-randomlog” and “-hardoos” launch options on the host to generate better data for the OOS dumps. But otherwise it might be better to keep it turned off as it uses memory and slows down the game. I’m going to look into if we could potentially use something like the crash dump uploader to make it easier for you guys to send this data to us.

tl;dr: A lot of work on multiplayer has been done, and it will continue. Cross Platform, Cross DLC, and Hotjoin should now be working. Reporting your desyncs might get them fixed faster. If you guys have any questions or suggestions I’d be glad to discuss in this thread.

##################

Thanks Alexivan. Next week we'll have another mixed bag of Cradle of Civilization goodies. With the release only a couple of weeks away, we need to round off on all the new things coming in 1.23 and Cradle.

Although, this dev diary doesn't have any images in it...hrmm, let's change that.

eu4_mill_360.gif
 

Wagonlitz

Resident WW Foreigner
103 Badges
Jul 19, 2010
8.196
5.452
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis III: Chronicles
  • Hearts of Iron IV: Expansion Pass
  • Stellaris
  • Europa Universalis IV
  • Hearts of Iron IV: Death or Dishonor
  • Europa Universalis 4: Emperor
  • Crusader Kings III
  • Victoria 3 Sign Up
  • Hearts of Iron III Collection
  • Europa Universalis IV: Dharma
  • Crusader Kings III: Royal Edition
  • Supreme Ruler 2020
  • Pirates of Black Cove
  • Crusader Kings Complete
  • Hearts of Iron IV: Cadet
  • Europa Universalis IV: Cradle of Civilization
  • Steel Division: Normand 44 Sign-up
  • Europa Universalis IV: Mandate of Heaven
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis III Complete
  • Crusader Kings II: Reapers Due
  • Europa Universalis: Rome
  • Hearts of Iron IV: Field Marshal
  • Hearts of Iron IV: Colonel
  • Europa Universalis III Complete
  • Crusader Kings II: Conclave
  • War of the Roses
  • 500k Club
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Humble Paradox Bundle
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Cossacks
  • Imperator: Rome Sign Up
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Imperator: Rome Deluxe Edition
  • Europa Universalis IV: Golden Century
  • Europa Universalis IV: Rule Britannia
  • Crusader Kings III Referal
  • Imperator: Rome - Magna Graecia
  • Europa Universalis IV: Dharma Pre-order
  • Stellaris: Distant Stars
  • Rome Gold
  • Deus Vult
  • Europa Universalis IV: Common Sense
  • Europa Universalis III
  • Europa Universalis III Complete
  • Heir to the Throne
A lot of them have, internal QA tests are looking good on this front, make a report if you encounter any issues.
That sounds amazing. I had essentially given up on playing MP, since I'm on Linux and the people I play with are all on Windows. Last time I tried playing MP I spent 3 hours getting immediate OOS upon game start.
 

Strager

General
10 Badges
Jan 9, 2007
2.068
1.137
  • Crusader Kings II
  • Deus Vult
  • Europa Universalis III
  • Divine Wind
  • Europa Universalis IV
  • Heir to the Throne
  • Europa Universalis III Complete
  • 500k Club
  • Europa Universalis IV: Pre-order
  • Stellaris Sign-up
This Dev Diary is evidence of the #1 complaint about multiplayer - You are taking resources away from the SP game in order to have it. PLEASE make Multiplayer a SEPARATE GAME with a SEPARATE TEAM working on it. I don't care for it, don't want it taking resources from the SP game or affecting SP balance in any way, and don't want the money I spend on the SP game to go towards improving it in any way. Grand Strategy are single player games at their heart and all this MP focus is not good for them. Thanks!
 

Gratak

Field Marshal
97 Badges
May 27, 2014
5.078
2.236
  • Victoria 2: A House Divided
  • Sengoku
  • Cities: Skylines - After Dark
  • Crusader Kings II: Jade Dragon
  • Europa Universalis IV: Third Rome
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Conclave
  • Stellaris: Apocalypse
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Together for Victory
  • Pillars of Eternity
  • Europa Universalis IV: Mandate of Heaven
  • Crusader Kings Complete
  • Surviving Mars
  • Hearts of Iron IV: Death or Dishonor
  • Age of Wonders
  • Age of Wonders II
  • Cities: Skylines - Green Cities
  • Europa Universalis IV: Cradle of Civilization
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Prison Architect
  • Shadowrun Returns
  • Cities: Skylines - Parklife
  • Europa Universalis IV: Golden Century
  • Crusader Kings II: Holy Fury
  • Surviving Mars: First Colony Edition
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: Dharma
  • Age of Wonders: Planetfall Deluxe edition
  • Europa Universalis IV
  • Age of Wonders: Planetfall
  • Stellaris: Ancient Relics
  • Europa Universalis IV: Common Sense
  • Hearts of Iron IV: Expansion Pass
  • Imperator: Rome
  • Imperator: Rome Deluxe Edition
  • Stellaris: Necroids
  • Victoria 2
  • Warlock: Master of the Arcane
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Pride of Nations
  • Crusader Kings II: Way of Life
This Dev Diary is evidence of the #1 complaint about multiplayer - You are taking resources away from the SP game in order to have it. PLEASE make Multiplayer a SEPARATE GAME with a SEPARATE TEAM working on it. I don't care for it, don't want it taking resources from the SP game or affecting SP balance in any way, and don't want the money I spend on the SP game to go towards improving it in any way. Grand Strategy are single player games at their heart and all this MP focus is not good for them. Thanks!
I have never played a single MP game in EU4 and still I have to disagree with you... What you are saying makes no sense at all.. Making two games which are essentially the same just means redundant work and less money (and thus less dev time) for either game...
 

Quaade

Field Marshal
70 Badges
Mar 28, 2007
3.716
1.978
  • Hearts of Iron IV Sign-up
  • Cities: Skylines Deluxe Edition
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Pre-order
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Cities: Skylines
  • Stellaris Sign-up
  • Hearts of Iron IV: Cadet
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Stellaris: Leviathans Story Pack
  • Cities: Skylines - Natural Disasters
  • Hearts of Iron IV: Together for Victory
  • Crusader Kings II: Monks and Mystics
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - Mass Transit
  • Europa Universalis IV: Mandate of Heaven
  • Victoria 3 Sign Up
  • Europa Universalis IV: Conquest of Paradise
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis III
  • Divine Wind
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Crusader Kings II
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Impire
  • The Kings Crusade
  • Majesty 2 Collection
  • Europa Universalis IV: Res Publica
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • War of the Roses
The launch options won't do anything for crashes, only generate more data for desyncs.
So I should advise host to use the launch options and then send in that?
 

Milith

Major
48 Badges
Jul 21, 2014
660
1.206
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: Third Rome
  • Stellaris
  • Europa Universalis IV: Mare Nostrum
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - After Dark
  • Crusader Kings II: Jade Dragon
  • Rome: Vae Victis
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Crusader Kings II
  • Rome Gold
  • Victoria: Revolutions
  • Europa Universalis IV: Call to arms event
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Res Publica
  • Prison Architect
  • Crusader Kings II: Holy Fury
  • Stellaris: Megacorp
  • Cities: Skylines - Parklife
  • Europa Universalis IV: Cradle of Civilization
  • Age of Wonders III
  • Crusader Kings III
  • Europa Universalis IV: Mandate of Heaven
  • Stellaris - Path to Destruction bundle
  • Crusader Kings II: Monks and Mystics
  • Europa Universalis IV: Rights of Man
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV Sign-up
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Pillars of Eternity
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
  • Cities: Skylines
  • Victoria 2
This is great news, continuous rehosts are a big issue in large multiplayer games and I know for a fact that too much waiting in the lobby can discourage new people from an otherwise great experience.

Will the game have to be paused while someone is downloading the game state? How does the joining player select his country?
 

Alexivan

Programmer
Paradox Staff
9 Badges
Oct 7, 2013
218
458
  • Crusader Kings II
  • Europa Universalis III
  • Europa Universalis III: Chronicles
  • Divine Wind
  • Heir to the Throne
  • Magicka
  • War of the Roses
  • Stellaris Sign-up
  • Prison Architect
This Dev Diary is evidence of the #1 complaint about multiplayer - You are taking resources away from the SP game in order to have it. PLEASE make Multiplayer a SEPARATE GAME with a SEPARATE TEAM working on it. I don't care for it, don't want it taking resources from the SP game or affecting SP balance in any way, and don't want the money I spend on the SP game to go towards improving it in any way. Grand Strategy are single player games at their heart and all this MP focus is not good for them. Thanks!
During this patch project I've been an extra resource assigned to the project to help out with MP, the rest of the team have spent most of their time on adding features and fixing bugs. So don't worry about the patch/expansion not being same quality as always.

What's probably even more important is that there was quite a lot of bugs in singleplayer which were found when testing and fixing MP that've gotten fixed during this patch which would probably not have been looked at otherwise, so development on the MP part also improves SP. As for the money aspect of all this, I think all the SP fixes alone are worth the extra money the project spent on having me during this time.
 

Strager

General
10 Badges
Jan 9, 2007
2.068
1.137
  • Crusader Kings II
  • Deus Vult
  • Europa Universalis III
  • Divine Wind
  • Europa Universalis IV
  • Heir to the Throne
  • Europa Universalis III Complete
  • 500k Club
  • Europa Universalis IV: Pre-order
  • Stellaris Sign-up
I have never played a single MP game in EU4 and still I have to disagree with you... What you are saying makes no sense at all.. Making two games which are essentially the same just means redundant work and less money (and thus less dev time) for either game...

Having two titles (EU5 and EU5: Online for example) allows them to balance the titles differently. It also allows them to determine how much of the money is being spent by people who want MP (and this money can be used primarily on MP stuff) and how much by the population at large (which could be spent on the core game/SP version) - creating an MP focused team also means more specialized work which should improve that experience for the players who enjoy that sort of thing.
 

Strager

General
10 Badges
Jan 9, 2007
2.068
1.137
  • Crusader Kings II
  • Deus Vult
  • Europa Universalis III
  • Divine Wind
  • Europa Universalis IV
  • Heir to the Throne
  • Europa Universalis III Complete
  • 500k Club
  • Europa Universalis IV: Pre-order
  • Stellaris Sign-up
During this patch project I've been an extra resource assigned to the project to help out with MP, the rest of the team have spent most of their time on adding features and fixing bugs. So don't worry about the patch/expansion not being same quality as always.

What's probably even more important is that there was quite a lot of bugs in singleplayer which were found when testing and fixing MP that've gotten fixed during this patch which would probably not have been looked at otherwise, so development on the MP part also improves SP. As for the money aspect of all this, I think all the SP fixes alone are worth the extra money the project spent on having me during this time.

Thanks so much for responding to my rant. :)

This is close to what I was going for, hadn't realized they weren't using standard resources. P-Dox is a wonderful company (however much I rib them here) but it has transparency issues - most of them for good reasons I'd imagine. I'm already thinking about EU5 to be honest - EU4 is too mature a product at this point to expect structural changes to the design philosophy and team-makeups.
 

vertinox

Field Marshal
75 Badges
Aug 10, 2002
3.742
271
twitch.tv
  • Mount & Blade: Warband
  • Europa Universalis: Rome
  • Rome Gold
  • Semper Fi
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
  • 500k Club
  • Cities: Skylines
  • Crusader Kings II: Holy Knight (pre-order)
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Pre-order
  • Victoria: Revolutions
  • Mount & Blade: With Fire and Sword
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Achtung Panzer
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Hearts of Iron IV Sign-up
  • Stellaris Sign-up
  • Prison Architect
  • Europa Universalis IV
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Deus Vult
  • Europa Universalis III
  • Divine Wind
  • Arsenal of Democracy
  • 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
  • March of the Eagles
  • Europa Universalis III Complete
Yeah Desync rehosting and better hotjoin is a welcome feature for EU4.

How much effort would it take to add that to CK2 as well? Purty please with cherry on top! :oops:

(By that... I would be willing to pay for a CK2 host DLC which allows the host to resync a desynced game without rehosting)
 

RandomZach

Captain
49 Badges
Nov 11, 2013
357
198
  • Stellaris: Synthetic Dawn
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Magicka
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Third Rome
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - Parklife
  • Imperator: Rome Deluxe Edition
  • Europa Universalis IV: Rule Britannia
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Cradle of Civilization
  • Age of Wonders III
  • Stellaris: Distant Stars
  • Europa Universalis IV: Dharma
  • Europa Universalis IV: Golden Century
  • Stellaris: Nemesis
  • Imperator: Rome Sign Up
  • Stellaris: Ancient Relics
  • PDXCon 2019 "Baron"
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Europa Universalis 4: Emperor
  • Stellaris: Necroids
  • BATTLETECH
  • Europa Universalis IV
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Pre-order
  • Magicka 2
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Hearts of Iron IV Sign-up
  • Hearts of Iron IV: Cadet
  • Europa Universalis IV: Rights of Man
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Together for Victory
  • Europa Universalis IV: Mandate of Heaven
  • Hearts of Iron IV: Death or Dishonor
  • Stellaris: Megacorp
  • Imperator: Rome
  • Crusader Kings II
Have you addressed how slowly saves transfer when hosting or hotjoining? Even playing over LAN it seems to cap out at ~50kb/s for me. It often takes minutes to transfer a 2-6 mb save file.
 

Alexivan

Programmer
Paradox Staff
9 Badges
Oct 7, 2013
218
458
  • Crusader Kings II
  • Europa Universalis III
  • Europa Universalis III: Chronicles
  • Divine Wind
  • Heir to the Throne
  • Magicka
  • War of the Roses
  • Stellaris Sign-up
  • Prison Architect
Yeah Desync rehosting and better hotjoin is a welcome feature for EU4.

How much effort would it take to add that to CK2 as well? Purty please with cherry on top! :oops:

(By that... I would be willing to pay for a CK2 host DLC which allows the host to resync a desynced game without rehosting)
Oh my god, I can't even imagine how much work it would be for CK2, I hope If that ever happens that I won't be the one to do it :p

Have you addressed how slowly saves transfer when hosting or hotjoining? Even playing over LAN it seems to cap out at ~50kb/s for me. It often takes minutes to transfer a 2-6 mb save file.
We have unfortunately not looked into improving the transfer speeds but I have noticed it being super slow sometimes, never that slow though. If you manage to reproduce this with the new version I'd love if you sent me a PM so we can gather some data, maybe we can figure something out.