Skip to content

Banner-Saga-Factions/BSF-Custom-Server

Repository files navigation

Banner Saga Factions Custom Server

A project to reverse engineer and emulate the Banner Saga Factions offical game servers. Written in TypeScript


Work Flow

Data Sources

I use Fiddler Classic to capture game network data and then reference that to see what is sent between game server and client. I've uploaded captures (some partial, some complete) from 3 different matches to data/game_captures/.

It can also be useful to look at the client side code to see how the recieved data is handled to understand what its for and also to see where the data comes from that is sent to the server. The game client code can be viewed using JPEXS Free Flash Decompiler

And finally if you see nothing wrong on the server and no errors in network traffic it can be useful to check the client logs which, on Windows, are located in %AppData%/TheBannerSagaFactions\Local Store\logs with A-0.log.txt being the most recent session logs.

Setup

After cloning the repo, run npm i in the repository directory to install dependencies.

Testing

To start the server run npm run run. This will run the server with ts-node-dev which will automatically restart the server when you make changes.

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' --debug --server http:https://localhost:3000/ --username test,Pieloaf --factions --developer --steam_id 123456,293850 --steam true

Some More Launch Args:

Launch Arguments Params Explanation
--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
--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.

Banner Saga Factions Developer Overlay

Banner Saga Factions Developer Overlay

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 as @Pieloaf#1999

See development notes here


Task List

Game Functionality

  • Core Functionality
    • Pseudo Login System
      • placeholder until user database established
    • Global Chat
    • Queueing
    • Dequeuing 🔷
    • Matchmaking 🔷
      • It works enough to get into game but needs a lot of work see here
    • Battle
      • Ready Units
      • Deplot Units
      • Sync Clients
      • Handle Actions and Movement
      • Handle Match End 🔶
      • In Battle Chat 🔷
      • Handling Surrenders/Disconnects/Unusual behaviour ❓
      • Map Rotation 🔷
  • Other
    • Proving Grounds
      • Changing Party 🔷
      • Upgrading Units 🔷
    • Mead House
      • Purchasing New Units 🔷
    • Great Hall
      • Weekly Tournament 🔴
      • Friends Battles
        • This uses Steam's friends system so not sure what to do with this. Might be best just to leave it out as it is now, by just setting friend data to an empty array for all user accounts
    • Anticheat and Data Verification 💩
    • Login Client 🔴
  • Bonus
    • Map Selection 🔶
    • Local VS 🔶

Difficulty Estimates

Difficulty Estimate Icon
Easy 🔷
Medium 🔶
Hard 🔴
NO! 💩
Unkown

Auxiliary Tasks

In order of priority:

  • Database Stuff

    • Setting up databases for user accounts, battles, sessions, game units, tournaments, etc... There's a lot
  • Documentation

    • which I have not done very well so far...
  • 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.