Skip to content

A sample game using Phaser 3 and the Hathora Phaser Plugin

Notifications You must be signed in to change notification settings

hathora/hathora-phaser-sample-game

Repository files navigation

A screenshot of the game's title screen.

Hathora Phaser Sample Game - Fast Food

A demo game utilizing the Phaser 3 game engine and the Hathora Phaser 3 Plugin to integrate multiplayer lobby components for game servers deployed on Hathora Cloud.

To learn more about Hathora Cloud, check out: Hathora Cloud Documentation

Live demo

You can try the game by visiting:

sdn-hathora-phaser.netlify.app

Running locally

To run the game locally, follow these steps:

  1. Clone the game from GitHub:
git clone [email protected]:saricden/hathora-phaser-test.git
  1. Install the client dependencies with NPM:
cd client
npm install
  1. Install the server dependencies with NPM:
cd ../server
npm install
  1. Populate environment variables:

For this step, you will need to have a Hathora account and be logged into console.hathora.dev, as well as have an application created. For this step you will need:

  • A HATHORA_APP_ID: Found on your Hathora application's overview page.
  • A HATHORA_APP_SECRET: Also found on your Hathora application's overview page.
  • A HATHORA_TOKEN: Can be accessed via the command - cat ~/.config/hathora/token.

With all of these variables handy, you then need to populate a .env file at the root of the project like so:

HATHORA_APP_SECRET=...
HATHORA_APP_ID=...
HATHORA_TOKEN=...
  1. Boot up the local client and server

In the terminal tab you have open, run the following:

cd ..
npm run client

Then, open a second terminal tab and from the same directory (the project root), run this:

npm run server

Please note that for the server, you should be running Node 18 (see nvm for an easy way to switch versions).

You should now have your own copy of the game running at http://localhost:5173/! Woohoo! 🥳

About

A sample game using Phaser 3 and the Hathora Phaser Plugin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published