Git Product home page Git Product logo

cobmin / looperlands Goto Github PK

View Code? Open in Web Editor NEW

This project forked from looperlands/looperlands

0.0 0.0 0.0 1.05 GB

Explore the dual worlds of Cob's Farm, an action RPG where farming tranquility meets dungeon adventure. Alpha stage game featuring diverse activities like farming, fishing, and combat, enhanced by community interaction and open-world exploration.

License: Other

Shell 0.14% JavaScript 84.73% Python 13.72% CSS 1.22% HTML 0.19% Dockerfile 0.01%

looperlands's Introduction

LooperLands

Local development

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

Using docker-compose watch

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

Set XP Multiplier

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

Activate/deactivate trigger

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

Announcement

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 a mob

  • 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.

Performance profiling

This is useful to determine bottle necks.

  1. Edit the Docker file to have this command (note the --prof):
CMD node --prof server/js/main.js
  1. Run the game server
  2. docker ps to find its id
  3. docker exec -it <id> /bin/bash where id from step 3. Then run ls in the terminal to find the .log file
  4. docker 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
  5. Process the .log file to human readable (make sure node version is modern):
node --prof-process isolate.log > isolate.out
  1. Read your version of isolate.out

looperlands's People

Contributors

0xbitcorn avatar anderstr avatar balkshamster avatar cobmin avatar cyberpanel avatar dachusa avatar dependabot[bot] avatar enragedone avatar funhausfarms avatar github-actions[bot] avatar groot406 avatar i-am-kofit avatar loopwormsbot avatar m88nwalker avatar mycupbloody avatar ordinaryadam avatar parkerm1417 avatar peteszah avatar robitsnft avatar smileyphaselw avatar venitel avatar wizkingprod avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.