MisterTea / MAMEHub

Netplay-capable multi-machine emulator
http://www.mamehub.com
117 stars 29 forks source link

Feature request - improving netcode #231

Closed doctorguile closed 10 years ago

doctorguile commented 10 years ago

Hi there,

Just discovered mamehub and it's awesome!

We are a group of fighting games enthusiasts.

ggpo.net and supercade are quite good but the emulator (final burn alpha) is very much outdated.

MAME is very nice but we did an informal test and the net code used by mamehub is quite a bit laggier than ggpo.

Do you have any plans to enhance the netcode?

Maybe something like https://github.com/rcmagic/ShobuNetwork/ ?

We can talk more if it's something that you'll be interested in and we can coordinate an effort.

My email is the same username @ gmail

Thanks!

MisterTea commented 10 years ago

What was the ping when you did your test (the ping is in the box at the top-right)?

There has been a lot of demand for adding rollback netcode to mamehub. It isn't trivial but it's possible.

On Sun, Jul 27, 2014 at 10:35 PM, doctorguile notifications@github.com wrote:

Hi there,

Just discovered mamehub and it's awesome!

We are a group of fighting games enthusiasts.

ggpo.net and supercade are quite good but the emulator (final burn alpha) is very much outdated.

MAME is very nice but we did an informal test and the net code used by mamehub is quite a bit laggier than ggpo.

Do you have any plans to enhance the netcode?

Maybe something like https://github.com/rcmagic/ShobuNetwork/ ?

We can talk more if it's something that you'll be interested in and we can coordinate an effort.

My email is the same username @ gmail

Thanks!

— Reply to this email directly or view it on GitHub https://github.com/MisterTea/MAMEHub/issues/231.

antervud commented 10 years ago

i already proposed #158

rollback will be glorious

doctorguile commented 10 years ago

the ping was 100ms, which if played on ggpo or supercade it's perfectly acceptable and smooth.

from the status window it said no dropped packets.

rollback is part of ggpo but since i dont see any dropped packets i dont think the lag i experienced is related to rollback.

once connected i simply hold joystick direction up, and i can feel a significant delay from when i input to when the character jumps.

when running csume64.exe locally, there isn't such delay (and csume64.exe is better than ggpofba.exe when run locally).

So I think the lag is multifold. When we tried a much slower game like street fighter II world warrior, that wasn't very noticeable. but when we played super street fighter ii turbo, then the lag became very apparent.

sf2 is a very low overhead game, so the entire state is not that big for rollback, but i can see your point since mame supports a tons of games, some games can have a 100mb state.

however, like i said the lag that was experienced might not be related to rollback. but for optimal experience when there are dropped packets, rollback might be necessary.

thanks for your reply. hopefully we can work something out!

MisterTea commented 10 years ago

IIRC the rollback code is not just to handle packet loss, but also to do client-side prediction, so it makes a difference even in the absence of packet loss.

Right now, the inputs are lagged based on the highest average ping among all players (for just two players, it's their average ping to each other).

https://github.com/MisterTea/MAMEHub/blob/master/Sources/Emulator/src/emu/NSM_Common.c#L282

Here is the computation of the delay (it's a base delay plus 1/2 the average ping time):

https://github.com/MisterTea/MAMEHub/blob/master/Sources/Emulator/src/emu/ioport.c#L3152

The base delay is at least 40ms and computed here:

https://github.com/MisterTea/MAMEHub/blob/master/Sources/Emulator/src/emu/ioport.c#L3271

The base delay is to try to estimate the variance in the ping. I'm in the middle of upgrading MAMEHub to 0.154, but once I do that, a good first step will be to allow users to disable the base delay or set the minimum base delay to a very low value. In the meantime, can you grab a log and tell me what the base delay is when you are playing (there's a print every time the base delay changes)?

doctorguile commented 10 years ago

I haven't dug into any of the ShobuNetwork yet and ggpo/supercade are not open sourced. But what you said makes sense. Waiting for the packet to arrive before advancing to the next frame will definitely make it appears slow or laggy.

And the amount of games supported by mame and more than 2 players multiplayer could be a challenge. But as of right now any time sensitive multiplayer games are not very smooth on mamehub due to the lag.

I'll get the base delay the next chance I get when my buddy is online. How do I enable logging to get that value?

Thanks

MisterTea commented 10 years ago

Logging is enabled by default, check the logs/ directory after playing a game.

doctorguile commented 10 years ago

Here's output of grep

ssf2xj.zip_18399.txt:Changing base delay from 40 to 60 ssf2xj.zip_18399.txt:Changing base delay from 60 to 80 ssf2xj.zip_18399.txt:Changing base delay from 80 to 100 ssf2xj.zip_18399.txt:Changing base delay from 100 to 80 ssf2xj.zip_18399.txt:Changing base delay from 80 to 60 ssf2xj.zip_18399.txt:Changing base delay from 60 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 60 ssf2xj.zip_18399.txt:Changing base delay from 60 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 ssf2xj.zip_18399.txt:Changing base delay from 40 to 40 Binary file ssf2xj.zip_18500.txt matches

MisterTea commented 10 years ago

I'm going to make something more advanced for the ping estimation, but for now you can create a "basedelay" ini parameter and set it to 20 or 0 and lag will go down, but the game might get choppy.

zambr123 commented 10 years ago

Might be worth considering:

if no_players=2 GGPO method else regular method (for 3 players plus)

MisterTea commented 10 years ago

I've reduced the latency dramatically in mamehub 3.1.0, and also added a "basedelay" parameter that you can lower (defaults to 40) to reduce the latency further.

I'm going to close this, but if you try out the new version and still feel like the delay is unacceptable, reopen.

zambr123 commented 10 years ago

How about a top menu option called "Basedelay", pop dialog with a slider bar (increments of 5 on bar say).

The host sets this value, when a client joins, it checks the HOST value, and uses the same value (maybe).

MisterTea commented 10 years ago

The client already uses the host value, but I agree that there needs to be a way to change game settings from the gui.

On Monday, August 11, 2014, zambr123 notifications@github.com wrote:

How about a top menu option called "Basedelay", pop dialog with a slider bar.

The host sets this value, when a client joins, it checks the HOST value, and uses the same value (maybe).

— Reply to this email directly or view it on GitHub https://github.com/MisterTea/MAMEHub/issues/231#issuecomment-51803242.