Skip to content

Fork RIMAPI mod and add write endpoints for agent control #1

@jkbennitt

Description

@jkbennitt

Problem

The upstream IlyaChichkov/RIMAPI mod exposes a read-only REST API on localhost:8765. RLE agents need to act — pause/unpause the game, assign jobs, draft colonists, place blueprints, set research targets. This requires forking the mod and adding write endpoints.

Required Write Endpoints (Core 8)

These are blocking for the turn-based game loop:

Endpoint Method Purpose
/game/pause POST Pause game (start of each tick)
/game/unpause POST Resume game (end of each tick)
/colonists/{id}/job POST Assign a colonist to a specific job
/colonists/{id}/draft POST Draft/undraft a colonist for combat
/colonists/{id}/priorities POST Set work type priorities
/blueprints POST Place a building blueprint
/designations/{id} DELETE Cancel a blueprint/designation
/research/target POST Set the active research project

Additional Endpoints (Full Coverage)

For all 16 agent action types to work:

Endpoint Method Purpose Agent
/colonists/{id}/move POST Move/reposition a colonist DefenseCommander
/colonists/{id}/haul POST Create a haul job ResourceManager
/zones/growing POST Create/modify growing zone ResourceManager
/power/toggle POST Toggle power on a building ResourceManager
/colonists/{id}/research POST Assign colonist as researcher ResearchDirector
/colonists/{id}/recreation POST Set recreation schedule SocialOverseer
/colonists/{id}/social POST Assign joy activity SocialOverseer
/colonists/{id}/bed-rest POST Assign to medical bed MedicalOfficer
/medical/administer POST Doctor tends patient MedicalOfficer

Technical Notes

  • The upstream mod uses a producer-consumer queue pattern: HTTP requests arrive on a background thread, get enqueued, and are processed on Unity's main thread via Update(). Write endpoints inherit this thread safety.
  • The Python side currently mocks all write responses in tests, so the C# fork can be developed in parallel.
  • The Python client (src/rle/rimapi/client.py) already has 7 stubbed write methods raising NotImplementedError — ready to wire up once the mod is forked.

Approach

  1. Fork IlyaChichkov/RIMAPI
  2. Add an RLE-specific controller with the endpoints above
  3. Use existing upstream services where possible (game speed, pawn edit, builder)
  4. Add new Harmony patches / RimWorld API calls for novel operations (research target, growing zones, medical)
  5. Test in-game with curl / Python test script

Related

@CalebisGross — wanted to discuss approach and priority on this. This is the main blocker before we can do live testing (Phase 6). The Python side works fully with mocks through Phase 5, so this can be developed in parallel. What are your thoughts on timeline and who should own the C# work?

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions