Stop server from restarting map when second player joins?

User avatar
jrivett
Posts: 17
Joined: Sat Nov 26, 2011 8:03 pm
Location: Vancouver, Canada
Contact:

Stop server from restarting map when second player joins?

Post by jrivett »

I'm not sure why the BF42 developers set it up this way, but when the second player joins a server, the running map is restarted. The first player loses their score to that point. It doesn't do this when the first player joins, or when the third or any additional players join. It also doesn't do it when there was more than one player, all but one of them dropped out, then a second player joins in (all on the same map). This behaviour is a constant source of annoyance on my server. I've searched everywhere for a way to fix this, but found nothing.

I've started looking at the server code with the tools recommended elsewhere here (OllyDbg, IDA Pro). I've done assembly programming, but it was a while ago on a much less complex processor (6502). But I think I know what I'm looking for: a comparison of the number of players with 2, and a subsequent jump if the comparison is true. So I'll keep slogging away.

But just in case any of you serious assembly coders out there is interested in solving this problem, I figured I'd post this. Any takers?
tuia
Posts: 129
Joined: Tue Sep 06, 2011 12:36 pm
Location: Lisbon, Portugal

Re: Stop server from restarting map when second player joins

Post by tuia »

I'll have a look at the server code. No guarantees i'll find the right addresses. :)
You can create a dummy client to overcome that problem.
User avatar
jrivett
Posts: 17
Joined: Sat Nov 26, 2011 8:03 pm
Location: Vancouver, Canada
Contact:

Re: Stop server from restarting map when second player joins

Post by jrivett »

tuia wrote:I'll have a look at the server code. No guarantees i'll find the right addresses. :)
I was hoping you'd take a look. Awesome! Any clues you can provide, or any advice, would be most welcome.
tuia wrote:You can create a dummy client to overcome that problem.
Yeah, I thought about that, but couldn't figure out how to automate it. It sounds like you've done it before. If so, how did you make it work?
tuia
Posts: 129
Joined: Tue Sep 06, 2011 12:36 pm
Location: Lisbon, Portugal

Re: Stop server from restarting map when second player joins

Post by tuia »

I haven't tried to create a dummy client before. One possible idea is to run a BF1942 executable shortcut with the following arguments "+restart 1 +joinServer XXX.XXX.XXX.XXX:14567" in another spare computer on your local network, where XXX.XXX.XXX.XXX is the local IP address of your dedicated server. It's a waste of computer resources, running a client, just to make numbers. There may be other ways, I don't know.
freddy
Posts: 1267
Joined: Sun Oct 18, 2009 4:58 pm

Re: Stop server from restarting map when second player joins

Post by freddy »

here is the code for it

Code: Select all

game.setMinNrOfPlayers 0
it works the other way around to

Image
User avatar
jrivett
Posts: 17
Joined: Sat Nov 26, 2011 8:03 pm
Location: Vancouver, Canada
Contact:

Re: Stop server from restarting map when second player joins

Post by jrivett »

freddy wrote:here is the code for it

Code: Select all

game.setMinNrOfPlayers 0
I'm not familiar with that command. It doesn't seem to work at the console. If it goes in a CON file, which one? Or would it need to be added to every map RFA?

Possibly this setting is related to the PvP server setting that prevents a game from starting if there are fewer players than the amount specified. If so, I don't think it's going to help with a co-op server like mine.
freddy
Posts: 1267
Joined: Sun Oct 18, 2009 4:58 pm

Re: Stop server from restarting map when second player joins

Post by freddy »

User avatar
jrivett
Posts: 17
Joined: Sat Nov 26, 2011 8:03 pm
Location: Vancouver, Canada
Contact:

Re: Stop server from restarting map when second player joins

Post by jrivett »

freddy wrote:yeah works with co-op to
http://www.battlefieldsingleplayer.info ... &recid=839
That's great! It sounds like you've used this setting successfully. Can you provide any information as to where the setting is used? As I mentioned previously, it doesn't work at the server console. And since it's never used in any of the stock maps or default server settings files, I'm not sure where it belongs.
tuia
Posts: 129
Joined: Tue Sep 06, 2011 12:36 pm
Location: Lisbon, Portugal

Re: Stop server from restarting map when second player joins

Post by tuia »

I've managed to find what to change in the server executable (BF1942_w32ded.exe v1.61), so the map doesn't restart when a 2nd player joins. You'll need to change byte value at address 0x0047821C (offset 0x0007821C) from 75 to EB. This change makes the server believe it has already restarted the map. Please, test it thoroughly. I'm positive it works fine.
The solution that freddy suggested works, if you have the server executable patched to authorize some commands. I can tell you what you need to edit in the server executable, to accept commands unauthorized. It's only one byte change as this one.
User avatar
jrivett
Posts: 17
Joined: Sat Nov 26, 2011 8:03 pm
Location: Vancouver, Canada
Contact:

Re: Stop server from restarting map when second player joins

Post by jrivett »

tuia wrote:I've managed to find what to change in the server executable (BF1942_w32ded.exe v1.61), so the map doesn't restart when a 2nd player joins.
IT WORKS. I've tested it and it's now live on my server (Tanks 'n Planes Unlimited). You are a god among men, sir. I remember when I used to do amazing stuff hacking Apple II game executables, which was pretty cool but a lot easier than this Intel stuff. If you want a look at what it was like back in those days, check out the Computist archive. I actually got paid to write about Apple II hacking back then: http://computist.applearchives.com/pdfs ... ssue14.pdf.
tuia wrote:The solution that freddy suggested works, if you have the server executable patched to authorize some commands. I can tell you what you need to edit in the server executable, to accept commands unauthorized. It's only one byte change as this one.
Okay, good to know. Is the patch you're referring to documented in the forum here somewhere? If so, point me to it. Otherwise, yes please, let me know what that patch is and what it does.

Many many thanks!
Post Reply