Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

New Developer Guide

Kyle J. Kemp edited this page May 18, 2015 · 23 revisions

So you want a bit more in-depth information about adding content to Idle Lands? This is the place to be. The guide is split into two portions: code development, and content development.

Code Development

##Easy Setup Prerequisites: Git, Vagrant. Make sure you install Git Bash (if you're on Windows)!

First, fork the repo (click Fork at the top-right of the screen). Then, clone your repository to your machine locally.

Open a terminal in the root of your repository. This will take a while:

vagrant up
vagrant ssh

There you have it, it's installed! Just run npm start and the game will be running!

##More In-depth Setup Here are the prerequisites:

  • MongoDB, Git, and node.js (npm)
  • coffee-script (npm install -g coffee-script)
  • grunt (npm install -g grunt-cli)
  • redis (only if you want to use the API on your local machine)

First, fork the repo (click Fork at the top of the screen).

Then open Git Bash and do:

git clone https://github.com/<yourgithubname>/IdleLands.git
cd IdleLands
npm install
npm start

If you're having problems starting the game (no players are joining, etc), make sure you've started MongoDB.

If you're interested in having the front end available (perhaps for debugging maps, movement, or the like), then you will want to install idle.land. Then you can watch your characters move around on the map more easily.

##Important While writing code, make sure it passes coffeelint -- the easy shortcut for this is grunt dev. Additionally, check out CONTRIBUTING.md - it has guidelines for contributions and you should read it.

##Debugging

While running LocalTest.coffee, you may press [ENTER] to enter an interactive session. This will pause the execution and allow you to execute code. Here are a list of commands you can use while in this state:

  • c continue the game
  • exit exit the game
  • api() access the raw API object
  • inst() access the raw Game object
  • pm() access the raw PlayerManager object
  • petm() access the raw PetManager object
  • player() access the Player API directly
  • game() access the Game API directly
  • gm() access the GM API directly
  • pname(playername) get the player object named playername
  • gname(guildname) get the guild object with the name guildname
  • pid(playerid) get the player object with the identifier playerid
  • event(playername, eventtype) run the event eventtype for the player named playername
  • gevent(eventtype) run the global event eventtype

###Web Debugging If you'd prefer to use a web interface for debugging, point your browser to localhost:7965. The default login credentials are admin/password. You can use all of the above commands, except you'll have to preface them with idle., ie, idle.pname('Danret').

###Game Speed Currently the game speed is set to 1ms, meaning it runs approximately 10000 times faster than the actual game in IRC. If you want to slow this down a bit (maybe to observe movement patterns, or just to slow it down a bit), modify the LocalTest file, near the top, DELAY_INTERVAL, and set that to the time interval you'd like to have. Please do not commit changes to this file unless you're changing something else.

###Identifier vs. Name Some API functions require you pass an identifier and not just a name. These functions are often ones that require the identifier to do some name-independent tasks (registration, login/logout, etc). For all console players, the identifier is local-server/CharacterName, ie, local-server/Jeut. When in doubt as to what a function accepts, check the signature in the API.

###Examples ####Change the class for all players

for(var i=0; i<inst().playerManager.players.length; i++) inst().playerManager.players[i].changeProfession('Cleric')

####Add a personality to all players

for(var i=0; i<inst().playerManager.players.length; i++) inst().playerManager.players[i].addPersonality('Evil')

####Change a player's info

inst().playerManager.getPlayerByName('Danret').gainGold(100)            // add 100 gold
inst().playerManager.getPlayerByName('Jeut').changeProfession('Jester') // change classes
inst().playerManager.getPlayerByName('Xefe').levelUp()                  // force a levelup

For more player-related things, check the Player class.

####Force a battle to start

gm().event.global('battle')     // PvP battle
gm().event.single('Danret', 'battle') // monster battle
> A battle is raging...

####Cause any event to happen

gm().event.single('Danret', 'enchant')
gm().event.single('Danret', 'blessItem')

####Teleport all players to the Mage trainer

gm().teleport.location.mass('mage')

For a full list of functions you can call from the terminal, please check the API.

Please leave your game run for an hour or so in the console when you add a new class, spell, or otherwise, so the game can test it in numerous situations. You don't have to watch it, just make sure it doesn't crash.

##Adding Achievements, Spells, Personalities, Regions, Classes, or Anything That Is In Code There should be a sufficient amount of examples that display mostly any existing situation in the code, but for reference, here are all of the reduction calls in the game. When in doubt, check out how an existing spell works!

Clone this wiki locally