Skip to content

Digital Fly v1.0

Pre-release
Pre-release

Choose a tag to compare

@WeiserFox WeiserFox released this 13 Sep 01:09
e519536

🪰 Digital Fly NextBot (BANC Connectome Driven)

An experimental Garry's Mod NextBot driven by a real-time spiking neural network simulation of the Drosophila melanogaster (fruit fly) BANC connectome dataset.

Instead of pre-scripted state machines, movement vector decisions are computed frame-by-frame by a standalone C# backend processing sensory raycasts and neuromodulatory stress feedback through a Leaky Integrate-and-Fire (LIF) network topology.


🏗️ Architecture Overview

  • GMod Entity (Lua): Casts 16 directional vision rays and tracks an octopamine/stress hormone level upon taking damage. Encodes this data into a 17-byte binary payload and streams it to the local backend.
  • Brain Backend (C# / .NET 8): Listens on http://127.0.0.1:9000/, parses sensory streams, propagates spikes across synapse matrices loaded from BANC/Princeton CSV datasets, and decodes population motor output into speed and turn direction bytes.

📋 Prerequisites

  • Garry's Mod (Client or Dedicated Server)
  • .NET 8.0 Runtime (Required only if running the FlyBrainBackend.exe release package without host installation)

🚀 Quick Start Guide

Step 1: Run the C# Brain Engine

  1. Download the latest release package (FlyBrainBackend_v1.0.zip) from the Releases section.
  2. Extract the archive into any directory. Ensure the following files remain together in the same folder:
    • FlyBrainBackend.exe
    • neurons.csv
    • connections_princeton.csv
  3. Launch FlyBrainBackend.exe. The console will display dataset loading metrics and begin listening on port 9000.

Step 2: Configure & Launch Garry's Mod

Garry's Mod blocks local loopback HTTP requests (127.0.0.1) by default for security reasons. You must pass the -allowlocalhttp launch flag for the entity to communicate with the C# backend.

For Garry's Mod Client (Singleplayer / Peer-to-Peer):

  1. Open your Steam Library and right-click Garry's Mod -> Properties.
  2. In the General tab, scroll down to Launch Options.
  3. Add the following flag:
    -allowlocalhttp
    

For Dedicated Server (srcds.exe):

If hosting a dedicated server, start your server instance with the -allowlocalhttp command-line argument:

srcds.exe -console -game garrysmod +map gm_construct -allowlocalhttp

🕹️ In-Game Usage

  1. Subscribe to the addon on Steam Workshop or place the lua/ folder in your server's garrysmod/addons/ directory.
  2. Join your server or start a local sandbox session.
  3. Open the Q-Menu -> Entities -> Digital Fly.
  4. Spawn the Digital Fly Nextbot.
  5. Check your server console for active connection logs:
    [BRAIN] MOVE=True MOTOR=0,040 L=0,047 R=0,066 C=0,000 SPEED=0,25 TURN=2,5 CONF=0,10 NOV=0,00 STRESS=0,00
    

📡 HTTP Protocol Specification

Communication between Lua and C# is strictly binary to maintain high throughput and minimize latency.

  • Endpoint: POST http://127.0.0.1:9000/
  • Content-Type: application/octet-stream

Request Payload (17 Bytes)

Byte Index Data Type Range Description
0 .. 15 uint8 0 – 255 Normalized raycast distance fractions (0 = obstacle ahead, 255 = clear sky)
16 uint8 0 – 255 Stress / Octopamine hormone level (triggered by OnTakeDamage)

Response Payload (2 Bytes)

Byte Index Data Type Description
0 uint8 Forward Speed: Scaled motor neuron activity
1 uint8 Yaw Rotation: Centered at 128 (<128 = turn left, >128 = turn right)

🛠️ Building from Source

The project is not finished yet so it is not public.