BacFighT6: Simulation of T6SS-mediated Bacterial Interactions

Version: 10.0 (27.6.2026)

Developed by: Marek Basler (University of Basel, Biozentrum) with assistance from Gemini 2.5 - 3.5.

Inspired by:

Reviews on various aspects of the Type VI Secretion System:

1. Overview

This simulation models the dynamic interactions between up to three distinct bacterial cell types—Attackers, Prey, and Defenders—within a shared environment. The primary mechanism of interaction is the Type VI Secretion System (T6SS), a sophisticated molecular weapon that bacteria use to inject toxins into neighboring cells upon direct contact. Additionally, Prey cells are not entirely defenseless; they can produce and release their own bacteriocin toxins into the environment, allowing them to kill or inhibit rival Attackers and Defenders.

Cells inhabit a two-dimensional hexagonal grid and compete for space. The simulation progresses in discrete time steps, where each step typically represents one minute of real time. During each step, cells can undergo several actions:

The simulation allows users to configure a vast array of parameters, offering a flexible platform to explore complex ecological dynamics, the evolution of T6SS strategies, and the outcomes of bacterial warfare under different conditions. It is inspired by numerous experimental findings and theoretical models in microbial ecology and T6SS research. 🎮 Click here to launch "Battle Royale" demo

2. Getting Started & User Interface

The simulation interface consists of four main parts:

Basic Workflow:

3. The Simulation Arena

The arena is a hexagonal grid. Each hexagon represents a potential space a single bacterium can occupy.

4. Visualizations

The simulation provides real-time visual feedback:

5. Simulation Controls & Settings Detailed

5.1. Setup Arena (Panel)

5.2. Simulation Control (Panel)

This panel features the main simulation parameters as well as advanced controls for reproducibility.

5.3. Main Control Buttons

5.4. Time-Travel Control (Panel)

5.5. General Settings (Panel)

5.6. Exports & Buffers (Panel)

5.7. CPRG Reporter Settings

5.8. Cell-Specific Settings (Panel)

This section of the control panel is tabbed for Attacker, Prey, and Defender types. Each tab contains parameters unique to that cell's behavior.

Common Properties (Across Tabs)

1. Attacker Tab

2. Prey Tab

3. Defender Tab

6. Cell Types & Detailed Mechanics ("Under the Hood")

Each cell in the simulation is an object with properties tracking its state and behavior.

6.1. General Cell Properties & Processes

Cell Movement

For each of the three cell types (Attacker, Prey, Defender), you can define their movement behavior using the following parameters, found in their respective "Cell-Specific Settings" sections under "Movement Behavior":

General Movement Rules:

State Synchronization & Reproducibility

For a simulation to be perfectly reproducible, two conditions must be met:

6.2. Attacker Cells

6.3. Prey Cells

6.4. Defender Cells

6.5. Barriers

7. Simulation Loop / Step Logic (runSimulationStep)

Each simulation step (representing one minute) executes the following sequence of events:

8. CPRG Reporter System Details

The CPRG reporter system simulates a common laboratory assay.

9. Preset Scenarios

The "Load Preset Scenario" button opens an interactive modal presenting several pre-configured simulation layouts.

The available preset scenarios are:

Applying a preset will only override the specific settings relevant to that scenario, leaving all other parameters (like Arena Radius or any settings you have manually changed) untouched. You can use the "Reset Settings to Defaults" button if you wish to return to a baseline state before applying a preset. You can further tweak any settings after applying a preset.

10. Data Export & Import

The simulation provides robust options for data management:

When full state history is enabled, you can retroactively generate high-resolution PNG image sequences for any specific window of past time steps without re-running the live environment: * Custom Range Bounds & Rates: Input target values into the "From:" and "To:" step fields to isolate specific milestones. You can also specify a "Rate" to sample frames at regular intervals (e.g., setting Rate to 100 will render steps 5, 105, 205, etc.), which is useful for generating timelapses of very long simulations without rendering thousands of images. The final step in your range is always included. * Low-Memory Batch Generation: The engine sequentially loads frames out of IndexedDB, captures an offscreen canvas rendering, and pipes the output into memory-safe, chunked ZIP archives compiled via JSZip. * Dynamic Cancellation: Clicking the "Stop & Save Rendered" button instantly terminates active rendering loops, safely packages all frames processed up to that exact millisecond into a valid ZIP archive, and restores the live control interface.

#### Advanced Memory Management (IndexedDB Database Offloading)


Saving per-step data is memory-intensive. To prevent browser crashes during very long runs, the simulation includes buffer limits for images, arena states, and history, which can be configured in the "Exports & Buffers" panel.

To simplify high-frequency data logging, the application takes advantage of modern browser File System Access APIs:

10.1 Configuring Simulation via URL Parameters (Advanced)

You can pre-configure many aspects of the "BacFighT6" simulation by adding parameters directly to the browser's URL (the web address displayed in your browser, e.g., https://baslerlab.github.io/BacFighT6/index.html). This is a powerful feature for saving specific setups, sharing them with collaborators, or scripting different starting conditions for experiments.

How it Works:

🚀 Pro Tip: You don't need to write these URLs manually! Configure the simulation exactly how you want it in the UI, then click the "Copy Shareable Link 🔗" button in the General Settings panel. This will automatically generate the optimized URL for you.

Available Parameter Types:

Combined Examples:

Understanding Order and Arena State Interactions:

The sequence of these parameters in your URL dictates the final setup.

Important General Notes for URL Configuration:

11. Technical Notes & Considerations

License and Attribution

This work (BacFighT6: Simulation of T6SS-mediated Bacterial Interactions), available at GitHub, is licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).

Copyright (c) 2025 Marek Basler

You are free to:

The licensor cannot revoke these freedoms as long as you follow the license terms.

Under the following terms:

For the full license text, please visit: https://creativecommons.org/licenses/by/4.0/

Support

Development of BacFighT6 runs on coffee! If you find it useful, please consider a small donation. Thank you!