Add how to use local gaia engine

This commit is contained in:
coyotte508 2020-09-27 09:22:53 +02:00
commit 8a52f4ec55
2 changed files with 18 additions and 26 deletions

View file

@ -7,44 +7,36 @@ A Vue.js / SVG UI for Gaia Project
Check out [boardgamers.space](https://www.boardgamers.space)!
## Requirements
Depending on your version of node and your OS, the binaries for node-sass might need to be built rather than downloaded.
This can generally be avoided if you have a LTS version of node installed: https://nodejs.org/en/.
If you have errors during `npm install` due to manually building modules, you can try this:
### Windows
```bash
# From an elevated powershell / admin console
npm install --global --production windows-build-tools
```
### Mac
- install python 2.7 + (not 3.x)
- run `xcode-select --install` in the terminal
See [here](https://github.com/nodejs/node-gyp) for why.
### Unix
```bash
sudo apt install build-essentials
```
## Build
## Build and Run
```bash
# install deps, do this everytime yarn.lock is modified
yarn install
# run
yarn serve
```
And open localhost:8080 in the browser.
You will also need to run gaia-engine on the same machine.
You can change [src/self-contained.ts](src/self-contained.ts) to change the initial setup: number of players, factions...
## Use local engine
Download and install `gaia-engine`.
In `gaia-engine`'s folder:
```
yarn link
```
In `gaia-viewer`'s folder
```
yarn link @gaia-project/engine
```
Now your gaia-viewer will use your local engine, instead of the one on NPM
## Include in other projects

View file

@ -7,7 +7,7 @@ import Game from './components/Game.vue';
function launchSelfContained (selector = "#app", debug = true) {
const emitter = launch(selector, debug ? Wrapper : Game);
let engine = new Engine(["init 2 randomSeed2","p1 faction itars","p2 faction baltaks","itars build m 8B1","baltaks build m 4B1","baltaks build m 8B3","itars build m 4A1","baltaks booster booster1","itars booster booster3","itars build ts 4A1.","baltaks charge 1pw","baltaks spend 1gf for 1q. build ts 4B1.","itars charge 2pw"], {layout: 'xshape'});
let engine = new Engine(["init 2 randomSeed2"], {layout: 'xshape', advancedRules: true});
engine.generateAvailableCommandsIfNeeded();
const unsub = emitter.store.subscribeAction(({ payload, type }) => {