Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browser-based MMORPG in a fantasy world.
CoffeeScript HTML JavaScript
branch: master
Failed to load latest commit information.
grunt-custom-tasks Merge pull request #330 from uonline/coffee-jshint-330
lib Cleanup, #517
tests A bit better #524
unify @ 619732c Update!
views Some character name checking, #517
.coffeelintrc, coffeelint and other stuff from branch coffee.
.gitignore jscoverage_dump task.
.gitmodules Better path.
.jshintrc JSHint: maxcomplexity=10. Closes #203.
.travis.yml Cleanup, #517 Merge pull request #330 from uonline/coffee-jshint-330 requireCovered everywhere. Closes #514.
LICENSE Licensed source code under GNU AGPL. Closes #105.
Makefile Update deps.
Procfile Fix Procfile. Closes #284. jit-grunt and time-grunt Update Forgotten configs
bower.json Update Bower deps. Ajax character name validation, #517 Coffee, Coffee everywhere A function in to fix energy levels. Closes #468. Add, optimize lib.js. Closes #326. Some character name checking, #517
newrelic.js Move it to env.
package.json Merge pull request #330 from uonline/coffee-jshint-330 Blah.


Build Status Coverage Status Dependency Status devDependency Status Code Climate Planned tasks

A browser-based MMORPG in a fantasy world.


  • Node.js 0.10 with npm;
  • CoffeeScript;
  • Grunt (you may use local one, but why?);
  • Bower;
  • PostgreSQL 9.1 or higher.

uonline expects environment variables DATABASE_URL and DATABASE_URL_TEST to be set. If they are not, it will use following default credentials. You'll probably find it convinient to make the dev environment match them.

  • Hostname localhost;
  • DB user anonymous with password nopassword;
  • Databases: uonline and uonline_test.

How to set up

  • Clone the repo.
  • Install packages: npm install, bower install
  • Fetch submodules: git submodule init, git submodule update
  • Initialize database: ./ --migrate-tables --unify-export --monsters --optimize-tables
  • If you need to add an admin: ./

How to run

If you have Heroku Toolbelt, run foreman start to get the server running. If not, try ./ If you need to restart server after every change in code — make monitor.

Grunt hints

Run grunt to check and test your code. It will lint your code, run tests, show coverage stats, generate docs and so on. Please run it before every commit.

Useful subtasks:

  • grunt test — run unittests only;
  • grunt docs — rebuild docs;
  • grunt build — rebuild static files.

Useful options:

  • grunt test --single — run only one testsuite;
  • grunt --stack — show stack trace on error.

Programmers' guidelines

  • Use tabs, not spaces. Don't mix them and don't use smarttabs.
  • Prefer single quotes. Use double quotes when you need to escape ' itself.
  • Place use strict in every file.
  • Don't omit extension while requiring: require('./utils.js');.
  • Sync is better than async. Async is better than callbacks.
  • Write tests for everything.
  • Write good assert comments: they should answer the question "What do this function should do?".
  • Keep things outside of main thread: use asynchronous API. And remember: fs.readFile.sync() is way better than fs.readFileSync().


  • Use ? when checking for null or undefined: if error? then ....
  • Leave two empty lines between function definitions.
  • -> is preferred, () -> is acceptable.
  • Use interpolation instead of concatenation.
  • Use unless instead of if not. Don't use unless ... else at all.
  • Use is instead of == when you don't mean calculations.
  • Overall: don't try to make CS look like JS.


  • Use if (!!something) when checking for null or undefined.
  • Use semicolons even if they're optional.
  • Place figure brackets on the same line when you declare an anonymous function and on separate line otherwise.
exports.closeSession = function(dbConnection, sess, callback) {
    if (!sess)
        callback(undefined, 'Not closing: empty sessid');
            'UPDATE `uniusers` SET `sessexpire` = NOW() WHERE `sessid` = ?',
            [sess], callback);
  • Use trailing commas. Place them even after last element — it allows you to swap lines easily.
var numbers = [
Something went wrong with that request. Please try again.