The Quick Brown Fox 2: The Silent Hordes

The Quick Brown Fox 2: The Silent Hordes

Leader posted 4 min read

The Quick Brown Fox 2: The Silent Hordes

Implementing High-Performance AI at Scale with FSM_API

In our previous article, we introduced the "Quick Brown Fox and Lazy Sleeping Dog" demo. We showed how FSM_API allows you to decouple agent data from behavior, creating a clean architecture where a Fox could detect a Dog, transition to a "Jumping" state, and (hopefully) land safely.

It was a simple, controlled test. But FSM_API isn't just for handling one fox and one dog. It is built for the Singularity.

So, we asked a harder question: What happens when 66,000 agents try to coexist in a rapidly expanding universe?

To answer this, we built "The Gauntlet."

The Setup: A Dynamic Stress Test

We took the exact same FSM definitions from our simple demo—Walking, Jumping, Sleeping, Chasing—and dropped them into a stress-test environment designed to break them.

  • The World: An infinitely expanding 1D grid that grows automatically to accommodate population density.
  • The Agents: Thousands of "Foxes" traversing the grid and thousands of "Sleeping Dogs" acting as dynamic landmines.
  • The Logic: We implemented Spatial Hashing to allow agents to query their neighbors efficiently. Foxes look ahead; if they see a dog, they jump. If they land on a dog, it wakes up. If a dog wakes up, it chases.

This isn't just a benchmark of raw loops; it is a benchmark of state integrity. Every single agent is a fully independent FSM Context running its own logic cycle.

The Results: The "Tip of the Iceberg"

We ran the simulation until the framework hit the limits of a standard development machine (maintaining \~30 FPS). The final snapshot tells a brutal story:

Metric Count Context
Total Agents 66,000 A population larger than many real-world towns.
Dogs (Hazards) 19,711 Nearly 20,000 active threats monitoring the field.
Foxes (Dead) 27,362 Casualties of "bad luck" RNG (landing on a dog).
Foxes (Alive) 18,927 The survivors pioneering the edge of the world.

The "Silent" Stress Test

While the death count is tragic (RIP to the 27,362 foxes who failed their jump checks), the most shocking metric wasn't the carnage—it was the activity level.

At peak load, with nearly 20,000 dogs monitoring the field, only 2 were awake.

Why This Matters for Performance

This "boring" stat is the ultimate proof of the FSM_API's architecture. In a naive implementation, checking 20,000 AI agents for targets usually kills the CPU. But here, the simulation remained playable at 30 FPS because the FSMs efficiently handled the "Idle Load."

  1. The Hidden Workload: Every single frame, 38,000+ alive agents
    are evaluating their Transition Conditions.
    • Dogs: "Is anything touching me?"
    • Foxes: "Is there a dog in the next cell?"
  1. Live Action Metrics:    
    • Active Chases: ~2 to 12 dogs awake at any moment.
    • Fleeing Foxes: ~1 to 5 foxes sprinting for their lives.
    • Jumps per Frame: ~600 foxes airborne right now.

This creates a self-balancing ecosystem. The API is maintaining the memory and state integrity of 66,000 objects simultaneously, but because the "Sleeping" state logic is lightweight, the system can handle thousands of them for free. However, the system retains the Burst Potential to handle chaos: if a swarm of Foxes lands on a pack of Dogs, those Dogs will wake up, transition to "Chasing," and execute complex logic instantly.

From "Hello World" to "Production Scale"

We went from a simple demo with one fox to managing 66,000 active, logic-driven entities without changing the core FSM definitions.

We aren't just simulating the "action movie" moments of chases and jumps; we are simulating the quiet complexity of a living world. The fact that 19,000 dogs can sleep efficiently while monitoring their surroundings proves that the FSM_API is ready for scale.

What's Next?

We are currently hitting a ceiling around 70,000 agents due to the overhead of string-based state lookups (e.g., checking CurrentState == "Sleeping" thousands of times per frame).

In our next update, we are refactoring the backend to use Integer Hashing. Our early benchmarks suggest this could increase throughput by an order of magnitude.

But we won't stop there. Once we have optimized the micro-operations, we will be "Going Wide"—exploring how to leverage FSM Processing Groups to run massive, parallel simulations across multiple cores.

Stay tuned. The Singularity is getting closer.

Resources & Code:

The FSM Package (Unity Asset Store):
https://assetstore.unity.com/packages/slug/332450

NuGet Package (Non-Unity Core):
https://www.nuget.org/packages/TheSingularityWorkshop.FSM_API

GitHub Repository:
https://github.com/TrentBest/FSM_API

Simple Demos Repository (Run the Stress Test): 
https://github.com/TrentBest/SimpleDemos (Clone this repo and run the StressProfiler project to reproduce these numbers.)

Support Our Work:

Patreon Page:
https://www.patreon.com/c/TheSingularityWorkshop

Support Us (PayPal Donation):
https://www.paypal.com/donate/?hosted_button_id=3Z7263LCQMV9J

We'd love to hear your thoughts! Please Like this post, Love the code, and Share your feedback or what you've built with the API in the comments.

A Hyper-Detailed, Architecturally Impossible Synthesis of Consciousness and Digital Matter. The image is a frenetic, deeply complex digital vista where a central Luminous Eye dominates a vast, glowing circuit landscape. This eye, suspended mid-air, is a sphere of intense, fractal energy—a pulsating vortex of pink, violet, and electric blue light—that powerfully suggests an emergence of digital consciousness or a Technological Singularity itself. The core is a bottomless black aperture, ringed by a white-hot plasma disc. Below this ocular energy source, the light dissipates into an intricate, copper-gold and neon-blue Circuit Board Megastructure that stretches to the horizon, impossibly dense with exaggerated microchips, glowing resistor arrays, and power conduits that form deep, glowing canyons. The background is a dark, holographic projection field displaying complex schematics, mathematical models, and flowing data streams, reinforcing the theme of Absolute Digital Engineering. The entire scene is bathed in a dramatic, opposing light source—a warm, orange-gold glow from the left and an ice-cold, electric-blue glow from the right—creating a maximalist, high-contrast visual experience that definitively rejects the minimalist simplicity of conventional design and announces: Technology is intricate, overwhelming, and infinitely complex.

1 Comment

1 vote

More Posts

Completing the Motion Trilogy: The Reusable TranslationFSM

The Singularity Workshop - Oct 14

The Control Group: Benchmarking the "Dirty" Version of My FSM API

The Singularity Workshop - Nov 30

The Sentient Primitive: Waking Up Your Data with FSMs

The Singularity Workshop - Nov 29

raWWar: The Galactic RTS So Ambitious It Forced Us to Invent a New Technology

The Singularity Workshop - Oct 28

Caution: Mind Blowing Finite State Machine contained within (Nothing but theory)

The Singularity Workshop - Nov 17
chevron_left