Humans vs Zombies
This is the website that the Rochester Institute of Technology's Humans vs Zombies club uses to run weeklong games of Humans vs Zombies.
This website echews most best practices of ember, dear god do not use it as a model for how to make a website. It works and it works well, that doesn't mean the code is pretty.
The website is powered by NodeJS and requires both node and npm to be installed.
The following packages should be installed with
npm install -g <package>:
Once global packages are installed, run the following to install dependencies:
cd ./server npm install cd ../client npm install bower install
To configure the website, copy
Edit this file, and add any additional settings you may need to it. You can
also edit other files in the config directory, but note that all options
are overridden by entries in
For development purposes, the "localDiskDb" connection is probably good enough (it saves to a json file in .tmp). For production purposes, you should setup a connection to a database such as MySQL, MongoDB, etc...
Additionally, you will have to copy
and edit to your liking.
Push Notification Support
We use OneSignal for web-push notifications. hvzsite will prompt users to enable notifications if you want (and it will set the user's
team tag in OneSignal).
We use this to quickly disseminate emergency information or changes to missions. If you want to use it, copy
client/public/manifest.json and edit according to the docs
here. You can then change the OneSignal settings in
Other uses of notifications include:
- Notifying a player when they are infected or healed
- Notifying a player when someone they follow is infected or healed
There's also a built-in notification/feed system which is used whether or not you enable OneSignal - this is also used for some other notifications like receiving a badge.
For the purposes of development, you will need to launch both the api server and also an ember-cli server. To do so, run the following in two different terminals:
cd server sails lift
cd client ember server
Do not use
ember server for production environments, see the "Building the Client" section below for information on how to build the client.
Building the Client
Run the following command to build the client:
ember build --environment=production --output-path=../server/assets
Make sure to run this whenever the client changes!
Serve the generated files (which are generated in the
output-path directory) as static files with whatever web server you prefer.
In order to create the initial superadmin account, open up the sails console with
within the server directory. Run the following command:
AuthService.createSuperAdmin('Your Name', 'Your Email');
You may also create additional accounts with any of the following commands:
AuthService.createUser('Your Name', 'Your Email'); // creates an inactive user, same as registering a new user account AuthService.createActiveUser('Your Name', 'Your Email'); // creates an active user
Running the Website
To run the website, run the following command:
If successful, the website should start on port 1337.
Running in Production
For running in production, we use PM2, configured
The frontend is a bit hastily thrown together in Ember, and doesn't really follow all conventions thoroughly. It doesn't make use of Ember's model system or components very well, but there are plans to slowly clean it up.
If the database model changes in sails, running in production will not automatically apply the changes. You will have to either manually apply changes or let sails try to alter it (possibly destroying data!!!) by running the server in development mode briefly.
- Notification Dropdown: https://bootsnipp.com/snippets/depAz