Arma3 mission replay API
Clone or download
Fusselwurm Merge pull request #11 from gruppe-adler/inject-logger
inject bunyan logger into sock-rpc
Latest commit d606cab Oct 14, 2015
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib inject bunyan logger into sock-rpc Oct 14, 2015
spec for now, remove all things frisby Oct 13, 2015
.gitignore
.travis.yml Travis CI build test Oct 13, 2015
README.md add travis build icon Oct 13, 2015
auth.ini.example deactivate broken tests Oct 13, 2015
config.json.example add 'logfile' and 'pidfile' options Apr 25, 2015
gulpfile.js use spec reporter Oct 13, 2015
main.ts tests start their own ar3play-server instance (careful, they use the … Oct 11, 2015
package.json inject bunyan logger into sock-rpc Oct 14, 2015
test.js
tsd.json

README.md

Arma3 mission replays.

Build Status

Prerequisites

Parts of the whole

Installation of this thing here

  • clone
  • npm install
  • edit configuration file, see config.json.example
    • note: pidfile, logfile, redis_max_used_memory, webserver_port are optional
  • optionally add authentication file, see config.json.example and auth.ini.example
  • start this thing with npm start
  • run your armaserver with the ar3play-addon, and the sock extension pointing at host/port specified in config.json
  • you can stop the process using npm stop

API

sock-rpc

missionStart

Parameters:

  • mission name (string)
  • world name (string)

Example:

['missionStart', ['Co20_Foo', 'Stratis'] call sock_rpc;

missionEnd

Parameters: none

Example:

['missionEnd', []] call sock_rpc;

echo

Parameters: any

Example:

['echo', ['foo', 'bar', ['baz']]] call sock_rpc;

setIsStreamable

Should the REST API allow getting data while the mission is still running? Defaults to false

Parameters

  • isStreamable (boolean)

Example:

['setIsStreamable', [true]] call sock_rpc;

setUnitDatum

Pass update information for one player

Parameters:

  • , an array containing: objectId: x: int y: int z: int dir: 0..360 side: WEST|EAST|GUER|CIV|EMPTY|... health: alive|unconscious|dead icon: string name: string container: content: <array of >

  • x…z are the player's coordinates as getPosATL returns them

  • dir is the direction the unit is facing (0..360), as dir returns it

  • "classtype" is a shitty name for what should be named "role" -.-

  • all values may be null or otherwise empty

Example:

[
	'setUnitDatum',
	[25, 1545, 1554, 0, 45, 'GUER', 'alive', 'engineer', 'Fusselwurm', 3, []],
] call sock_rpc;

setAllUnitData

Pass information for several units.

Parameters:

  • allUnitData (array of <unitdatum>)

see above for definition of

REST

GET /missions

returns mission instances as nice JSON

GET /currentMission

returns instance ID of currently running mission

GET /mission/:id/changes

:id is the mission instance ID - to be found either in /currentMission or in one of the values from /missions

query parameters:

  • from (timestamp)
  • to (timestamp)

Both parameters are mandatory, and the difference between them must be 0 < diff <= 100 !

Retrieve changes accumulated in the specified interval.

GET /mission/:id

Get details for the mission instance: starttime, endtime, world name, mission name

DELETE /mission/:id

Remove all saved data for mission instance.

You MUST send an Authorization header. See auth.ini.example

Development

Testing

Testing the REST part is easy, of course. There are lots of possibilities there. More interesting to know is how to test the RPC server. For that, sock-rpc has its own script to act as RPC client. For manual testing, use for example:

node_modules/sock-rpc/bin/sock-rpc-client --host=::1 --port=5555

The resulting prompt lets you call the sock_rpc function like so:

connect()
sock_rpc('methodname', arguments)

Automated Tests

I'm using mocha here, tests reside in spec/ . Note:

  • sock-rpc debug output will spoil your funz.
  • frisby tests fail because frisby is too retarded for my use case (alternatively, I am too retarded for frisby). I will need to find something better or fix it.

DANGER THIS WILL USE YOUR NORMAL config.json , MURDER YOUR KITTENS AND CLEAR YOUR DATABASE

npm test