Lunacy
Lunacy is a werewolves game for Chrome and iOS. It ran on playlunacy.com (not owned by me anymore).
Copyright 2012-2013 Sander Dijkhuis. The source code is available under an Apache 2.0 license.
Screenshots
<img alt="Night" src="https://raw.githubusercontent.com/sander/lunacy/gh-pages/images/screenshots/night.png" width="300" height"412"> <img alt="Chat" src="https://raw.githubusercontent.com/sander/lunacy/gh-pages/images/screenshots/chat.png" width="300" height"412"> <img alt="Lynchmob" src="https://raw.githubusercontent.com/sander/lunacy/gh-pages/images/screenshots/hang.png" width="300" height"412"> <img alt="Dashboard" src="https://raw.githubusercontent.com/sander/lunacy/gh-pages/images/screenshots/dashboard.png" width="300" height"412">
Artwork
The artwork used in Lunacy is not available under an open source or free software license. You can mail the author for a zipfile that you can then extract to the visuals/
directory for testing.
Developing the gameplay
- Start a web server that hosts the Lunacy folder, for example using Mongoose in Windows.
- Go to the test page using Chrome. The URL is localhost:8080/html/index.inmem.html if you use Mongoose.
Installing the extension
- In Chrome, visit chrome://extensions.
- Make sure Developer mode is enabled in the upper right corner.
- Click the Load unpacked extension… button.
- 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
- Update the version number in
manifest.json
. - Run
v=VERSION tools/release.sh
, where VERSION is the same number as inmanifest.json
. - Upload
dist/VERSION.zip
to the Chrome Web Store.
Game data schema
Games are split up into multiple CouchDB documents, that are selectively synched to user databases.
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
- less.sh compile style sheets for iOS
- push.sh push to db, usage: server=name:passwd@server tools/push.sh
- random.js take all open actions and perform them randomly
- release.sh build Chrome app, usage: v=2.0.0 tools/release.sh
- replicate_from_users.js used in case bouncer doesn’t work properly
- node_modules/ imported libraries for the server
- README.md this file
Third-party material distributed with app
- AngularJS (MIT license)
- angular-mobile-nav (MIT license)
- Bootstrap (Apache 2.0 license)
- Fondamento (OFL 1.1 license)
- jQuery (MIT license)
- LESS (Apache 2.0 license)
- node-uuid (MIT license)