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
You can try the game by visiting:
sdn-hathora-phaser.netlify.app
To run the game locally, follow these steps:
- Clone the game from GitHub:
git clone [email protected]:saricden/hathora-phaser-test.git
- Install the client dependencies with NPM:
cd client
npm install
- Install the server dependencies with NPM:
cd ../server
npm install
- 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=...
- 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! 🥳