• 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
 
MP Fix?
Playing against another tag who is actuwlly smart/cheeses too?
Spooky!
 
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.

Can you please fix the trade bonus take bug?
Upon loading a game you lose your bonus accepted culture due to trade bonus and have to spend 100 diplo power again which makes it worthless and makes it better to never use the trade bonus.
 
Last edited:
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.
If the game was balanced for MP you'd know it.

The game right now is 99.99% balanced for SP, and there's been a single actual change for multiplayer (unconditional surrender.)
 
The game is bloaty and filled to the brim with "features" made for SP people while MP suffers from this immensly which always warrants an MP mod to make the game playable.
There at least could be more MP features, or an official MP rebalance mod.
 
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.
But what for ? Most of the work done on either side would have to be also put into the other. If there is any feature implemented in the SP part, it'd have to be implemented in the MP part. And if a bug is fixed in the MP part, it'd be stupid not to fix it in the SP part. There is no way this could be better. You'd do double the work for nothing, since about half of what you'd do would be just rewriting what's in the other part of the game.
That'd also mean buying two games for the same experience ? So if I want to play SP I'd have to put 40€ into it, and if I want to play with friend I'd again have to spend 40€ ? For the same game ?

Again, what for ?
 
For Prussia's insanity? Because Paradox likes Prussia just being game breakingly overpowered so people can pretend they're good at the game by using prussian ideas + militarization to stack wipe when out numbered 3:1?

For Russia's now insanity? Because Orthodox is actually just stupid broken in MP and basically requires every country around them to find a way to cheese convert to it?

Because the Revolutionary government is a BENEFIT and everyone sets up cheese to get it immediately upon the age beginning?

Because Quality economic offensive religious quantity innovative is must-pick every game?

Because colonies give near limitless gold once you reach the mid game, and merc spamming to neverending wars becomes way too achieveable?

Because DEAR GOD HAVE YOU EVER NOTICED BANNERS DON'T USE MANPOWER?

I think SP players get the idea that the game is balanced for MP when in fact it's solely balanced for SP and worse yet they leave in these broken little fan favorite things that are actually just very unfun to deal with for anyone. Like, nobody ENJOYS Prussia yet Paradox leaves it in for everyone to form so you're always going to end up with someone forming Prussia mid-late game. If Prussia reaches age 4 with the age bonus they just straight 2 or 3 to 1 casualty everyone and the game just sorta ends there. They also made Manchu formable so everyone in the east now just tries to form Manchu since banners are basically mercenaries at 1/2 the cost that are actually stronger since they're cavalry, and their mil ideas are as good as any European Nation yet they're left in the Asia region which means they just infinite-manpower with better quality everyone to death.

Yes, most serious MP groups use a mod to fix this stuff, and I don't think anyone has ever complained about it. If anyone mentions how ahistorically broken Prussia is people go BUT MAH PRUSSIA MAH PRUSSIA!! So we just stick in our corner, don't complain, mod the game, and are appreciative of fixes to it.
 
So I would have to pay 40 bucks to get the SP-balanced game and another 40 to get the MP-balanced game, when we could just agree on a free balance mod to use in our session ?
Seems like an incredibly good idea
 
The game is bloaty and filled to the brim with "features" made for SP people while MP suffers from this immensly which always warrants an MP mod to make the game playable.
There at least could be more MP features, or an official MP rebalance mod.
Eh the SP people don't want the mechanics bloat either.
All these odd restrictions to fix some exploit that only mattered in MP is kind of annoying though.
 
Does that mean that next Dev clash will be Windows vs Mac vs Linux users ? ;)
 
For an example the cost for moving capital or trade capital.
Which was done entirely for SP? Because otherwise you could constantly move your capital to a 3 dev province and then use your -50% dev bonus to dev it up? Which is literally what they said when they made that change?

As for trade capital, I think that was just a dev thought process so the AI and player wouldn't constantly be flipping their trade capitals.

I'mma be honest I'm trying to figure out how you think a cost for changing your capital is related to MP, and I can't think of a single reason why you'd believe that.
 
Yes! Finally addressing important issues.

Talking about that, I would gladly pay a 20€ DLC that removed the need to restart the game every time I want to go back to the main menu. Just that.
 
Yes! Finally addressing important issues.

Talking about that, I would gladly pay a 20€ DLC that removed the need to restart the game every time I want to go back to the main menu. Just that.
I think they stated that it was because you'd have some errors/artefacts which would become apparent once you start a new game
 
Which was done entirely for SP? Because otherwise you could constantly move your capital to a 3 dev province and then use your -50% dev bonus to dev it up? Which is literally what they said when they made that change?
Why would it matter if people did that in SP? In MP it would become a Meta and screw with the balance but in SP you're really only screwing yourself out of the fun of playing the game the way it was meant to be played.
 
You're missing the point
If you want to cheat then don't play ironman and just cheat.

If you don't want to cheat then play ironman and don't savescum.

I don't really see how being able to move your capital at 0 cost to 3 dev provinces to dev them to 30 dev for like 200 monarch points would be anything less than cheating