Install some dependencies.
sudo apt-get install jq
sudo apt-get install docker-compose
Build a map
./build_maps.sh main.tmx
The following script will build the client and server and run them locally, so you do not have to run the above steps.
./run-local.sh
To kill it, press Ctrl+C.
To get a new session run:
./local-session.sh
This will print out a URL and open up the URL in your browser
Docker compose watch automatically will rebuild the gameserver when you make local changes. In one terminal run:
docker-compose -f docker-compose-local.yml watch
In another, run the following to view logs:
docker-compose -f docker-compose-local.yml logs -f
The following endpoint multiplies the experience gained by multiplier for duration. Post to /setxpmultiplier with the following body:
{
"multiplier": y,
"duration": x
}
Where Y is an integer, and X is seconds. The following example will double the experience for 60 seconds after posting to the endpoint:
curl -X POST -H "Content-Type: application/json" -H "x-api-key: $LOOPWORMS_API_KEY" -d "{\"multiplier\": 2, \"duration\":60}" http://127.0.0.1:8000/setxpmultiplier
The following endpoint activates/deactivates triggers (for example event doors). Post to /activateTrigger or /deactivateTrigger with the following body:
{
"triggerId": "triggerId",
"mapId": "mapId" // mapId is optional = defaults to main!
}
The following example will activate the doors with triggerId = Fight Night:
curl -X POST -H "Content-Type: application/json" -H "x-api-key: $LOOPWORMS_API_KEY" -d "{\"triggerId\": \"Fight Night\"}" http://127.0.0.1:8000/activateTrigger
The gameserver accepts announcements per map. Not including maps
will send to all maps. Not including timeToShow
seconds will display the announcement until the user clicks exit.
curl -X POST http://localhost:8000/announce -H "Content-Type: application/json" -d '{"message": "Server maintenance will start at 8 PM.", "maps" : ["taikotown"], "timeToShow": 5}' -H "x-api-key: placeholder"
- Add each scale image to client/img/n
- Create a sprite.json under client/sprites for the mob with the same name as the scale image. Make sure the ID inside the JSON matches
- Add sprite.json (with the correct name) to sprites.js
- Add the new id to game.js array
this.spriteNames
- Add new mob entity to gametypes.js
- Add a new mob class in mobs.js
- Add the new entity factory in entityfactory.js
- Add the new mob to properties.js
- Add the mob to mobset_oa.png. Reopen tiled and note the id.
- Add the mob to the .tmx file noting the id in tiled.
This is useful to determine bottle necks.
- Edit the Docker file to have this command (note the --prof):
CMD node --prof server/js/main.js
- Run the game server
docker ps
to find its iddocker exec -it <id> /bin/bash
where id from step 3. Then runls
in the terminal to find the .log filedocker cp <id>:/opt/app/isolate<find real path from step 4>.log ~/isolate.log
to copy the .log file from the container to your host- Process the
.log
file to human readable (make sure node version is modern):
node --prof-process isolate.log > isolate.out
- Read your version of
isolate.out