Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…nto Atmakuja_DB_Changes
  • Loading branch information
Red-Pyramid-Head committed Nov 17, 2023
2 parents f063e5b + 2931669 commit 7d6ed8d
Show file tree
Hide file tree
Showing 33 changed files with 3,096 additions and 1,096 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/docker_build_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Docker Build and Publish

on:
push:
branches:
- main
paths:
- src/**
- Dockerfile
- package.json
- tsconfig.json
- yarn.lock

pull_request:
types:
- opened
- synchronize
paths:
- src/**
- Dockerfile
- package.json
- tsconfig.json
- yarn.lock

workflow_dispatch:

jobs:
build_publish:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

# TODO: add docker meta data step for tagging and versioning

- name: Login to Docker registry
if: ${{ github.ref == 'refs/heads/main' }} # skip login if not main
uses: docker/login-action@v3
with:
registry: docker.pieloaf.com
username: ${{ vars.REGISTRY_PIELOAF_USER }}
password: ${{ secrets.REGISTRY_PIELOAF_PASSWD }}

- name: Dockerize and Push Image
uses: docker/build-push-action@v5
with:
push: ${{ github.ref == 'refs/heads/main' }} # only publish if main
platforms: linux/amd64
# TODO: tagged semver releases
tags: docker.pieloaf.com/bsf-server:latest
26 changes: 26 additions & 0 deletions .github/workflows/todo-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Create Issue on new TODO

on:
push:
branches:
- main
workflow_dispatch:
inputs:
MANUAL_COMMIT_REF:
description: "The SHA of the commit to get the diff for"
required: true
MANUAL_BASE_REF:
description: "By default, the commit entered above is compared to the one directly before it; to go back further, enter an earlier SHA here"
required: false
jobs:
build:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v3"
- name: "TODO to Issue"
uses: "alstr/todo-to-issue-action@master"
with:
IDENTIFIERS: '[{"name": "TODO", "labels": ["help wanted"]}, {"name": "FIXME", "labels": ["bug"]}]'
env:
MANUAL_COMMIT_REF: ${{ inputs.MANUAL_COMMIT_REF }}
MANUAL_BASE_REF: ${{ inputs.MANUAL_BASE_REF }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
node_modules
.env
package-lock.json
package-lock.json
*.code-workspace
build/
*.tar.gz
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
*.md
15 changes: 15 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"trailingComma": "es5",
"tabWidth": 4,
"semi": true,
"singleQuote": false,
"printWidth": 120,
"overrides": [
{
"files": "**/*.yml",
"options": {
"tabWidth": 2
}
}
]
}
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## build environment
FROM node:20-alpine as node_server
WORKDIR /src
# Copy entire project
COPY . .
# Install build dependencies
RUN yarn install --frozen-lockfile && yarn cache clean
# Build project
RUN yarn run build

# production environment
FROM node:20-alpine
ENV NODE_ENV=production
# Copy build output to working dir
WORKDIR /app
COPY --from=node_server /src/build ./
# HACK: THIS IS A WORKAROUND FOR MOCKED DATA
COPY --from=node_server /src/data ./data
# Copy required packages and app config
COPY --from=node_server /src/yarn.lock ./
COPY --from=node_server /src/package.json ./
RUN yarn install --frozen-lockfile --production && yarn cache clean
RUN printenv
CMD node ./index.js
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,21 @@ To start the server run `npm run run`. This will run the server with `ts-node-de
To test the game against the custom server:
Launch the game from the `win32` subdirectory of your banner saga factions directory (e.g. `F:\Steam\steamapps\common\the banner saga factions\win32`)

Run this command to launch the game: `& '.\The Banner Saga Factions.exe' --steam --factions --steam_id 293850,123456 --server http:https://localhost:3000 --username a,b`
Run this command to launch the game: `& '.\The Banner Saga Factions.exe' --debug --server http:https://localhost:3000/ --username test,Pieloaf --factions --developer --steam_id 123456,293850 --steam true`

Some Launch Args:
Some More Launch Args:

| Launch Arguments | Params | Explanation |
| ------------------- | ---------------------- |-------------|
| `--steam`| | Tells the game client to "use" steam even if steamworks isn't running (This is required to bypass some authentication checks)|
| `--steam`| `Boolean` | Tells the game client to "use" steam even if steamworks isn't running (This is required to bypass some authentication checks)|
| `--factions`| | Should tell the game to launch into factions and not go to a weird menu although doesn't always work |
|`--stead_id`| Array<steam_id> | Overrides default steam id. Required to run game without steam. Note: Passing two comma separated steam_ids creates two game clients in the same window; very useful for testing. **Must have a matching number of user names.**
|`--username`| Array<user_name> | Required for loading multiple clients in a single window. Comma separated. |
|`--steam_id`| `Array<steam_id>` | Overrides default steam id. Required to run game without steam. Note: Passing two comma separated steam_ids creates two game clients in the same window; very useful for testing. **Must have a matching number of user names.**
|`--username`| `Array<user_name>` | Required for loading multiple clients in a single window. Comma separated. |
|`--server`| Server URL | Used to point the game client to a different game server |
|`--developer`||Enable a developer overlay menu. (Doesn't work when playing on official servers.) |
|`--debug`||Enables debug logging (more verbose than default logging) |
|`--versus_start`||Launches game directly into matchmaking queue. Helps to speed to up testing and avoids clicking through menus
|`--versus_countdown`| `Integer` | Determines match launch countdown duration. Set to 0 to skip match intro timer.

There are many more launch arguments althought these are the ones required to use custom servers, bypass steam checks and open multiple game clients for testing. I may document the rest of the options at a later date.

Expand All @@ -44,12 +47,13 @@ There are many more launch arguments althought these are the ones required to us

If anyone would like to contribute feel free to make a PR with your contribution and can update this README marking off what you did or tagging it as work in progress **[WIP]** if not complete. Any help would be greatly appreciated. You can find me on Discord in the [Banner Saga Discord Server](https://discord.gg/Jf3FNpV8gv) as `@Pieloaf#1999`

See development notes [here](src/README.md)
See development notes [here](docs/README.md)

---
## Task List
<details>
<summary>Game Functionality</summary>

Game Functionality


- [ ] Core Functionality
- [x] Pseudo Login System
Expand All @@ -62,10 +66,10 @@ See development notes [here](src/README.md)
- [ ] Battle
- [x] Ready Units
- [x] Deplot Units
- [ ] Sync Clients :large_orange_diamond: **[WIP - Pieloaf]**
- [ ] Handle Actions and Movement :large_orange_diamond: **[WIP - Pieloaf]**
- [x] Sync Clients
- [x] Handle Actions and Movement
- [ ] Handle Match End :large_orange_diamond:
- [ ] In Battle Chat :large_blue_diamond:
- [x] In Battle Chat :large_blue_diamond:
- [ ] Handling Surrenders/Disconnects/Unusual behaviour :question:
- [ ] Map Rotation :large_blue_diamond:
- [ ] Other
Expand Down Expand Up @@ -96,10 +100,7 @@ See development notes [here](src/README.md)
| NO! | :shit: |
| Unkown | :question: |

</details>

<details>
<summary>Auxiliary Tasks</summary>
Auxiliary Tasks

In order of priority:

Expand All @@ -112,6 +113,5 @@ See development notes [here](src/README.md)
- Data Handling Refactoring
- This was not thought about very well before starting and as a result some of the data sharing between modules could use some refactoring and clean up.

</details>


4 changes: 2 additions & 2 deletions data/accounts.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[
{
"username": "test",
"user_id": "123456"
"user_id": 123456
},
{
"username": "Pieloaf",
"user_id": "293850"
"user_id": 293850
}
]
12 changes: 12 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Development Notes

## Overview of Client <-> Server Data Flow

The client communicates with the server over HTTP(S). All request URLs end with the clients session key with the exception of the login and steam overlay requests. When the client has data to send to the server, it makes a POST request to a given route, in most cases the server responds with status 200 and no data however there are some exceptions, such as posting to the leaderboards route. To receive data which is not returned after making a POST request the client makes GET requests to the server every 2 seconds. If the server has new data for the client it is returned in the response otherwise the server responds with status 200 and no data. All data returned from the server is JSON formatted. All data sent to the server is JSON formatted with the exception of the location update and chat message send requests, these are plaintext strings.

Detailed Information:
1. [Game Flow](gameFlow.md)
2. [Data Structures](dataStructures.md)
3. [Server Endpoints](serverEndpoints.md)
4. [Other Notes](notes.md)

Loading

0 comments on commit 7d6ed8d

Please sign in to comment.