-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.js
20 lines (17 loc) · 2.13 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Please do not modify this file.
// Instead have a look at `README.md` for how to start writing you AI.
process.title = 'Joueur.js Game Client';
global.__basedir = __dirname + '/'; // hackish way to store the base directory we are in now so we don't need require("../../../../whatever") and instead require(__base + "root/path/to/whatever")
let ArgumentParser = require('argparse').ArgumentParser;
let parser = new ArgumentParser({description: 'Run the JavaScript client with options to connect to a game server. Must provide a game name to play.'});
parser.addArgument(['game'], {action: 'store', help: 'the name of the game you want to play on the server'});
parser.addArgument(['-s', '--server'], {action: 'store', dest: 'server', defaultValue: '127.0.0.1', help: 'the hostname or the server you want to connect to e.g. locahost:3000'});
parser.addArgument(['-p', '--port'], {action: 'store', dest: 'port', defaultValue: 3000, help: 'the port to connect to on the server. Can be defined on the server arg via server:port'});
parser.addArgument(['-n', '--name'], {action: 'store', dest: 'playerName', help: 'the name you want to use as your AI\'s player name'});
parser.addArgument(['-i', '--index'], {action: 'store', dest: 'index', help: 'the player number you want to be, with 0 being the first player'});
parser.addArgument(['-w', '--password'], {action: 'store', dest: 'password', help: 'the password required for authentication on official servers'});
parser.addArgument(['-r', '--session'], {action: 'store', dest: 'session', help: 'the requested game session you want to play on the server', defaultValue: '*'});
parser.addArgument(['--gameSettings'], {action: 'store', dest: 'gameSettings', help: 'Any settings for the game server to force. Must be url parms formatted (key=value&otherKey=otherValue)'});
parser.addArgument(['--aiSettings'], {action: 'store', dest: 'aiSettings', help: 'Any settings for the AI. Delimit pairs by an ampersand (key=value&otherKey=otherValue)'});
parser.addArgument(['--printIO'], {action: 'storeTrue', dest: 'printIO', help: '(debugging) print IO through the TCP socket to the terminal'});
require('./joueur/run')(parser.parseArgs());