A simple demo utilizing Google App Engine and Google Cloud Datastore
This repo contains a simple multiplayer game (maybe more of an animation (:) and a Node.js/Express server. The game saves player names to Google Cloud Datastore so that names cannot be reused, and it can be deployed to Google App Engine (GAE).
- /js: Contains clientside, game related code built using Phaser. client.js contains all of the server calls.
- server.js: The Node.js/Express server that the game talks to. The server allows players to communicate and keeps track of player state.
- model-datastore.js: Contains a CRUD api that calls Google Cloud Datastore. Includes functions to read and write to the database to check for duplicate names and add new names. Mostly copied from here.
- Download Node.js and npm
- clone this repo
- cd into the repo in the terminal and run
npm install
(You may have to usesudo npm install
if you fail with a permission error). - Start the server by running
node server.js
- Navigate to http://localhost:8081
- Create a project in the Google Cloud Platform Console (You will probably have to Enable Billing)
- Download The cloud sdk
- Set your default project by running
gcloud config set <projectid>
can be found by clicking on the project name on the top bar of the cloud platform console. - Change the projectId value in model-datastore.js
- Set auth for Datastore by running
gcloud beta auth application-default login
- Deploy to appengine by running
gcloud app deploy
. 🔥Boom Bam Pow🔥 Navigate to the (GAE Versions Page)[console.cloud.google.com/appengine/versions], click on the version name, and view your application!!