Skip to content

JavaScript platformer game with passive multiplayer.

License

Notifications You must be signed in to change notification settings

anton-g/hackathon-runner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HACKATHON RUNNER

HACKATHON RUNNER is a small platform game built with the game engine Phaser. Besides the game istelf it has toplists and real time "ghosts" of other players. It was built with Phaser3, React, NestJS and Redis for DigitalOceans App Platform Hackathon on DEV. If you want to try it out yourself you can deploy your own version:

You can read a bit more from the development here.

gif of platform game

Running for development

Dependencies

HACKATHON RUNNER have one required external dependency which is Postgres. It is the database used to store the results for the top lists. To set it up locally you can use any of the methods described here.

There is also an optional dependency in Redis, but you can read more below if that is relevant.

Server

To run the server:

  1. Create a .env file in /server and set the environment variables to the values corresponding to your Postgres database:
DB_HOST=localhost
DB_PORT=5432
DB_USER=db_user
DB_PASSWORD=
DB_NAME=testdb
  1. Run npm install in /server
  2. Run npm start in /server

The server should now be served at localhost:3001.

Client

  1. Run npm install in /client
  2. Run npm start in /client

The client should now be served at localhost:3000.

Using Redis (optional)

Redis is used to distribute the messages sent by the server if it's run across multiple nodes (ie to make sure all players are visible to everyone else). This is probably an unneccesary performance optimization if you're just playing around with the game so it's completely optional.

If you do wanna try it out locally you can follow this guide to install Redis on your own machine. Then you need to add two more keys to your .env file:

REDIS_HOST=localhost
REDIS_PORT=6379

Redis with DigitalOcean

If you want to host it on DigitalOcean with Redis the easiest way is to add a new Redis Database Cluster on DigitalOcean Cloud and name it hackathon-runner-db-cluster. Then use the doctl CLI to create (or update) an app with the app spec. For example:

Create a new app:

> doctl apps create --spec .do/spec.yaml

Update an existing app:

> doctl apps list

ID                 Spec Name         ...
12341234-abcdabcd  hackathon-runner  ...

> doctl apps update 12341234-abcdabcd --spec .do/app.yaml

Remember to change the repo fields in the app.yaml if you've forked the repo.

License

Copyright 2021 Anton Gunnarsson

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

JavaScript platformer game with passive multiplayer.

Topics

Resources

License

Stars

Watchers

Forks