Skip to content

neuro-1977/BF6Portal-Tool

Repository files navigation

BF6Portal Tool

Version License

Changelog: see CHANGELOG.md. Release notes: docs/RELEASE_NOTES_1.3.0.md.

BF6Portal Tool is a standalone visual logic editor for Battlefield 6 Portal, built with Electron + Google Blockly. It aims to replicate the Portal Rules Editor workflow in a desktop app, with offline editing and quality-of-life tooling.

Screenshot

BF6Portal Tool UI overview

What the UI provides

  • Workspace editor (Blockly): build rule logic visually.
  • Toolbox search (header): quickly filter blocks by name.
  • Workspace controls (header): zoom in/out, reset zoom, zoom-to-fit, and trash/delete selected block.
  • Presets (header dropdown):
    • 3 built-in presets (locked)
    • save your own presets, overwrite safely, delete user presets
  • Import / Export:
    • load .json (Blockly workspace JSON) and legacy .xml
    • export Portal JSON (best-effort compatibility; imports into the official Portal editor for supported templates)
    • TypeScript snapshot export + TypeScript import (round-trip the workspace state)
  • Variables: a dedicated VARIABLES toolbox category with:
    • “New / Manage Variables”
    • pre-filled GET/SET templates for existing variables
  • Collections / Bookmarks: convert a selected stack into an offscreen definition and keep a compact call/bookmark block. Collections also appear in the COLLECTIONS toolbox category so you can drag them onto the canvas (similar to subroutine call blocks).
  • Navigation (“teleport”): right-click jump helpers (MOD / owning rule / stack root / variables / subroutine call ⇄ definition).
  • Help: Help modal (Block reference from bf6portal_blocks.json, Guides for getting started, Portal concepts, rules editor, variables, official Portal, related tools, terminal, template updates) and right-click per-block help.
  • Terminal: Drawer with shell and Ask about the app (type a question, click Ask — uses Gemini or your configured assistant; no TTY required). Optional: run “get the templates” to fetch latest preset rules from bfportal.gg.
  • Code Preview drawer: resizable bottom drawer that shows a TypeScript representation of the current workspace state.

Feature highlights

Presets

The presets dropdown includes 3 locked built-ins plus a simple user preset system (save / overwrite / delete) so you can snapshot and re-use setups.

Preset system dropdown

Variables

The VARIABLES toolbox category is designed to be “template-friendly”: it includes management buttons, quick GET/SET templates, and compatibility blocks used by community templates.

Variables toolbox category

Code preview drawer

The bottom drawer shows a TypeScript representation of your current workspace state, and can be resized so it doesn’t fight for screen space.

Resizable code preview drawer

Collapsible blocks

Large workspaces can get noisy quickly — collapsing blocks helps keep “library” definitions (subroutines/collections) compact and lets you focus on the active rule chain.

Collapsible blocks

Installation & setup

Prerequisites

  • Node.js (v18+ recommended)
  • Python 3.8+ (only needed for some helper scripts)

Getting started

  1. Clone:
git clone https://github.com/neuro-1977/BF6Portal-Tool.git
cd BF6Portal-Tool

Alternate mirror (GitLab):

git clone https://gitlab.com/Neuro1977/bf6-portal-tool.git
cd BF6Portal-Tool
  1. Install dependencies:
npm install
cd web_ui
npm install
cd ..
  1. Run the app:
npm start

Development

The project has two main parts:

  1. Electron main process: electron-main.js
  2. Renderer (Blockly editor): web_ui/ (TypeScript + webpack)

Rebuild the renderer

cd web_ui
npm run build

Build a Windows installer

npm run dist

The installer output is written to dist/.

Helper scripts

Utilities live in tools/ (used to generate/inspect blocks/toolboxes from Portal data). For fast codebase/docs search (e.g. for agents or terminal), use fastgrep: npm run search -- "<pattern>" [directory] [--max N] — uses ripgrep when available, else a Node fallback. See docs/DESIGN.md (§5).

Updating Andy6170 built-in presets

When andy6170 publishes new template packages (Rush, Conquest, Breakthrough) on bfportal.gg, the MEGA links can change. To update the built-in presets without manual URL copying:

  1. Install megatools (e.g. apt install megatools or use WSL on Windows).

  2. Run the sync script with --all so it fetches the three bfportal.gg experience pages, parses the current “Spatial editor map file and package” MEGA link and version for each, then downloads each zip, extracts only the Portal rules JSON, and cleans up:

    npm run sync:andy-templates -- --all

    If the MEGA links or versions change on bfportal.gg, the next --all run uses the new links and writes new filenames (e.g. custom_rush_V2.1.json). After that, update web_ui/src/presets.ts and web_ui/webpack.config.js if the version/filename changed, then rebuild.

    You can still sync a single template with an explicit URL and version:

    npm run sync:andy-templates -- --template rush --url "https://mega.nz/file/..." --version V2.0

See docs/DESIGN.md for the full flow.

Automatic block updates

Blocks and toolbox are generated from portal-docs. To refresh them locally:

npm run update:blocks

This runs, in order: download_resources.pyextract_selection_lists.pygenerate_full_blocks.pyupdate_blocks_db.pyfill_toolbox_gaps.py. In CI, a scheduled pipeline can run the same pipeline; if you set the BLOCK_UPDATE_GIT_PUSH_TOKEN CI variable (and create a schedule in GitLab), the job will commit and push changes when portal-docs has updates. See .gitlab-ci.yml (job block_updates) and docs/DESIGN.md.

Related tools and docs: In-app Help → Guides includes Related tools, Rules editor basics, Variables guide, Official Portal compatibility, Terminal & assistants, and Template updates. Use Ask about the app in the Terminal for quick answers about the UI and presets.

Credits

  • Block help/tooltips and Portal data are derived from Portal Docs by the Battlefield Portal Community:
  • The Battlefield Portal Community org hosts portal-docs (automated docs from portal.battlefield.com), PortalScriptingExamples, PortalSDK, and other tools. This editor uses portal-docs; new blocks added by the official Battlefield 6 Portal system are supported via placeholder block registration when importing templates—you can update bf6portal_blocks.json and regenerate blocks/toolbox to add first-class support for new block types.

GitHub topics

To make the repo easier to find on GitHub, add the recommended topics (e.g. battlefield-portal, blockly, electron) via Repo → About → Topics. See .github/TOPICS.md for the full list.

License

ISC