biplanes-revival icon indicating copy to clipboard operation
biplanes-revival copied to clipboard

Local multiplayer

Open lufte opened this issue 1 year ago • 2 comments

First of all thank you for reviving this beautiful little part of my youth. Impressive work, it looks and feels exactly like the old one.

I was wondering if it would be possible to implement a multiplayer mode where two players, in the same computer, just share the keyboard and battle against each other. I have a few friends who played this but I don't see them going through the hassle of setting up a network match. If I just showed up with my laptop we could all play against each other on it.

lufte avatar Sep 20 '24 21:09 lufte

Thank you kindly for your warm words, it's always a pleasure to see this project means something not only to me & my friends, but to players all over the world :)

Regarding your question, I actually considered local multiplayer when I was implementing AI, but ultimately scrapped the idea for a number of reasons:

  • While hotseat/local multiplayer was prevalent in PC gaming ~20 years ago, nowadays it's hard to imagine a demand for this feature. Nevertheless, you've just proved me wrong ;)
  • From technical standpoint, there's a notion of Key rollover, which basically means the ability of a keyboard to detect multiple simultaneous keypresses. The problem is, the majority of keyboards (especially non-mechanical and laptop ones) aren't suited for arcade/racing games, e.g. my own laptop keyboard doesn't detect Space when I'm holding down both Up and Left arrows, making it impossible to shoot while maneuvering. Add a second player and you're almost guaranteed to encounter key ghosting & jamming, unless you plug in a second keyboard. You can experiment for yourself: key-test.com. Most players don't know about this hardware limitation and will likely blame the game for "not working" :(

Still, I abstracted the code well enough to support local mp without much hassle, so the difficulty comes with actually testing it for bugs, as I'm quite meticulous about QA. Unfortunately, right now I'm rather busy until November, so I can't promise the update any earlier.

As a temporary alternative, if you're going to play with your friends in the same physical location, I think Direct Connect multiplayer would be your best shot as long as all computers/laptops are connected to the same network/Wi-Fi. If you know how to find an IP address of a host, you won't have any problems setting up a match between your friends. On second thought, Windows Defender & Firewall as well as other security stuff might present some interference...

Casqade avatar Sep 21 '24 12:09 Casqade

  • While hotseat/local multiplayer was prevalent in PC gaming ~20 years ago, nowadays it's hard to imagine a demand for this feature. Nevertheless, you've just proved me wrong ;)

Also keep in mind that the people coming to play this game are not going to be particularly young. Many of us are still attached to the old costumes ;)

  • From technical standpoint, there's a notion of Key rollover, which basically means the ability of a keyboard to detect multiple simultaneous keypresses. The problem is, the majority of keyboards (especially non-mechanical and laptop ones) aren't suited for arcade/racing games, e.g. my own laptop keyboard doesn't detect Space when I'm holding down both Up and Left arrows, making it impossible to shoot while maneuvering. Add a second player and you're almost guaranteed to encounter key ghosting & jamming, unless you plug in a second keyboard. You can experiment for yourself: key-test.com. Most players don't know about this hardware limitation and will likely blame the game for "not working" :(

This I totally understand, and it would be a shame for people to think it's a problem with the game. It could be hidden behind a build flag, and only people that know what they're doing could access it, but this sounds even less fair: preventing players from accessing features because of potential whiners.

I could totally set up a mini LAN party to play this, but I just don't see it happening. BT Biplanes was always a very casual game to me and my "gang". I remember playing it between Call of Duty matches when we went to our local "Internet Café" and we headed outside for a bit of fresh air, or when we got together to play cards during those long summer nights... oh, those were the times!

But I digress :). Thanks for the quick reply and bringing this game back. If you end up implementing this eventually and need help with QA ping me and I'll be glad to help.

lufte avatar Sep 21 '24 21:09 lufte

@lufte, any thoughts on key bindings for hotseat mode? I've already implemented the logic, however I'm unsure about proper control layout.

The default bindings are Arrows+Ctrl+Space, and I don't really want to change that. The only intuitive(?) way to keep this scheme is to set the "Arrows player" to play for the Red(right) biplane, while the second player would play for the Blue(left) one with WASD+something.

Remember, even with two keyboards we can't use the same keys for input, as SDL2 doesn't provide keyboard ID for the pressed key. They only did it for SDL3, which is still under development and I can't use it because I also build this game for platforms which only provide very old versions of SDL2.

Casqade avatar Nov 25 '24 19:11 Casqade

With player 1 using Left Ctrl I don't think there's a default layout where players don't bother each other, but since bindings are configurable I don't think it matters that much. What about WASD+1+2?

lufte avatar Nov 25 '24 20:11 lufte

1+2 would be really finger-twisting to use with WASD. The default scheme dedicates left hand for actions and right hand for directional controls. WASD for P2 will reverse that, so in this case action bindings should probably be on the right side, e.g. J+K or something like that.

However, if we want to be consistent with default scheme, the directions should likewise be for the right hand, and that would imply a very unorthodox IJKL with let's say Z+C or Q+E for actions. What do you think?

P.S. You mentioned earlier you could help with QA. Do you, by any chance, have access to a device with macOS? I've never been able to verify the game actually works on this platform, however my CI for macOS builds fine

Casqade avatar Nov 25 '24 22:11 Casqade

WASD+1+2, while finger twisting as you mention, would keep the hands scheme the same (at least I imagined using 1+2 with my left hand). I also like IJKL, but I would much prefer Q+E to Z+C as they're higher in the keyboard and less likely to bother player 1 while he tries to use Left Ctrl.

I do have a (Intel) Mac. Let me know when the build is ready and I can try it.

lufte avatar Nov 25 '24 22:11 lufte

Oh, I see. You're probably thinking about two players on the same keyboard, right? I was imagining a second player on an additional keyboard. A small laptop's keyboard (even if it properly handles many simultaneous keypresses) will be pretty congested with 4 hands (playing the game would feel like drinking Brüderschaft), unless P1's action keys are shifted closer to the right side. All in all, I'd agree that IJKL+Q+E is more or less appropriate layout.

Let me know when the build is ready and I can try it.

It would be more than enough if you try the latest release on Mac. If you can set up a crossplay match between Mac & Windows/Linux versions and finish a round, I would consider it a success, as there aren't any differences between these versions (I wouldn't be able to fix macOS-specific bugs without a Mac anyway). And from your wording I take it you need binaries? Unfortunately, my CI workflows don't upload artifacts for Linux & macOS versions, because they're configured for shared libraries build. And properly bundling all the dependencies into an artifact is waaay too troublesome :)

Casqade avatar Nov 25 '24 23:11 Casqade

Oh, I see. You're probably thinking about two players on the same keyboard, right? I was imagining a second player on an additional keyboard. A small laptop's keyboard (even if it properly handles many simultaneous keypresses) will be pretty congested with 4 hands (playing the game would feel like drinking Brüderschaft), unless P1's action keys are shifted closer to the right side. All in all, I'd agree that IJKL+Q+E is more or less appropriate layout.

Right, I was thinking of one keyboard. Even if it's not the ideal use case (probably not even possible because of key rollover) I think IJKL+Q+E is still a good compromise for it.

It would be more than enough if you try the latest release on Mac. If you can set up a crossplay match between Mac & Windows/Linux versions and finish a round, I would consider it a success, as there aren't any differences between these versions (I wouldn't be able to fix macOS-specific bugs without a Mac anyway). And from your wording I take it you need binaries? Unfortunately, my CI workflows don't upload artifacts for Linux & macOS versions, because they're configured for shared libraries build. And properly bundling all the dependencies into an artifact is waaay too troublesome :)

Done! I completed a match between Linux and macOS 12 without issues. The only non-documented step I had to take was brew install jpeg-xl.

lufte avatar Nov 26 '24 15:11 lufte

'tis done. I'm not making a release yet, as there's one important feature left I want to implement. There's no guarantee the feature will actually come, since there's some creativity involved, but in any case I'll issue a release before Christmas. Until then, you can try hotseat mode on hotseat-mp branch

I completed a match between Linux and macOS 12 without issues.

Wow, thank you so much for the help! That's another weight off my mind.

The only non-documented step I had to take was brew install jpeg-xl.

That's strange... Official SDL_image formula lists jpeg-xl as a dependency, leading me to believe its installation would be handled by package manager automatically. So it's not the case then?

Casqade avatar Nov 27 '24 22:11 Casqade

Thank you! I'll try it real soon and try to find me an opponent who's up to my level ;)

That's strange... Official SDL_image formula lists jpeg-xl as a dependency, leading me to believe its installation would be handled by package manager automatically. So it's not the case then?

I definitely had to do it but if I try to uninstall it now it won't let me because, as you say, sdl_image depends on it, along with 4 other packages which do as well, so I don't know how this happened. I say we pretend it didn't happen...

lufte avatar Nov 27 '24 22:11 lufte

I tried it already :D, superb job. I would like to support your work, are you on any platform where I can buy you a coffee?

lufte avatar Nov 27 '24 22:11 lufte

I say we pretend it didn't happen...

I'll update the docs then, just in case

superb job

Not quite! I already found & fixed a minor bug with clouds translucency :) That's why adding new gamemodes is such a pain in this mess of a code...

try to find me an opponent who's up to my level

That's actually THE reason why I started this project! Don't want to digress too much about it, but here is the full story of the game. By the way, I still haven't met anyone who could beat me in Biplanes, so perhaps when I roll out a realease we can try organizing a little Matchmaking tournament.

are you on any platform where I can buy you a coffee?

Thanks for the offering, but unfortunately I live in a sanctioned country. That means cross-border money transactions are very limited, and for individuals it's too much of a hassle or risk to send/receive money abroad. We still have the Internet, though. Partly :) Our matchmaking server depends on it

Casqade avatar Nov 28 '24 00:11 Casqade