pixi-rainman-game-engine
v0.1.53
Published
This repository contains all of the mechanics that used in rainman games.
Downloads
874
Readme
RainMan pixi game engine
This repository contains all the mechanics that used in RainMan games. This library uses pixi and pixi-spine as dependencies.
Development scripts
In this repository you have directory scripts
, contains scripts for deployment to digital ocean and preparing tags and releases for games. As you can use linux or MacOS environment, you should add permissions for executing the script. To do this you should perform a command:
chmod +x ./scripts
After adding permissions for scripts, to operate the scripts you should installed following programs:
In the scripts
directory, you have three scripts:
apply_diff.sh
This script applying should apply diff file for all of the games. This should automate adding the same changes to the all games that uses engine.Example:
./scripts/apply_diff.sh "CD-XXX" "XXX" ./newChanges.diff
auto_merge.sh
This scripts is used for merging pull requests with given issue. This scripts uses gh, which is responsible for communicating with github. This scripts, have option to create git tag and release for deployment. To enable this option you should add true second parameter.Example:
./scripts/auto_merge.sh "CD-XXX"
prepare_for_deployment.sh
This scripts is used to preparing for deployment on DigitalOcean. The script automates changing the version and adding date to version inpackage.json
for each game. Default behavior is to increase the patch version of the game. This script uses environment variablePR_REVIEWER
, to add reviewer/s to each pr.Example:
./scripts/prepare_for_deployment.sh "CD-XXX" "Commit message"
Scripts
To build library
yarn build
To build library during development
yarn dev:build
Modifying css files does not automatically reload server, after each change manual restart is needed.
To have live updates in one of the games, link is recommended. It needs to be done just once, yarn will remember link to this package even after computer restart.
yarn link
After that use the following command in one of the games to use local version of the engine.
yarn link pixi-rainman-game-engine
Link is common to cause bugs when used together with npm version of the same package, that is why you should use helper commands engine:local and engine:npm in the games. If there are still some bugs (most common with pixi/layers) try deleting node_modules, installing dependencies without engine, linking engine and restart server. This should resolve all the problems.
By using package from npm, in vite optimizeDeps you must exclude this package, but must include each package that throws error in the console. This is probably due to problem with excluding commonJS dependencies. An example is below.
defineConfig({ optimizeDeps: { include: [ "ts-money", "adaptive-scale/lib", "stats.js", "url", "eventemitter3", "earcut", "react", "react-dom", "use-sync-external-store/shim", "classnames", "react-is", "react-custom-scroll", "react-dom/client", ], exclude: ["pixi-rainman-game-engine"], }, });
For each error in the console, e.g.:
Uncaught SyntaxError: The requested module '/node_modules/eventemitter3/index.js?v=ec22a584' does not provide an export named 'default'
you must include it in the optimizeDeps.include array. Typically, it is the name after /node_modules/.
Lint project
npm run lint
Game engine structure
Code for the game engine contains in the src
directory. For creating a feature you should add new directory into src
directory. For example: freeSpins
and in this folder contains all the mechanics.
In utils directory there all the utility functions and types.
Creating a documentation in TypeDoc
Available tags to use you can check here: https://typedoc.org/guides/tags/