tannerkrewson / rocketcrab

party games for phones
https://rocketcrab.com
MIT License
236 stars 17 forks source link

Play now at rocketcrab.com

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

πŸš€πŸ¦€ 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 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:

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:

Here are two examples of different connectToGame functions:

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

πŸš€πŸ¦€ 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:

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!