Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Matchmaker Rework #431

Merged

Conversation

RockasMockas
Copy link
Contributor

@RockasMockas RockasMockas commented Aug 5, 2024

This PR covers a large rework of the matchmaker and its entire flow to bones & the dev interface. In short the major changes include:

Matchmaker:

  • Supports multiple games running a single matchmaker, thanks to GameID now integrated
  • Internal state revamped to support now both Matchmaking & newly added Lobbies
  • Bones <-> Matchmaker messaging flow rework to support more than just 1 "endpoint", and importantly enable long-lived connections which is a requirement for lobbies
  • Updated the interface for devs to interact with the matchmaker to provide a standardized/clean interface that we can scale with new features

Matchmaking Changes:

  • Robustness was the main focus, so now implements a simple wait/retry protocol when the matchmaking room is full, thus avoiding previous issues with failure during lots of players starting matchmaking at once.
  • Implements dead connection cleaning, guaranteeing that when a match starts all player clients have active connections (are alive) and starting the match can proceed
  • Adds an explicit stop matchmaking search message, making the matchmaking flow more "proper/clean" and allowing us to do proper local error checking to prevent bad states without straining the matchmaker (ie. you can't create a lobby if you're in matchmaking).
  • A number of smaller edge case fixes/reworking internals to make things nicer to work with.

Lobbies Changes:

  • They now exist, freshly implemented
  • The core mechanics are in place for list/create/join lobbies
  • Supports password-protected lobbies to make it easy for users to play with their friends

Of note, this PR is already quite large and covers the majority of breaking changes to the matchmaker needed in the short term, while getting the flow of matchmaking to feel quite robust with the edge cases addressed. Lobbies still need further work to be robust, and the randomness seed/match_data pushing into the ggrs session runner hasn't been done here yet, however I feel this PR is encompassing enough as-is and would prefer to move forward with smaller/lighter PRs for the extra functionality.

@MaxCWhitehead
Copy link
Collaborator

This looks great, thank you!

RockasMockas and others added 25 commits August 9, 2024 19:59
Exposed option methods directly on Maybe for less verbosity when using a
lot of Maybes.
Disable MSAA when in pixel art mode. It seems to add artifacts with
texture sampling. Example: fishfolk/jumpy#1014
Added methods to SVec, SMap, and AnimationBankSprite for better ux.
…:bones_framework (fishfolk#434)

The change allows using the bones_ecs crate SystemParam macro (under
feature flag "derive") without bones_framework dependency, which I
believe is unintendedly required at the moment.
0.21 has some bugs that completely breaks compiling on some set of
systems. Bumping to 0.22 to address this.

Seems to compile/2 players connected on a quick test.
Adds a few more methods to SVec and also supports .into() SVec <-> Vec
now both ways.
Fixes a mistake regarding the behavior of `copy_from_nonoverlapping()`.
When copying from a typed pointer, we provide the number items to copy,
not the number of bytes.
Added support for gamepad rumble into bones. Changed the interface
compared to bevy's implementation with:
- Imo more straightforward naming/hiding abstractions like "requests"
- implementing an enable/disable layer which makes it easier for games
to fully turn off rumble for a given gamepad without having to include
`if` statements across their entire code (ie. during startup game can
read from settings that gamepad X has rumble disabled, just call
.disable(), and write code that always tries to use rumble without extra
boilerplate).
There were existing of `#[cfg_attr(feature = "serde",
derive(serde::Serialize, serde::Deserialize))]` lines already (f.e. on
Entity struct), but serde feature flag itself was missing from
bones_ecs.

Also added `cfg_attr(feature = "serde") ...` line to Entities and
BitSetVec so Entities struct can be serialized.
…t debug window behind feature flag `net-debug` (BREAKING) (fishfolk#443)

Locked some debug window that uses egui behind ui flag, fixed missing
audio/ui cfg blocks in a few places.

The network debug system is now behind `net-debug`. This way it is not
compiled if undesired, as it depends on 'ui' and is only useful if
displayed in egui. Also probably something we will want to disable in
release builds in the future.

Fixes fishfolk#442
Tried turning it off to reduce some artifacts but I think this it is
worse without it, maybe some other AA would work better, but not going
to worry about this for now.
Moved AudioCenter out of jumpy -> bones.

Reworked to remove the dependency on using a game's settings struct
directly + streamlining the interfaces such as having both play_sound
and play_music be super easy to use, with extra _advanced and _custom
methods for different levels of advanced features/usability on music.

Tested both music/sounds work.
Now supports both adding and setting rumble to provide both options
natively based on what is needed.
Extra helper methods added: iter(), all_cloned(), kill_all().
…ger work (fishfolk#450)

This PR covers the following:

1. Exposing player networking info from ggrs -> into an accessible
resource for anyone to use.
2. Provide a bunch of helper methods for easily fetching
averages/highest/lowest from networking info.
3. Convert `NetworkingInfo` struct to `SyncingInfo` (as discussed
previously on discord) which supports both Online/Offline variants and
put all fields behind getters. This will allow us to have a standardized
interface for implementing EventManager in the future that watches
current/last confirmed frame. (Of note this hasn't inserted the offline
variant anywhere, as that can wait for the EventManager work itself).
This PR includes:
- Implementing a "single success system" flow, which allows a user to
write a system that keeps trying to run every frame until it succeeds.
This is handy for a bunch of use cases that were less friendly to write
as always-on systems. Implemented with output `Option<()>` type to allow
for users to take advantage of `?` when calling various getter methods.
- Adds easier access to components from `World`
- Adds methods for removing all systems, providing more flexibility of
managing a session from within it
Implemented stop music/sound methods after I realized I couldn't stop
the music in my game. Also added options to fade out with two separate
custom fade out durations (one for music, and one for sounds).
@RockasMockas RockasMockas changed the title feat: Add lobbies to matchmaker + separate matches by game id feat: Matchmaker Rework Sep 12, 2024
@RockasMockas RockasMockas marked this pull request as ready for review September 13, 2024 12:42
Copy link
Collaborator

@MaxCWhitehead MaxCWhitehead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally actually reviewed this - looks good, thank you!

@MaxCWhitehead
Copy link
Collaborator

forgot to merge - I have not yet setup PR for jumpy to switch over but will do that soon after the fact, I've blocked this PR long enough heh. Thanks!

@MaxCWhitehead MaxCWhitehead added this pull request to the merge queue Oct 2, 2024
Merged via the queue into fishfolk:main with commit 2f4e7ac Oct 2, 2024
10 checks passed
@RockasMockas RockasMockas deleted the adding-lobbies-to-matchmaker branch October 4, 2024 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants