fishfolk / jumpy

Tactical 2D shooter in fishy pixels style. Made with Rust-lang 🦀 and Bevy 🪶
https://fishfolk.org/games/jumpy/
Other
1.64k stars 118 forks source link

feat(networking): Re-implement networking from bones + re-add online matches #900

Closed MaxCWhitehead closed 7 months ago

MaxCWhitehead commented 7 months ago

This adds menu + gameplay for online matches back into Jumpy. Some work left to do, but I think this is a good checkpoint, online matches work, lan is still disabled (this is up next).

TODO:

zicklag commented 7 months ago

@MaxCWhitehead this is such a huge help, thank you! I pushed a few commits to fix ultra minor things, and there are still a couple bugs I found:

Also, in the player selection screen on online play you have to press the jump button once before you can select your player which is a little unintuitive.

MaxCWhitehead commented 7 months ago

@zicklag Yeah I couldn't remember how the pressing input to select player thing worked - I thought maybe this behavior was intended to select the control source (press space or a on controller), but can revisit that.

Good catch on the input bugs, shouldn't be too hard to track down. Will look into that.

MaxCWhitehead commented 7 months ago

I had the changes prepped so thought I'd toss them in here for lan: Depends on this PR (https://github.com/fishfolk/bones/pull/308) probably will fail CI until that is merged + bones version updated here.

I haven't gotten lan service discovery to work locally (though I am unsure if I should expect it to work with two clients on same host) - will try to test this with a second machine later.

Anywho will go fix the other bugs.

zicklag commented 7 months ago

I thought maybe this behavior was intended to select the control source (press space or a on controller), but can revisit that.

Oh, that's a good point. :thinking: When I first got into it I couldn't figure out why I couldn't select my character, but maybe the workflow does make sense and we just need a way to indicate that you have to press a button to select your controller.

Maybe just leave it as is, and we can see about improving the UX afterwards.

I had the changes prepped so thought I'd toss them in here for lan: Depends on this PR (https://github.com/fishfolk/bones/pull/308) probably will fail CI until that is merged + bones version updated here.

Cool, I queued the merge of that bones PR.

I haven't gotten lan service discovery to work locally (though I am unsure if I should expect it to work with two clients on same host) - will try to test this with a second machine later.

It should work with two games on the same host, though I think it didn't work for somebody on some version of Linux, because it wasn't enabled or something. I'm not 100% sure how out-of-the-box configured mDNS is on different platforms, but I think it should be pretty standard.

MaxCWhitehead commented 7 months ago

Fixed the input jittering bug in local (forgot to call one of the trait functions for saving prev frame input).

We were replicating just_pressed for jump in networking - I think we were doing this pre-refactor but might be wrong, either way changing this to jump_pressed fixed it.

For player select, you now only have to press confirm once, and I updated the text to show all possible bindings for confirm. The bindings shown for confirm should now be dynamic as well in local match (when someone takes a control source it is removed from other slots).

zicklag commented 7 months ago

Tested this out real quick and I think it's merge ready! This is huge to get back in!

I was able to start LAN and online games successfully.