Git Product home page Git Product logo

rocketcrab's Introduction

Play now at rocketcrab.com

rocketcrab is a lobby service and launcher for mobile web party games.

Join the Rocketcrab Discord!

๐Ÿš€๐Ÿฆ€ for developers

Add your game to rocketcrab, tl;dr:

  1. Make sure your game has mobile support, and does not require a login or registration
  2. Add an API to your game that create a new room/lobby when called
  3. Copy config/games/_template.ts and fill it out for your game
  4. ...that's pretty much it. Submit a PR!!! If you'd like more detail, keep reading!

What's a "rocket crab"???

Rocketcrab makes it easy for players to discover your game, and easily switch to and from your game without having to manually open a different website and enter a new game code. It accomplishs this by putting your game's page into an iframe, which allows any of your cookies, local storage, analytics, and advertising to continue working, while disallowing rocketcrab from manipulating your site. Integrating your game with rocketcrab should be a simple process, but please let me know by opening an issue or joining our Discord if there is any way it could be better!

The name Rocketcrab is the first thing I could think of that sounded cool, had an available .com domain, and could be represented by two emojis. It also does not have an ambigious spelling when spoken out loud (there's only one way to spell "rocket" and "crab"), which is important when trying to get your whole group to go to the site to play games!

Games are added to rocketcrab via config files located here. By looking at the config files of other games, you might be able to understand how other games implement rocketcrab, and how you might integrate rocketcrab into your game. Here's what you need to know:

Ensuring compatability

Rocketcrab works by opening your game in an iframe on all of the players' devices. At minimum, for your game to work with rocketcrab, there must be:

  • A way for rocketcrab to generate a new party via either:
    • an API that rocketcrab can hit (eg. https://yourgame.com/api/creategame, which returns the generated game code, like abcd)
    • generating a random id that your game will accept as a valid room code
  • A way to construct a link to join a game using that game code (eg. https://yourgame.com/abcd will be opened on every player's browser, resulting in them all being in the same game together)

That's it! Many existing games already offer these, and can work with rocketcrab without any changes! But, to make the experience of playing your game with rocketcrab even better, you may need to make a few minor changes, explained in the "The automatic query params" section below.

Creating a config file

The config files, as mentioned above, should be fairly self explanatory. Along with the config template, check out the config files of other games to see how they implement rocketcrab. The most important part, which will be explained here, is the connectToGame function. This function:

  • is async, which will allow you to use await to make GET or POST requests.
  • needs to return an object with these properties:
    • player (required) an object with these properties:
      • url (required) string of the url that should be opened in every player's iframe.
        • customQueryParams (optional) a record of query params in addition to or to replace the automatic query params.
        • afterQueryParams (optional) string that will be appended to the player.url after automatic and custom query params are applied.
    • host (optional) an object with these properties:
      • url (optional) string of a url to be opened only in the "host" player's iframe. If not provided, the url from the player object will be used.
        • customQueryParams (optional) same as player object, but only applied to the host.
        • afterQueryParams (optional) same as player object, but only applied to the host.
    • These properties are explained more in depth in the config template.

Here are two examples of different connectToGame functions:

  • For Spyfall, game links are required to take the format spyfall.tannerkrewson.com/abcd. So, instead of returning the game code from connectToGame in the code property, the game code is directly appended to the player.url before it is returned from connectToGame.
  • For Just One, we can pick our own game code! So, instead of calling to some endpoint to get a game code like Drawphone and Spyfall, the connectToGame function can itself generate a code, and we cross our fingers and hope it's unique! ๐Ÿ˜‚ The resulting player.url will look something like this: https://just1.herokuapp.com/room/rocketcrab-d5b30ccdd25855e5.

The automatic query params

The player.url returned from connectToGame is automatically appended with 3 query params. The resulting player.url that is opened in every player's iframe will look something like this:

https://yourgame.com/?rocketcrab=true&name=Mary&ishost=true
  • rocketcrab will always be true, well, if you're using rocketcrab, that is! ๐Ÿ˜‚ You can use this to put your game into a "rocketcrab" mode. Here are some ideas for how this could be helpful:
    • Rocketcrab itself has it's own game code system, so if your game prominentely displays its own game code, your players may be confused. If rocketcrab=true, you should hide any UI in your game that shows the game code!
    • You should also hide any "Play on ๐Ÿš€๐Ÿฆ€" buttons (see the next section), because if rocketcrab=true, they're already playing with on rocketcrab! ๐Ÿ˜‚
  • name is a string of the name that each player has entered into rocketcrab. Use this instead of asking for your players' names a second time!
  • ishost is true for the one player that is the host of the rocketcrab party, and false for all other players. A few caveats:
    • I included this in case some one needed it, but implementing this in your game could allow any player that knows about it to make themselves host, especially outside of rocketcrab, so I don't recommend it.
    • In Drawphone, for example, the first player who joins a party is made the host. So, rocketcrab will load the host's iframe first, and will wait a few seconds before opening the iframe of the rest of the players. This is not a guaranteed solution, as the iframe API does not allow rocketcrab to know when its page has loaded.
  • There used to be an automatic code parameter for the game code. This was removed in favor of using a custom query param, detailed further in the template.

๐Ÿš€๐Ÿฆ€ for your existing players

If your game already has a player base, our goal is to make rocketcrab just as easy, if not easier, to use than how they already play. Rocketcrab is also a great way for your players to discover new games, which helps developers with no players yet find players for their games! So, we will want to make the process of discovering and jumping into a rocketcrab party from your game's existing lobby as painless as possible! Here's two features of rocketcrab to help:

  • Place a button on the homepage of your game that links to https://rocketcrab.com/transfer/[your game's id here]/.
    • This will place the user in a new rocketcrab party with your game already selected!
    • Your game's ID is the id that is set for your game in its config file. For example, Drawphone's is drawphone, so the link would look like https://rocketcrab.com/transfer/drawphone/.
  • Place a button in the party of your game that, when clicked by one player, will transfer all players to https://rocketcrab.com/transfer/[your game's id here]/[insert a uuid here].
    • The first time this link is followed, it will create a new rocketcrab party. Any subsequent time it is followed, it will place users into the same rocketcrab party that was created with the same uuid.
    • Again, for the most seamless experience, when any player clicks the button, your game should automatically redirect all players in the lobby to this link right away.
    • The uuid should be unique to each lobby in your game, but the same for each player in the lobby.
    • To generate the uuid, this uuid package would be best, but any very long random string will do.
    • An example of a link for Drawphone: https://rocketcrab.com/transfer/drawphone/9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d/
    • Make sure you hide this button if the players are using you game through rocketcrab, or else they could do this!

For an example of both of these buttons in action, check out snakeout.tannerkrewson.com. Here's what the code looked like for them.

๐Ÿš€๐Ÿฆ€ Behind the scenes

This is a Next.js project bootstrapped with create-next-app using the with-typescript-eslint-jest template, which includes:

Getting Started

First, run the development server:

npm run dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying pages/index.js. The page auto-updates as you edit the file.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

rocketcrab's People

Contributors

alenros avatar mavit avatar oisin-m avatar tannerkrewson avatar typesincode avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rocketcrab's Issues

Save play name in cookies

Currently, users have to enter their name every time they join or create a lobby. Instead, have them enter it the first time, and use the saved name by default.

Filter by number of players

When browsing the games library, give players the option to filter out games that they don't have enough or have too many players to play.

Documentation for developers

A short doc to explain requirements and recommendations for developers that want to add their game to rocketcrab.

Fancy game selector

Right now, games are displayed and selected via a dropdown. Replace this with some sort of component for browsing through, reading about, and seeing pictures of all available games.

Credit original game designers

For mobile web party games that are based on other games, add an optional field to credit original game designers to the game info box.

thx rocktopus ๐Ÿ‘

Hide in game menu bar by default

Thank @LukeGT for bringing this up!!

my worry with this is with discoverability. like you noticed, it's not clear that it's a button to begin with, so collapsing by default might confuse even more, like players could potentially not realize that they can back out of a game and switch to another, which is an essential feature of rocketcrab, which if they don't know about, they might wish they just didn't have to use rocketcrab. bad. also, in it's current form, if a game has ui in the top right, it looks bad -@tannerkrewson

I'm standing by this for now, but am open to more ideas, especially as users start to be more familiar with rocketcrab, hiding by default could make sense... although now that I'm thinking about it, it's probably a worse idea to change up on the users once they've already figured something out! ๐Ÿ˜†

I think it's clearer that it's clickable if the icon is the only thing visible, whereas being part of the banner it just looks like decoration.

This is very true. My thinking is that in a group of ๐Ÿš€๐Ÿฆ€ players, there's going to be the one that had the idea to play ๐Ÿš€๐Ÿฆ€ in the first place and is more savvy, and would know about this hidden trick, and tell the rest of the players about it if they want to use it. Hopefully games won't be to badly affected by the loss of space anyways..... i just did the math, and on the smallest screen (iPhone 5), the menu bar only takes up about 8%. (it's actually broken right now, the emojis wrap making it more) still kind of a lot tho.

I think the collapse button shouldn't be the logo, it's totally hidden this way -@alenros

We collectively decided against this because of the limited space in the menu bar, especially on mobile. But maybe there is still another way?? ๐Ÿค”

For now, I think I'm ok with keeping it like it is.. but would love to hear more feedback as this is one of the most important parts of rocketcrab; it's the screen where users will spend the most time!

One player is the host ๐Ÿ‘‘

The host is the player who creates the lobby. If the host drops, the role should be given to another player(?). If the original host rejoins, they will become the host again.

Vote to switch games

Users should be able to start a vote to switch to a different game. Votes should be able to happen in the lobby, and during a game.

Send name and other options to games

Rocketcrab should send the name the player entered into rocketcrab to any game that supports it so they do not have to enter their name again once in the iframe itself.

Rocketcrab should also be able to tell games that they are being played with rocketcrab, so the developers can change the game or UI how they see fit. For example, it will be recommended that developers hide their game codes so that players do not confuse it with the rocketcrab gamecode.

Fix URL sizing

gafdzdfgfgds
We want the URL to be as big as possible in case players show their screen to other players to share the url. But, we want it to be centered!!!

Favorites

Players should be able to favorite games to save them for easy access later.

Open rules while in game

For more complicated games especially, players should be able to open the rules for the game they're playing without leaving the game.

Edit player name

Players should be able to edit their name after joining a lobby, especially given #2.

React refactor

Some of the react components are too long and are disorganized

Provide API for developers to send players to a new lobby

There should be a way for developers to add a button to the lobby of their games that shows only when the game is not being played through rocketcrab that will automatically and seamlessly transition them all into a rocketcrab lobby with the same game already loaded.

Add lots of games!

Find every possible game I can on the internet, and try to add them!!! ๐Ÿฅณ

Public parties

Add an option to make your rocket crab party public. It will be added to a list which can be accessed via a link on the homepage which will display open parties, what game they are playing, and how many players are in.

Add more options to ingame status bar

There should be one button in the top right corner ingame that, when tapped, displays options, like maybe:

  • Back to lobby
  • Reset my game (just refreshes the iframe on the join link)
  • Reset all games
  • Kick player?

Quick emoji reactions from ingame status bar

It might be fun to have an emoji reaction button that will display shortly for all players. Though it's probably not that useful because players will certainly be on a call or in person with each other.

Collapse ingame status bar

Users should be able to collapse and expand the ingame status bar by tapping the ๐Ÿš€๐Ÿฆ€ logo.

Improvements to game library

@LukeGT's brainstorming:

  • Should the game selection UI be more game-centric rather than site-centric? Like selecting Spyfall -> netgames.io instead of netgames.io -> Spyfall?
  • Sort by popularity
  • maybe some "by game" and "by site" tabs at the top of the page is enough

Game description

show a nice description of the game and its stats, like how many players required, etc. screenshots too maybe?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.