pixi-rainman-game-engine v0.1.9
RainMan pixi game engine
This repository contains all of the mechanics that used in rainMan games. This library uses pixi and pixi-spine as dependencies.
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:
yarn dev:link
After that you can use following command in one of the games. If there will be problems or the changes will not reflect in the game, uninstalling npm package may be needed.
yarn remove pixi-rainman-game-engine npm link pixi-rainman-game-engine
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/.
On the other hand, when linking package with npm link, the whole optimizeDeps.include an optimzieDeps.exclude should be commented out.
Lint project
npm run lint
Game engine structure
Code for the game engine contains in the src
directory. For create an feature you should add new directory into src
directory. For example: freeSpins
and in this folder contains all of the mechanics.
In utils directory there all of the utility functions and types.
Test environment
To simulate behavior of game engine mechanics, this repository contains react-pixi app, where you can test features that are included in game engine. Test environment uses local built of game engine. To setup test environment go to README of test environment.