Skip to content
apsillers edited this page Nov 15, 2014 · 7 revisions

Welcome to the Lords of the Fey wiki!

File manifest

The root directory contains Node.js server code, responsible for validating input, maintaining game states in MongoDB, and pushing updates to clients.

  • /server.js - the main server code, runnable with node server.js
  • /auth.js - creates user accounts, logs in users, validates user sessions (i.e., when a socket connection asks to perform a move on a unit, is it the owner of that unit?)
  • /createUnit.js - creates units
  • /createGame.js - creates new games
  • /endGame.js - detects victory conditions
  • /executePath.js - validates and executes unit moves
  • /executeAttack.js - executes unit attacks
  • /gameList.js - logic for getting a player's list of games
  • /levelUp.js - handles unit level-up logic
  • /loadUtils.js - module for loading data about maps and units
  • /lobby.js - currently unused server-side lobby code
  • /init.mongo.js - a run-once setup script to initialize the MongoDb store
  • /manifest.json - installation information about the server used by npm (mostly dependencies, installable with npm install)

The /view folder holds views rendered with Handlebars. Currently, only the main page and each player's game list are Handlebars views.

The /static folder contains code that is accessible by both the client and the server. When accessing files from the browser client, the /static directory serves as the web root, so /static/foo is accessible in the browser with the URL http://hostname/foo.

The /static/client folder holds the client-side JavaScript and HTML.

  • grid.html - the HTML scaffolding of the browser client
  • grid.js - defines the World object type (and the Space type), which maintains map and unit data, draws the map, and listens for mouse input events
  • boot.js - loads unit and map data, and listens for socket events (e.g., unit movements, turn endings)
  • ui.js - includes fuctions for drawing paths, updating unit info displays, moving units, and animating attacks (these are the functions used by the socket-event listeners when they hear about units moves, attacks, etc)
  • astar.js - generates unit pathing suggestions
  • scroll.js - map scrolling logic
  • minimap.js - minimap setup and logic

The /static/lobby folder holds the (currently unfinished) client-side JavaScript and HTML used for creating and joining new games.

The folders in /static/data hold non-code data assets like images, units and race stats, and map files. These are used by both the client and server.

The /static/shared folder has code used on both the client and server. For example, both client and server need to parse map files (for client-side rendering and pathing suggestions, and server-side pathing validation).

  • castlePathExists.js - used to validate the existence of an unbroken path of castle tiles between two tiles. Used on the client to decide when to show the "Recruit" menu option and on server to validate unit-creation requests
  • terrain.js - parses Wesnoth map data files and contains information about which terrain properties (e.g., forest, snow) apply to which tile types (e.g. Winter Forest)
  • unit.js - loads unit data and includes a Unit constructor that prototype-ifies an object of unit properties (e.g., the usage looks like new Unit({ type: "grunt", hp: 12, xp: 7, moveLeft: 2 }), and the resulting constructed object has hp, xp, and moveLeft properties as specified, but also has maxHp, maxXp, and move properties supplied by the Grunt unit prototype)
Clone this wiki locally