Show HN: PSX Party – Online Multiplayer Playstation 1 Emulator Using WebRTC
psxparty.kosmi.io
psxparty.kosmi.io
Use off-shelf-chatrooms-software to create rooms but instead of chatting you send ROM game commands to each other and allow for multiplayer gaming!
This phrase doesn't mean anything.
The game list includes games that do not support PlayStation Link Cable, so this has to implement netplay the same way other emulators do:
Both host and client emulate the game in sync, exchanging controller input
Edit: Seems like I was wrong about the latter, it runs the emulator on the host only, who sends video/audio from clients (and they send inputs).
If I'm not mistaken, RetroArch's networking functions in that way.
You keep the last dozen game states around in memory, and if you receive an input from the past, you rewind to the last game state prior, add it to your input stream, and fast forward to the present.
It has the same base advantages and drawbacks as RTS networking - the core logic is written as though the game is single player, and complexity can be scaled arbitrarily without bloating bandwidth requirements.
But in addition, you get the benefit of zero input latency (play a multiplayer RTS game and send a unit around - they won't move for 200ms or so), and the drawback of an absolute clusterfuck time rewind debugging madness if any inadvertent mutation of your immutable data happens.
The reason you do rollback with something like this is it gives you zero latency, and you can retrofit it on to an emulator without changing any game code just by using memcpy() on the game state.
Source: I've developed about a dozen titles using rollback networking.
However, in those situations what does the player see in game? IIRC rollback was popularised in fighting games like Street Fighter - so does the player see one "universe" only for that branch to suddenly rewind and replay to an alternate universe where a tiny action happened/does not happen?
You can also delay significant events such as death until the rollback threshold has been passed, so you don't run in to knife edge situations where, e.g., it looks like you died and your character starts to ragdoll but then you snap back when it turns out you killed the enemy instead.
The key to it not being too disruptive is keeping the maximum rollback threshold fairly low. If you add inputs and your ping is greater than the threshold, they get delayed to a later frame, and your inputs start to feel sluggish (the server would enforce the delay, but you'd also add it client side).
Out of interest are there any toy projects out there you can point to that can explore the concepts here with no first hand experience with game dev?
My recommendation would probably be to build it without netcode to start (two local clients connected over a virtual pipe), and using a system where you can easily serialize the game state - C with memcpy(), JavaScript reading/writing to json, Clojure or similar. I use C# with compile time generated codes to store data in slots - it's not fun.
While not rollback, the original AOE networking writeup is probably the best I've come across as an introduction to deterministic multiplayer. There's the GGPO framework that you can get off the shelf, but it's pretty heavy weight.
There are some real head scratching moments with debugging rollback, but in general for games that aren't too performance intensive it shines. I actually developed an entire strategy game prototype over a period of three weeks in single player before bothering to test it worked in multiplayer. It did first try. Four days later, it was live in public beta (starjack.io if you're interested, which peaked at around 400 concurrent players).
https://www.gamasutra.com/view/feature/131503/1500_archers_o... https://en.wikipedia.org/wiki/GGPO
Also well played on starjack, very impressive
That said, it was better than NAT punch-through and/or UPNP which are not very reliable these days.
If that fails, then there's TURN which acts like a proxy between the peers.
WebRTC has data channels, which are currently the only way to achieve unreliable and unordered real-time communication (UDP-style) between the browser and other browsers or a server. This is pretty essential for any networked application where latency is critical, like voice and video and fast-paced multiplayer games.
As other commenters have noted, it's a royal pain in the ass to set up WebRTC if all you want is UDP-style communication between a server and browser, since you need to wrangle half a dozen other protocols in the process.
However! A new API, WebTransport[1], is actively being developed that will offer a WebSockets-like (read: super simple to set up) API for UDP-style communication. I am extremely excited about it and its potential for real-time browser-based multiplayer games (which I'm working on).
WebTransport isn’t going to be here soon though, I would be cautious in investing. Stuff like Congestion Control is still a big unknown [0] and we don’t have Datagrams everywhere.
I just starred it, it does seem like it'd alleviate a some of the pain. Another similar (more end to end) project I had come across is: geckos.io. This previous HN thread[1] discusses some of the (at least perceived) difficulty with using WebRTC as a "WebSockets but UDP" solution.
I'm not sure I follow the concern about congestion control. UDP doesn't have it either, presumably since if you're building an application that requires such latency sensitivity, you don't mind rolling your own congestion control algorithm that makes most sense given your application's specific needs, right? Pretty much all FPS games do this, as far as I understand.
[0] https://github.com/geckosio/geckos.io [1] https://news.ycombinator.com/item?id=23666679
300 IQ!
No one really talks about it but the first iPod had the same approach to letting people play their thousands of mp3 files (which I imagine 99% of were obtained illegally). Apple was eventually able to create a legal marketplace for mp3s but early days it was all napster/limewire/kazaa/etc
Obviously Playstation/Nintendo roms are not as prevalent but its an interesting thought?
Apple had a marketing campaign to encourage that.
The funny thing is, this is one of the current top recommended ways for DJs to acquire music in 2020, and the most affordable.
1. Buy DVD on ebay
2. Rip DVD with handbrake
3. Add rip to Plex library
4. Archive DVD in disc folder
Works great for "classics" that can't get much better than DVD quality anyway (i.e. any movie made before, say, 2005)
If a movie isn't issued in better than dvd quality is because nobody has cared about remastering them to better formats.
I guess there maybe super budget, made for tv films that were filmed on tape and those certainly have reached their digital quality maximum.
Another interesting aspect of Firefly is that the pure VFX scenes (eg spaceship exteriors) were rendered originally at 480p, so when you watch the Blu-ray version of the show, you can see a bit of an awkward transition where the shots of the actors are gloriously crisp, but the space scenes are clearly upscaled.
Additionally, like Firefly's pure VFX, some footage in Friends also appears in SD in the HD release (seemingly either because the original film stock was lost, or it wasn't originally shot on film), with the zoomed 4:3 SD vs 16:9 HD sometimes changing mid-scene, and …that too I find a humbling reminder of the quality of yesteryear.
So I would ask if maybe the image was cropped for the 16:9 conversion.
Update—here's what Wikipedia says: “Unlike the version used for the DVD, Sony Pictures cropped the top and bottom parts of the frame, while restoring previously cropped images on the sides, from the 35mm film source, to use the entire 16:9 frame.”
But different shows handled the aspect ratios differently in their widescreen re-releases. Seinfeld included slightly more horizontally than the original TV release but still cropped a significant amount from the top and bottom. That 70s Show as one example that was also shot on 35mm film included the whole original 4:3 frame plus extra on the sides.
Ah, indeed, I seem to be forgetting the days of film photography.
Personally I find most of the 16:9 crops of old shows in syndication quite jarring, especially because in any shot where the formerly extra width doesn't work the editor is forced to vertically crop the original. Here are some screenshots comparing 4:3 and 16:9 Seinfeld and ...eek
https://lambdan.se/blog/2018/11/13/seinfeld-original-vs-wide...
Consult this video, for example: https://youtu.be/sCv-dIFGcd0
Personally I find that even BD-rips made in SD resolution look better than DVD—if only for contrast enhancements made for reissues, and due to better compression formats.
Moreover, if the source was shot on 70mm film then people might still keep re-digitizing it in the 22nd century into fresh HD formats of the day.
I want to say it's that the footage seems darker, and you can obviously make a case for classic brand logos being a giveaway.
In the comments on YouTube, people discuss some other race-related aspects that reveal the age of the video. Such as lack of protective barriers, and people standing right next to the race track.
Makes me wonder what kind of risks we are obliviously taking today that will seem kind of crazy in the future.
Would you describe rock climbers as "oblivious to the risks involved", or just as people who are sometimes killed by their hobby?
For another recent historical example see: smoking.
Personally I'm waiting for when sitting at the desk all day long is found out to be Very Bad. But that's probably just a modern ‘proletariat vs capitalist’ issue—I guess factory assembly lines weren't and aren't too popular either.
I think shadows are more prevalent and even color is not as vivid as many videos we see today either. The image is sharp though!
They entered actual Formula 1 cars into a grand prix, strapped it with cameras, and recorded the whole thing. Other times they added new bodywork to a Formula 2 car and had the actors driving around on track - again with cameras strapped to the car. Being recorded in 70mm it's some of the best footage of on-board Formula 1 racing until well into the 2010s, and the advent of small 4k on-board cameras in modern races.
There's going to be a dead spot of TV/Movies where things were shot in SD on Video where they will be forever SD but older things, shot on film, can be brought to HD and newer things are either shot on Film or HD video.
I'm curious to see how quickly the things shot in HD Video become outdated by superior resolutions of 4k, 8k and whatever comes after and if there's a plateau of consumer/home resolution.
Apparently for later trek shows (ds9, voy) the film crews were more careful to respect the 16:9 frame, but those shows aren’t as popular and may never get the expensive blu ray makeover.
What would any of these shots look like in 16:9 [0][1][2]? They really liked filling the frame to the brim with TNG, and any side-areas would just look empty.
[0] https://static.wikia.nocookie.net/memoryalpha/images/3/37/We... [1] https://static.wikia.nocookie.net/memoryalpha/images/3/36/Sa... [2] https://static.wikia.nocookie.net/memoryalpha/images/9/90/Tr...
But never in a million years will upcoding recreate the picture that was there in the original. It can create some new detail of its own, yes.
EDIT: It seems the thing you need is a "Public performance license"
I don't know how it works or how to do it, but I know that it is possible to rip music from the Deezer music streaming service in lossless quality.
It's crazy that this hasn't been patched yet because it has been a thing now for a couple of years.
https://www.digitalmusicnews.com/2020/10/26/deezer-pirate-ap...
The thing is, it probably comes down to an architecrural flaw on Deezers part that they think would cost more to fix than the actual losses due to piracy.
But I just wonder if Deezer could run into legal trouble because of this... I can't imagine that the artists/labels would want their music available like that but maybe Deezer is "too big to be held accountable" as well?
I remember a time when we digitised our DVD collection just swapping them one by one into handbrake.
Never would have dreamed that was illegal...
The album is fairly recent but still old enough to not be in stock anywhere.
But, I did manage to find a used CD on Discogs' marketplace.
It doesn't, though.
It sources roms from the Internet Archive: https://i.imgur.com/4bX7Oow.png
Legally dubious.
But as far as UX, it was incredibly easy get us both into a 2 player game, complete with chat, voice, and video feeds. Their buttons are mapped to keyboard inputs, so Windows users can get a gamepad working with a program like JoyToKey[1].
For that reason it’s pretty amazing the (lack of) input delay you see with Stadia, which I believe is also built on WebRTC — although with one peer (Google) always hosting the video and the other (the user) providing input I’m wondering if there’s some clever way to improve upon this...
I would prefer to see some newer information about this, but the Google search pages are flooded with that from before launch.
https://cloudflare-ipfs.com/ipfs/Qmdpah7j4mLswRLsv55qX4R9RzK...
When I had a big LSD trip, not only did I understand the fact that we don't have free will, I experienced it. It felt as real as my body.
I don't think about free will anymore, I feel like I've already watched the movie.
I think I’ll go with random quantum please.
Free will is just a level of analysis that assumes the outcome is intractable, and doesn't bother trying to compute it.
Which browser and version did you use?
I used to work at a video rental store so I had access to two TVs, two PS1s, this cable, and the space to set it up. It's a lot of setup when you could just play the game normally on one screen. Still neat.
That aside, Bushido Blade to me is still the best fighting game. If they revamped the location damage detection, and redid the graphics, I would rebuy it in a heartbeat. Most people favour the sequel, but to me it lost a lot of the charm and simplicity the first one had.
One hit kills really spice up fighting games for me. Positioning and timing are even more crucial then in other games.
The "juggling" and ten button combos really take the fun out of the genre for me. (nothing against the other games, just not my cup of tea)
I haven't found another like it. HMU with recommendations if I missed a game!
- Another PSX
- Another copy of Bushido Blade
- A spare TV that they could bring over
- A room big enough to have two TVs and consoles setup within a few feet of each other so that the cable could reach.
After taking the time to set all that up, simply playing the game in POV mode felt like a disappointment.
But I agree, Bushido Blade 1 was the superior entry. BB2 fell into the common trap of "fix up the kinks and 'polish' the sequel, but lose what made the original feel special along the way". The other thing that most people don't know is that while each character can technically wield any of the weapons, everyone has a preferred weapon, and wielding it unlocks unique moves for that character. This wasn't mentioned in the manual, nor in any of the online FAQs back in the day, so unless you had shelled out for the Strategy Guide, that whole dimension of combat was unknown to most people.
The original developer behind Bushido Blade went on to make the "Kengo: Master of Bushido" series, which was something of a spiritual successor, but IMO all of them were garbage. The closest thing it ever got in my mind was the original Way of the Samurai for the PS2 (another game which got a bunch of sequels, all significantly worse than the original).
Which was good, because there was a critical bug in the split-screen mode (one player had no radar).
And yes, I miss Bushido Blade. Even back in the 90s I was annoyed how much emphasis fighting games put on combos and complicated inputs.
Is that still the case, or are there free/libre reimplementations of these consoles' BIOS images out there now?
Seems like they offload the responsibility of ROMs to the user (good) but no mention of the BIOS part.
If you visit chrome://flags you can enable "Restrict gamepad access" which will disable the default controller's mapping.
Incidentally, I recently wrote a small crossplatform gamepad mapper you can use: https://github.com/framp/joystick-mapper/releases/tag/0.3.0
Configuration for psxparty here: https://github.com/framp/joystick-mapper/blob/master/example...
Click the wrench next to controller 1/2, click in each of the input boxes and press the button on the controller to map it. I had no issues setting up my XB1 controller.
There were a few games where the PSX version was ideal, such as Rival Schools, Battle Arena Toshinden and the mentioned Soul Edge, but that was because the ZiNc/System11 arcade hardware that they ran on was literally derived from the Playstation hardware.
edit: the first approach would also give the host an unfair advantage because they'll have no delay at all.
Games for these older consoles — any generation while games were either still unikernels, or still ran on RTOSes — are already 100% deterministic in terms of what the game will do on a given frame, given a fixed history of per-frame inputs. (That might be surprising, but devs would strive to keep this property, as it makes reproducing bugs far easier.) So you don’t have to do much, other than execute the game faithfully and ship button-presses back and forth, to ensure synchronization.
Of course, shipping these button-presses around to achieve state-consensus synchronously would be slow — but there’s no need to do it synchronously. All modern emulators are built not in terms of a single mutable virtual-machine state, but rather in terms of a functional-persistent chain of VM states (think a HAMT.) This is what enables “rewind” support in emulators — and more recently, “run-ahead” latency reduction (basically a type of speculative execution of VM states.)
Thus, with any emulator constructed this way, it’s actually very easy to ship+receive+resolve network inputs asynchronously: i.e. to receive inputs “about” frame N while rendering frame N+M, and then to go back and re-compute the correct VM state for frames N..N+M, such that frame N+M+1 will inherit from the recomputed frame N+M. (Remember, you don’t need to run any of the IO-emulation logic for the recomputed frames, so they’re actually quite cheap to recompute!)
It’s actually oddly similar to what blockchain nodes do to “reorg” when they discover a fork — just done in real-time, between 16.7ms frames.
Edit: probably the order of commands is kept in order via the chat room server no? But then what is it using WebRTC for? Perhaps the “host” is e source of truth for the order... meaning that all the commands speed and delay depend on the host network bandwidth.
Keep in mind, every node is running the same deterministic simulation. As long as nodes achieve eventual consistency in their "input movie" somehow (a gossip protocol, say), then every node will end up on the same VM state. You don't need a leader to declare what the consensus state is; presuming trustworthy peers(!), there is a single "objectively-correct" consensus state that every node will converge upon once all nodes have all messages.
Every time an input-event message is received from the network, the receiving node just rewinds to frame N, and recomputes it (and all frames after it) with an input-movie where player P {is/isn't} holding button B. (And then, only if that explicit message wasn't already what was predicted during run-ahead.)
Note that this is also exactly what happens when the local node produces an input-event message — that's what run-ahead is!
> the receiving node just rewinds to frame N, and recomputes it (and all frames after it)
What about situation where frame N is a “long” time ago (for some definition of “long”)? There must be some sort of threshold after which the game state cannot be changed even if an input was received.
How do players tell if their event managed to become part of the consensus state? Depends on the networking protocol. In a gossip protocol, messages get sent to peers individually, and ACKed by those peers. In an elected-leader client-server protocol, as long as the server peer ACKs the message as "in the queue", it's canonical. In an IRC-like spanning-tree message-relay system†... something complicated involving vector clocks containing message IDs.
† I don't think I've ever seen an emulator choose a hierarchical message-relay architecture. It makes good robustness+efficiency trade-offs, but it's just far too complex to work with compared to the alternatives. It's more the domain of MMOs, that need to be concerned with many nodes colocated in one site speaking to many nodes colocated at other sites.
The frames that are replayed aren't visibly replayed. They're re-computed, but the visible effect is more of a "lurch" from one world-state to another one. In this case, the monster has been dead for a second or two already, but suddenly each player's score counter would jump around to show that it's actually player P who did it, and gained the points for it. Except for player P themselves, who experiences no change.
It's very similar in experiential effect to the effect when an inherently-networked client-server game does client-side prediction, and then the server sends the canonical state which disagrees from the client's predicted state, and the client has to lurch into the server's canonical state. People's avatars pop into different positions; in an FPS, you might suddenly be dead "out of nowhere"; in a racing game, you might suddenly be spiralling out of the way because your path turned out to collide with that of another car that wasn't originally there; etc.
Inherently-networked games sometimes have interpolation ("lerp"-ing) code to smooth out this lurch between client-side predicted positions and canonical server-side state — usually, if the only thing that's incorrect is positioning, the client will try to generate a few interpolated frames of movement that takes objects from their incorrectly-predicted positions to their server-prescribed positions; and then it'll play those frames in fast-forward, so that they've all been played out well before the server sends its next update.
But this only works when the server isn't communicating every single frame (otherwise there's no time to replay the lerp); and it basically only works for positioning changes — if someone does manage to cause a discrete alteration to the game-state (like changing who killed an enemy), that will still usually cause a sudden "lurch" into the new game-state in these engines. The interpolation-frame generator code just gives up.
(Though, for especially-important things like who won a match, inherently-networked games just do a hard consensus-sync of all players — usually during a screen transition — before actually showing a results screen. People get quite cross when their results lurch!)
And, of course, games that weren't inherently-networked, but which are instead being networked "on the emulation layer", have no logic for lerping, and cannot, unless lerping logic is hand-written by some kind soul for each emulated game's engine. Possible if you're hand-crafting an emulator designed to play a single game; quite unlikely if you're just building a general system emulator — especially if, as with most authors of general-system emulators, your goal is faithful reproduction of the behavior of the original system.
> Would you suggest some reading on this?
No idea if there is any reading on how emulators do this, tbh. (I'm self-taught on this subject, from working with open-source emulator codebases.) But any modern textbook on [inherently-]networked client-server game-engine development should talk about client-side run-ahead prediction and interpolation-frame generation.
I believe there's some book which deep-dives into the network architecture of Doom, or Quake, or Unreal Tournament, or one of those early networked games, and uses it to explain the history/invention of these client-side prediction features. I can't seem to Google it for the life of me, though. Can anyone here assist?
The idea is that the host guesses what the other player's inputs are on a certain frame, and when the actual input then arrives the host emulator will roll back its state to that frame and then re-emulate the frames after it, if it guessed wrong. If it guessed right the game continues as usual.
It's a good fit for emulation since "rolling back" in an emulator is usually easier than rolling back the state in a game that wasn't built with this type of netcode in mind, but it has also become a popular type of netcode for modern fighting games.
If you're interested in reading more about it:
https://en.wikipedia.org/wiki/GGPO
(Windows 10, Chrome, i7-7700, GTX 1050.)
What emulator did you use for this? (I would suggest using DuckStation, it's a million times faster than any other and more compatible than most of them, only Mednafen may work better in a few games.)
For anyone else interested, it definitely looks like it's using MAME, which is unfortunate, since it's one of the slowest and less accurate PSX emulators out there.
In any case, I'm sure the author will soon release the source code of all the GPL parts, if any ;)
Hopefully the author open sources this so that the community can contribute things like a more polished UI and save state management system. Seems like the kind of project that makes sense to be open-sourced.
Yes and it works well
For example, Jitsi delegates authentication of users to Prosody. Prosody already has a bunch of authentication backends ( https://modules.prosody.im/type_auth ) and Jitsi benefits from these without needing to reinvent the wheel.
I've seen the Jitsi+Prosody combo integrated into many kinds of platforms. People also implement things like custom access control, logging, notifications and provisioning at this layer. These things would generally be harder to customize in a monolithic off-the-shelf system.
Meanwhile a simple self-hosted setup is still easy enough to pull off in a spare afternoon ( https://jitsi.github.io/handbook/docs/devops-guide/devops-gu... ).
(I'm currently looking in to using Mediasoup for some WebRTC to RTMP ideas I've been mulling.)
But we are indeed integrating Jitsi into a game experience here and its open-source stack is really nice to deal with (after many days needed to really understand it).
Fwiw, WebRTC doesn't imply p2p/serverless.
Also, aside from the obvious AV chat systems (eg: Jitsi. Zoom, etc.) 'cloud-gaming' platforms such as Google Stadia and Shadow use it.
I've been monitoring and experimenting with webRTC for a few years now and one of the most exciting recent developments has been more or less full support in desktop and mobile browsers (even Safari, which dragged its heels for years)
WebRTC is fundamentally peer-to-peer. But scaling up to larger calls, and doing things like recording, generally requires routing the audio/video through media servers that selectively forward, process, or transcode the media streams.
<shameless-plug> I cofounded a company that makes it easy to get started with and scale WebRTC-based applications and features. [0] </shameless-plug> In addition to basic video calls, we're seeing rapid growth of online classes, games, fitness applications, live collaboration in productivity apps, e-commerce and customer support, and IoT and robotics streaming video.
Zoom doesn't use webrtc (unless you count the browser fallback version which nobody uses), they use their own video codec - which notably uses a lot of cpu but requires little bandwidth. From my experience, zoom is the only solution where I don't experience bandwidth problems all the times.
At least in my experience, WebRTC even when using UDP was a lot slower than custom protocols, mostly because it responds badly to packet loss.
If I use plain UDP in c++, I can layer on forward error correction like Solomon Reed and just ignore lost packets up to a percentage. That, alongside with low level control of the transmission timings seems to be the difference between 60ms peak latency with WebRTC and 5-8ms in C++. Or noticeable input lag @60fps vs. exactly one frame.
Dolphin has had a similar (non-browser) feature called Netplay for many years, and it works incredibly well.
I love whoever made this!