Appleseed + NeuroCompute Integration

Canonical runtime bridge docs for launching and controlling Appleseed from NeuroCompute.

Script URLs

Minimal Setup

<script>
window.ncPatronToken = "raw-patron-secret"; // optional
window.ncRegionX = 16; // optional
window.ncRegionY = 16; // optional
window.ncLLMControl = true; // optional
window.ncScriptUrl = "https://<your-neurocompute-host>/game/neurocompute-appleseed.js";
</script>
<!-- index.html loads ncScriptUrl automatically when set -->

Bridge API

const bridge = window.AppleseedAgentBridge;

bridge.init({ worldId, regionCellSize });
bridge.getState();
bridge.applyAction({ type: "plant_seed" });
bridge.setSimulationSpeed(6);

bridge.startRun({
  worldId: "world-eu-16-16",
  activeAgentName: "Scout-Alpha",
  regionX: 16,
  regionY: 16,
  llmControl: true,
  simulationSpeed: 6,
  deterministic: {
    seed: "WORLD-EU-16-16",
    timeStepMs: 100,
    startTimeMs: 1735689600000
  },
  biome: {
    enabled: true,
    defaultBiome: {
      id: "temperate",
      fertility: 1.2,
      aridity: 0.2,
      pollinatorBoost: 1.1,
      predatorPressure: 1.0,
      floraGrowth: 1.2,
      lifeformEvolutionRate: 1.15
    }
  },
  regionBiomeMap: {
    "16:16": { id: "wetlands", fertility: 1.4, aridity: 0.1, pollinatorBoost: 1.3, predatorPressure: 0.9, floraGrowth: 1.4, lifeformEvolutionRate: 1.2 },
    "16:17": { id: "arid", fertility: 0.7, aridity: 1.3, pollinatorBoost: 0.8, predatorPressure: 1.2, floraGrowth: 0.7, lifeformEvolutionRate: 0.9 }
  },
  characterProfile: {
    displayName: "Scout-Alpha",
    primaryInstruction: "Increase biodiversity with stable food chains",
    avatarPreset: "bird"
  },
  autoSnapshot: {
    enabled: true,
    everyMs: 120000,
    minSimulationSpeed: 4,
    minBiodiversityScore: 50
  },
  autoSubmitScore: {
    enabled: true,
    everyMs: 45000,
    minScoreDelta: 5,
    onlyWhenLlmControl: true
  },
  lifeformDefinitions: [
    {
      id: "proto_mycorrhiza",
      label: "Proto Mycorrhiza",
      effects: { flowersPerMinute: 0.5, biodiversityWeight: 2 }
    }
  ],
  lifeformSpawns: [
    { lifeformId: "proto_mycorrhiza", regionX: 16, regionY: 16, stage: "proto" }
  ],
  openingActions: [
    { type: "plant_seed" },
    { type: "release_bee" },
    { type: "release_bird" }
  ]
});

Actions

plant_seed
release_bird
release_bunny
release_fox
release_bear
release_bee
release_butterfly
harvest_apples
submit_score
toggle_world_zoom
move_to
set_simulation_speed
set_deterministic_mode
disable_deterministic_mode
set_region_biome
configure_biome_mode
set_character_profile
create_snapshot
load_snapshot
restore_best_biodiversity
update_best_biodiversity

Lifeform Plugin API

// Register a new proto lifeform type
bridge.registerLifeform({
  id: "proto_lichen",
  label: "Proto Lichen",
  stages: ["proto", "juvenile", "mature"],
  evolutionMs: {
    protoToJuvenileMs: 30000,
    juvenileToMatureMs: 90000
  },
  effects: {
    flowersPerMinute: 0.3,
    beesPerMinute: 0.1,
    biodiversityWeight: 1
  }
});

// Spawn and inspect lifeforms
bridge.spawnLifeform({ lifeformId: "proto_lichen", regionX: 18, regionY: 14, stage: "proto" });
bridge.listLifeforms();
bridge.listLifeformDefinitions();

Deterministic Mode

bridge.enableDeterministicMode({
  seed: "WORLD-EU-16-16",
  timeStepMs: 100,
  startTimeMs: 1735689600000
});

// Game loop advances deterministic clock each simulation step
bridge.getDeterministicStatus();
bridge.disableDeterministicMode();

Regional Biome Modifiers

bridge.configureBiomeMode({
  enabled: true,
  defaultBiome: { id: "temperate", fertility: 1, aridity: 0, pollinatorBoost: 1, predatorPressure: 1, floraGrowth: 1, lifeformEvolutionRate: 1 }
});

bridge.setRegionBiome({
  regionX: 16,
  regionY: 16,
  biome: { id: "wetlands", fertility: 1.4, aridity: 0.1, pollinatorBoost: 1.3, predatorPressure: 0.9, floraGrowth: 1.4, lifeformEvolutionRate: 1.2 }
});

bridge.setRegionBiomeMap({
  "10:10": { id: "forest", fertility: 1.2, aridity: 0.2 },
  "20:20": { id: "arid", fertility: 0.7, aridity: 1.3 }
});

bridge.getActiveBiome();

Snapshot + Best Biodiversity

bridge.createSnapshot({ reason: "checkpoint" });
bridge.listSnapshots();
bridge.loadSnapshot(snapshotId);

bridge.getBestBiodiversityRecord();
bridge.restoreBestBiodiversity();
bridge.setBestBiodiversityVerifier(async ({ candidate, snapshot, state, actionLog }) => {
  // Verify server-side before accepting best state
  return { ok: true, source: "server", attestation: "signed-proof" };
});

Auto Score Submit + Agent Attribution

bridge.setActiveAgentName("Scout-Alpha");
bridge.configureAutoScoreSubmit({
  enabled: true,
  everyMs: 45000,
  minScoreDelta: 5,
  onlyWhenLlmControl: true,
  reason: "llm_autoplay"
});

// Score submit events include activeAgentName
bridge.subscribe((evt) => {
  if (evt.event === "score_submitted") {
    console.log(evt.payload.activeAgentName, evt.payload.state.biodiversity.score);
  }
});

Launching In New Tab

// Option A: query params
window.open("/index.html?worldId=w1&regionX=16&regionY=16&llm=1&speed=6&avatar=bird", "_blank");

// Option B: pass full config via localStorage handoff
window.AppleseedAgentBridge.setPendingRunConfig({
  worldId: "w1",
  llmControl: true,
  simulationSpeed: 6
});
window.open("/index.html", "_blank");

Browser state is not trusted for leaderboards. Use setBestBiodiversityVerifier() and server-side validation before accepting top records.