@corsaircoalition/strategy-sentinel
Advanced tools
Comparing version 1.0.1 to 1.2.0
@@ -0,7 +1,13 @@ | ||
var _a; | ||
import { GameState, Log, Redis, hashUserId } from '@corsaircoalition/common'; | ||
import EventEmitter from 'node:events'; | ||
export class App { | ||
static botId; | ||
static gameState; | ||
recommendationEmitter = new EventEmitter(); | ||
constructor() { | ||
Object.defineProperty(this, "recommendationEmitter", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: new EventEmitter() | ||
}); | ||
} | ||
static initialize(gameConfig, redisConfig) { | ||
@@ -13,3 +19,9 @@ Redis.initilize(redisConfig); | ||
} | ||
static handleRecommendations = (data) => { | ||
} | ||
_a = App; | ||
Object.defineProperty(App, "handleRecommendations", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: (data) => { | ||
if (App.gameState.gamePhase !== "playing") { | ||
@@ -24,8 +36,13 @@ Log.stderr(`[recommendation] not in game`); | ||
App.gameState.emit('action', data); | ||
}; | ||
static quit = async () => { | ||
} | ||
}); | ||
Object.defineProperty(App, "quit", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: async () => { | ||
Log.stdout('Closing Redis connection...'); | ||
return Redis.quit(); | ||
}; | ||
} | ||
} | ||
}); | ||
//# sourceMappingURL=app.js.map |
{ | ||
"name": "@corsaircoalition/strategy-sentinel", | ||
"version": "1.0.1", | ||
"version": "1.2.0", | ||
"description": "bot component that analyzes game state and selects actions", | ||
@@ -8,10 +8,9 @@ "main": "out/index.js", | ||
"dependencies": { | ||
"@corsaircoalition/common": "^1.0.4", | ||
"@redis/client": "^1.5.8", | ||
"@corsaircoalition/common": "^1.3.2", | ||
"commander": "^10.0.1" | ||
}, | ||
"devDependencies": { | ||
"@sindresorhus/tsconfig": "^3.0.1", | ||
"@types/node": "^18.16.16", | ||
"typescript": "^5.1.3" | ||
"@sindresorhus/tsconfig": "^4.0.0", | ||
"@types/node": "^20.4.10", | ||
"typescript": "^5.1.6" | ||
}, | ||
@@ -45,3 +44,3 @@ "bin": "./out/index.js", | ||
"license": "Apache-2.0", | ||
"homepage": "https://github.com/CorsairCoalition/docs#readme" | ||
"homepage": "https://corsaircoalition.github.io/" | ||
} |
# Strategy Sentinel | ||
This strategy module receives action recommendations from [Armada Assault](https://github.com/CorsairCoalition/ArmadaAssault), selects the best sequence of actions based on the current state of the game, and relays those to the [Sergeant Socket](https://github.com/CorsairCoalition/SergeantSocket) to relay to the game server. | ||
[Generally Genius](https://corsaircoalition.github.io/) (GG) is a modular generals.io bot framework for development and analysis of game strategies and actions. [CorsairCoalition](https://corsaircoalition.github.io/) is a collection of components that form the GG framework. | ||
## Installation | ||
Strategy Sentinel receives action recommendations from [Armada Assault](https://github.com/CorsairCoalition/ArmadaAssault), and in an ideal situation, selects the best sequence of actions based on the current state of the game, and relays those to the [Sergeant Socket](https://github.com/CorsairCoalition/SergeantSocket) to send to the game server. In the current implementation, it relays **all** recommended actions to the game server, which makes the bot very erratic. Correct implementation of the strategy module is left as an exercise for the reader. | ||
## Configuration | ||
Download `config.example.json` from the [documentation repository](https://github.com/CorsairCoalition/docs) and make desired changes. | ||
To setup other components, see the [detailed instructions](https://corsaircoalition.github.io/setup/) on the [project website](https://corsaircoalition.github.io/). | ||
## Execution | ||
Install and run the executable: | ||
```sh | ||
$ npm install -g @corsaircoalition/strategy-sentinel | ||
$ strategy-sentinel ... | ||
npm install -g @corsaircoalition/strategy-sentinel | ||
strategy-sentinel config.json | ||
``` | ||
or run directly from npmjs library: | ||
or run directly from npm library: | ||
```sh | ||
npx @corsaircoalition/strategy-sentinel config.json | ||
``` | ||
$ npx @corsaircoalition/strategy-sentinel | ||
``` | ||
## Configuration | ||
or use docker: | ||
Copy [`config.json.example`](https://github.com/CorsairCoalition/docs/blob/main/config.json.example) to `config.json` and make desired changes. | ||
```sh | ||
docker run -it -v ./config.json:/config.json ghcr.io/corsaircoalition/strategysentinel:latest | ||
``` | ||
@@ -27,3 +38,3 @@ ## Usage | ||
``` | ||
Usage: strategy-sentinel [options] <configFile> | ||
Usage: @corsaircoalition/strategy-sentinel [options] <configFile> | ||
@@ -33,11 +44,5 @@ bot component that analyzes game state and selects actions | ||
Options: | ||
-V, --version output the version number | ||
-d, --debug enable debugging (default: false) | ||
-h, --help display help for command | ||
-V, --version output the version number | ||
-d, --debug enable debugging (default: false) | ||
-h, --help display help for command | ||
``` | ||
## Example | ||
``` | ||
strategy-sentinel config.json | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20669
2
99
47
- Removed@redis/client@^1.5.8