Tooling to simplify BF6 Portal custom experiences (modding). Portal APIs themselves are property of EA.
-
Obtain your Portal session ID from https://portal.battlefield.com/. Set it via one of:
Option A: Create a
.envfileBF_PORTAL_SESSION_ID=your-session-idOption B: Export as environment variable
export BF_PORTAL_SESSION_ID=your-session-id -
Create a
ts-bf6-portal.config.jsonconfiguration file -
Deploy with:
npx ts-bf6-deploy [--config <path>] [--strings <path>]
Create ts-bf6-portal.config.json in your project:
{
"id": "your-experience-uuid",
"name": "Experience Name",
"description": "Optional description",
"published": false,
"script": {
"file": "src/index.ts"
},
"maps": [
{
"map": "MP_Battery",
"teams": [32, 32],
"balancing": "skill",
"rules": [
{ "name": "FriendlyFireDamageReflectionEnabled", "value": false }
]
}
],
"rotation": "loop"
}id- Experience UUID (required for deployment)name- Experience name (required)description- Experience description (optional)published- Boolean, set to true to publish (optional, defaults to false)script- TypeScript code:file: Path to TypeScript filecodeorinline: Inline code string
bundle- Alternative toscript, bundles an entry point:entry: Entry file pathoutFile: Output path (optional, defaults todest/portal-bundle.ts)tsconfig: Path to tsconfig.json (optional)
maps- Array of map configurations:map: Map code (e.g.,MP_Battery,MP_Dumbo)teams: Array of team sizes (e.g.,[32, 32])rounds: Number of rounds (default: 1)balancing:none,skill, orsquad(default:skill)bots: Bot configuration withteam,count,type(fillorfixed)rules: Mutator rules withnameandvaluejoinability: Join settings (joinInProgress,openJoin,invites)matchmaking: Boolean (default: false)spatial: Spatial data from file or inline
globalRules- Experience-wide mutators (optional)restrictions- Asset restrictions (weapons, vehicles, etc.) (optional)rotation- Map rotation:loop,shuffle, oronce(default:loop)strings- Localization strings:file: Path to strings JSON filedata: Inline strings object
The bundler compiles TypeScript entry points into deployable scripts:
npx ts-portal-bundle --entry src/index.ts --out dist/bundle.ts [--tsconfig tsconfig.json]Or configure in ts-bf6-portal.config.json:
{
"bundle": {
"entry": "src/index.ts",
"outFile": "dist/portal-bundle.ts",
"tsconfig": "tsconfig.json"
}
}Bundle localization strings via:
npx ts-bf6-deploy --strings dist/strings.jsonThe --strings flag loads a JSON file and attaches it to the experience. Use --no-strings to skip automatic loading.
npx ts-bf6-list-mutatorsReturns all mutators available in the Portal, with their names and valid value ranges. Use these names in the rules field of your config.
npx ts-bf6-list-asset-categoriesReturns asset categories (weapons, vehicles, gadgets, etc.) for use in the restrictions field.
npx ts-bf6-deploy [options]Options:
--config <path>- Path to config file (default:ts-bf6-portal.config.json)--env-file <path>- Path to .env file (default:.envif present)--strings <path>- Attach Strings.json file--no-strings- Disable automatic strings loading