Werewolves game for Chrome and iOS using CouchDB, Node.js and AngularJS.

Added by: Sam Deering





Stars: 10

Watchers: 10

Forks: 1

Module Description


Copyright 2012-2013 Sander Dijkhuis. The source code is available under an Apache 2.0 license.

The artwork used in Lunacy is not available under an open source or free software license. You can download and extract it to the visuals/ directory for testing.

Developing the gameplay

  1. Start a web server that hosts the Lunacy folder, for example using Mongoose in Windows.
  2. Go to the test page using Chrome. The URL is localhost:8080/html/index.inmem.html if you use Mongoose.

Installing the extension

  1. In Chrome, visit chrome://extensions.
  2. Make sure Developer mode is enabled in the upper right corner.
  3. Click the Load unpacked extension… button.
  4. Select the lunacy folder that you have synced using GitHub or git.

You can now launch the new Lunacy in the same way as you launch the old Lunacy. Note that they have the same icon.

To load updated code, press ctrl+R (or any other key combination you use for reloading) while Lunacy is running.

Making a new Chrome release

  1. Update the version number in manifest.json.
  2. Run v=VERSION tools/, where VERSION is the same number as in manifest.json.
  3. Upload dist/ to the Chrome Web Store.

Game data schema

Games are split up into multiple CouchDB documents, that are selectively synched to user databases.

See schema.png.

File structure

- html/                        client-side files
  - images/                    redistributable images
  - js/                        JavaScript scripts, including standard Angular scripts
  - less/                      style sheets
  - lib/                       third-party font and libraries
  - partials/                  HTML templates, among which:
    - game-main.html           in-game main views
    - game-event.html          game history notices
  - index.inmem.html           test without a database connection
  - index.nocache.deploy.html  used in Chrome app
- lib/                         code shared between server and clients
  - game.js                    game objects and functions
  - proceed.js                 game logic

- visuals/                     non-redistributable visuals used in the game
- config/                      configuration files, symlink one to config.js
- manifest.json                Chrome Web App settings
- design/                      CouchDB design documents with map/reduce queries etc.
  - general.js                 used in multiple places
  - server.js                  only used by e.g. gamemaster
  - user.js                    only used by clients
- bots/
  - bouncer.js                 handles user presence and data transfer
  - collector.*                collects money from Google for upgrading accounts
  - gamemaster.js              creates open games and proceeds them
  - hedwig.js                  delivers messages to users
  - host.js                    creates new user accounts
- chrome/                      Chrome packaged app
- ios/                         iOS app
- tools/                       tools for development
  - actions.js                 create an overview of players who need to do something
  -                    compile style sheets for iOS
  -                    push to db, usage: server=name:[email protected] tools/
  - random.js                  take all open actions and perform them randomly
  -                 build Chrome app, usage: v=2.0.0 tools/
  - replicate_from_users.js    used in case bouncer doesn’t work properly

- node_modules/                imported libraries for the server
-                    this file

Third-party material distributed with app

Module stats last updated: 2015-06-07 05:59:29

Disclaimer: Some data on this page may have been gathered from the authors GitHub respository. If you see any mistakes or outdated information please let us know. Thanks!