A thing about custom heists
#1
Hi there!

You may know me from making custom heists, such as Manager Mayhem and Turret Takedown (secret advertisement, shhh..).

Anyhow, there's a thing I've noticed with custom heists, and I wanted to address the issue which I've been experiencing over the past week; Or at least, the issue mainly other people have been experiencing over the last week: Requiring the same heists as your friend, in order to play custom heists correctly.

I've been running some experiments and I've come up with an idea of why this happens, and how it potentially can be prevented. I'm quite certain that this is the case, and I wanted to write a topic about it, so I can link to it in my current and future mods, so people can read up on the issue.

What is the issue?
Whenever you download a custom heist, you may want to play it with a friend. Or perhaps a couple of friends. Now, usually, you all download the mod, one person hosts and you should be able to join each other just fine... right?

So, apparantly, whenever you own a different set of custom heists, it'll appear as if you friend is hosting a different heist, even though you both have the same mod. E.g.: You have both Shatter Heists and Turret Takedown, but your friend only has Turret Takedown. If your friend hosts, it may tell you that your friend is hosting Green Harvest from the Shatter Heists.

Sometimes this goes right, and nothing weird happens. Sometimes, this goes completely wrong and crashes the game immediatly. It's weird stuff, no matter what.

Why does this happen?
Here's my theory on why this happens:

Whenever a mod wants to add a new custom heist, you have a first create it, and then add it onto a particular thing which we call a 'table' in lua. A 'table' is simply a list, and all you do is add your heist at the bottom so the game can add it to e.g. the contract broker.

If you host a custom heist, the server will broadcast (send out towards other people on the internet) the id of the mission in the table. For example, if the table looks like this:

0 - Manager Mayhem
1 - Turret Takedown
2 - Election Day
3 - Framing Frame

If you would now host an "Election Day", you will broadcast value 2 to other players. The client of other people on the internet will then look up in the table what the value 2 equals to, and display this on your screen.

Now, people who are a bit into modding (or perhaps not at all), probably already see the issue coming. Imagine you have a different set of mods. This will result in a different mapping of the heists. So a different number will match with a different heist.

For example: You have two mods; Green Harvest and Turret Takedown (to stick with the previous example) and your friend only has Turret Takedown. Both tables will look like this:

Your table:
0 - <some_build_in_heist>
1 - Green Harvest
2 - Turret Takedown

Your friends table however...:
0 - <some_build_in_heist>
1 - Turret Takedown

Imagine your friend will now host Turret Takedown. It'll appear to you, as if your friend is hosting Green Harvest. The game will try to load this map in on your end once you start playing, and will therefor crash, as this doesn't equal the map your friend plays on.
Now imagine that you host Turret Takedown. Your friend will probably not be able to see you at all, as index number 2 doesn't exist within his table. Therefor, he won't be able to join you.

How can we solve it?
Really the only way to solve this, is by having the server broadcast the correct value. I'm not experienced enough with the actual Payday 2 source code in order to know if you can access this kind of data, but I do know that this will override a main game file, and thus will have to be included within a particular library (such as BeardLib or BLT). This may also make several other mods incompatible; Not sure about that either.

So, now you know why (most likely) you need to have the same custom heists as someone else does in order to play them online.
Reply
#2
I should be able to fix this issue pretty easily and include it in the MapFramework which is part of the new BeardLib version.

The game sends the 'index' of the level and job when it broadcasts the lobby and when it is updating the level and job information inside the lobby. All that is required is to modify the sending and parsing of those functions to include a string representation of the level id which can then be used to get the actual level/job information on the clientside.
Reply
#3
(05-31-2016, 04:41 PM)Simon / GREAT BIG BUSHY BEARD Wrote: I should be able to fix this issue pretty easily and include it in the MapFramework which is part of the new BeardLib version.

The game sends the 'index' of the level and job when it broadcasts the lobby and when it is updating the level and job information inside the lobby. All that is required is to modify the sending and parsing of those functions to include a string representation of the level id which can then be used to get the actual level/job information on the clientside.

It'd be superb if you could do that!

Great to hear that it's an easy fix; That really helps! Looking forward to it; It'll make custom heists so much more accessible to everyone!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)