Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

EmuLua Netplay Core (Test 1)

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
657 views
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Nov 1, 2010

Not finished at all, but here's a test video for you to oogle at.

This is basically a netplay engine written in Lua for use by emulua-supporting emulators. Plans include having a "repeater" (input on one is sent to another, for lagless "watch me play this crap" sessions), actual netplay, and possibly savestate support, depending on how those are handled by the emulator. (If I can get a raw bytestream, it's possible.)

The nice thing is that this is pretty portable, as shown from the prototype FCEUX-to-VBA video earlier. The idea is to hide all of the real code in the "core", leaving some basic implementations to the actual frontend.


The mechanics behind this video are simple; I wrote a simple server that simply listens to 7845, and simply repeats any data it gets. The protocol this uses just waits for a response packet (FF000000) and starts barfing frame input at each other.

The frame delay here was 6 frames (100ms) ... The reason it's kind of stuck here is a nasty bug in FCEUX's joypad.get(), where I can't read the player's input if I force it to something else. Since you have to delay the local player's keystrokes, too (so that the remote player can get them at the same time), I had to disable local delays to get this to play, which is why they players aren't synced up.

And yes, it really says "Let's do this" all of the time. That was some debug output I forgot to remove. Again.

Category:

Gaming

Tags:

License:

Standard YouTube License

  • likes, 0 dislikes

Link to this comment:

Share to:

Uploader Comments (Xkeeper0)

  • Is it me or does this not seem like netplay at all? Just looks like hes controlling player 1 and 2.

  • @Snoop221 That's because that's what it is. The "second player" in this test is just repeating the first player's input. The only real thing that would have to be changed would be having another human as the other player instead of a client that simply repeats the input.

  • On question though. why not just use Kailera or something for multiplayer, rather than code an entire multiplayer function in Lua?

  • @Snip3rNife a) I hate Kailera; b) that would probably require re-implementation in every emulator. Lua is already in several emulators and (as a bonus) has the nice feature of being mostly separate from emulation, so I can do what I want with it. Want to make it so that, instead of 2P simul, you get coins in Mario if a friend playing Zelda gets a rupee? You can do that. Theoretically.

    This will also have functions seperate to what Kalwahtever does, like a "broadcast only" function for 1P.

  • That's pretty amazing. I remember one of the FCEUX devs saying he'd add anything needed if someone were to implement netplay purely in lua. Maybe you can get your raw bytestreams that way (if it isn't already supported).

  • @miaumiaumiau Yeah, I'll have to check at some point. I'd imagine they should be pretty portable. Worst case I can just do some stupid file bullshit and get it that way, haha.

    I actually ended up writing string.toraw() and string.fromraw() that takes an integer and returns a 4-byte big-endian number (and vice-versa), simply to speed up the process a bit. Could probably do something similar with the savestate file, I'd imagine.

see all

All Comments (14)

Sign In or Sign Up now to post a comment!
  • please give link to this lua script i need it to netplaying with my friend

  • 0:46 You even managed to get them to die at the same time! Brilliant!

  • I subscribe only because I saw what you done with lua on a Mario game but with your last Zelda video and now this I really getting into what you are doing at the current moment. I normally don't randomly subscribe even to videos that I like (I normally just fav) but in this case I glad that I did.

  • @Xkeeper0 I see...

  • @Snip3rNife because you could add any sort of functionality you wanted to a lua netplay core as opposed to a closed source netplay library.

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more