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

Match Making System Example #427

Open
8 tasks done
planktonfun opened this issue Jan 4, 2023 · 8 comments
Open
8 tasks done

Match Making System Example #427

planktonfun opened this issue Jan 4, 2023 · 8 comments
Labels
✨ New example A new example

Comments

@planktonfun
Copy link
Contributor

Describe the example

A matchmaking system using with p2p and firebase
consolidated in four events to make it simpler for developers.

image
image

Flow:

sequenceDiagram
    participant firebase
    host->>firebase: register as host in the pool
    client->>firebase: finds a host from the pool
    client->>host: connects to host
    host->>client: checks for enough players
    host->>firebase: remove itself from the pool
    host->>client: sends client to next scene
    host->>host: sends itself to next scene
    client->>host: disconnect and restart scene on connection timeout
    host->>host: subtracts client count upon client disconnection
Loading

Requirements is a firebase account and a few tweaks:

1.) Go to firebase project settings then get config then paste it in gdevelop settings (**important: don't forget to add double quotes to the keys **)
image
image

2.) Enable anonymous login so users don't need to login to use the server
image

3.) then finally enable realtime database, change its rules and use that as a prefix on the matchmaking action
image
image

Checklist

  • I've followed all of the best practices.
  • My game has a proper name in the game properties.
  • My game package name behind with com.example..
  • My game has all events unfolded.
  • I've added myself as the author in the game properties.
  • I've included a file called "README.md" with a description in proper English, explaining what this example is doing.
  • I confirm that this game and all of its resources can be integrated to this GitHub repository, distributed and MIT licensed.
  • I've cleaned unused resources.

Game folder

matchmaking-example.zip

@planktonfun planktonfun added the ✨ New example A new example label Jan 4, 2023
@Bouh
Copy link
Contributor

Bouh commented Jan 7, 2023

I wanted to point that if the user need to configure Firebase the instruction needs to be added in the description of the extension. Or add a help link leading to a new page on the wiki.

Can we have your opinion @arthuro555?
Especially for the multiplayer structure, and the usability of events?

I ask you because you seem to me to be the person with the most experience in multiplayer with GDevelop :)

@arthuro555
Copy link
Member

I'm gonna be honest, imho, it's a big mess. I can't see anyone learning anything from this example. Most of the logic is contained within a "matchmaking" extension that doesn't just do matchmaking, is messy, and has JavaScript code sprinkled everywhere.

Additionally, P2P & Matchmaking is not a very good match... P2P, by design, sends both local and public IP addresses to whoever connects, and while that is OK when playing with friends, that is generally pretty frowned upon when playing online with strangers.

@planktonfun
Copy link
Contributor Author

I rarely seen developer make multiplayer games, main reason is of its complexity, please elaborate on why simplicity is frowned upon?

@arthuro555
Copy link
Member

You got this backwards, simplicity is encouraged, but your example and extension are the inverse of simple. The events are not easy to understand because of how messy they are, by introducing firebase and P2P users need to learn and understand their setup (and I have seen oh too many people struggle with just that), the extension, by being not on the extension repository (at least as far as I know), will confuse users that try to apply the example to their project...

Not to mention, quality is just as highly regarded as simplicity. As far as I remember, your networking is full of anti-patterns, the example and extensions events are super messy and lack insightful comments/groups, is unoptimized...

This makes this project fail at being an example, as an example is supposed to show a clean and correct way to do things for people to learn from. Nobody can learn anything from that because of the sheer complexity, and even if they could they likely shouldn't, imho.

@planktonfun
Copy link
Contributor Author

planktonfun commented Jan 12, 2023

Everything is consolidated in 4 events, its simple as it can get. developers won't look inside the extension, and since its a community extension, code breaking standards is unnecessary. Its like saying users will check gdevelop source code in order to implement a simple hello world.

@planktonfun
Copy link
Contributor Author

Plus developers only look for functionality over code standards

@Remonvs
Copy link

Remonvs commented Jan 17, 2023

I am trying this out but the Firebase instructions are not clear enough. It would need to be a neat step by step instruction. How the and which strings need to be set up in the firebase properties of Gdevelop. Including creating a new project and generating new webkey. It would be also nice if the example simply comes already configured to a existing firebase host. That way one can simply see it immediatly working. It is far from easy at this moment. I would still prefer to use the websocket extension as it has more possibilities of making your own server. I think the idea is very nice but it will lack a lot of possibilities. Also p2p most often stops working as soon as one is not in the same network as the other user.

@planktonfun
Copy link
Contributor Author

I am trying this out but the Firebase instructions are not clear enough. It would need to be a neat step by step instruction. How the and which strings need to be set up in the firebase properties of Gdevelop. Including creating a new project and generating new webkey.

There's a link in step 1: https://wiki.gdevelop.io/gdevelop5/all-features/firebase/quickstart
Which step are you stuck with? I could guide you step by step and I'll revise the instruction that is not clear after.

It would be also nice if the example simply comes already configured to a existing firebase host. That way one can simply see it immediatly working.

Updated
!update MatchMakingExample.zip

I would still prefer to use the websocket extension as it has more possibilities of making your own server.

well yes, the extensions responsibility is solely for match making logic, not everything. It depends on the developers requirement.

also the cons and pros vs websocket server, own nodejs server:

  1. Its free up to a certain limit, you can check here: https://firebase.google.com/pricing
  2. You don't have to keep a server running, you can use serverless service too but it would be too slow for a matchmaking system.
  3. since there are no servers, no server coding needed
  4. server logic is on the client side, you don't have to perform maintenance and restart the server for every code changes

Also p2p most often stops working as soon as one is not in the same network as the other user.

What do you mean? I tested it with mobile data and local network (2 different networks), still works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ New example A new example
Projects
None yet
Development

No branches or pull requests

4 participants