Purpose: Machine-readable documentation for AI agents, bots, and automated systems interacting with Structs.
Format: All documentation is structured for AI consumption - JSON schemas, structured data, clear patterns.
In the distant future the species of the galaxy are embroiled in a race for Alpha Matter, the rare and dangerous substance that fuels galactic civilization. Players take command of Structs, a race of sentient machines, and must forge alliances, conquer enemies and expand their influence to control Alpha Matter and the fate of the galaxy.
ai/
├── README.md # This file
├── AGENTS.md # 🤖 AI Agent Guide: Comprehensive guide for AI agents
├── LOADING_STRATEGY.md # 🔴 READ FIRST: How to efficiently load documentation
├── DOCUMENTATION_INDEX.md # 📚 Complete documentation index
├── IMPLEMENTATION_CHECKLIST.md # ✅ Step-by-step implementation checklist
├── BEST_PRACTICES.md # ⭐ Best practices summary
├── schemas/ # Data structure definitions
│ ├── game-state.json # Complete game state schema (reference)
│ ├── minimal/ # ✅ Minimal schemas for simple operations
│ │ ├── player-essential.json
│ │ ├── planet-essential.json
│ │ └── struct-essential.json
│ ├── entities/ # ✅ Individual entity schemas (split for efficiency)
│ │ ├── player.json
│ │ ├── planet.json
│ │ ├── struct.json
│ │ └── ... (9 entity files)
│ ├── entities.json # Entity metadata and relationships
│ ├── actions.json # Action/command definitions
│ ├── gameplay.json # Gameplay mechanics schema
│ ├── responses.json # API response schemas
│ └── errors.json # Error code definitions
├── api/ # API specifications
│ ├── endpoints.yaml # Complete endpoint catalog (reference)
│ ├── queries/ # ✅ Individual query endpoint files (split for efficiency)
│ │ ├── player.yaml
│ │ ├── planet.yaml
│ │ └── ... (13 query files)
│ ├── transactions/ # ✅ Transaction endpoint files
│ │ └── submit-transaction.yaml
│ └── streaming/ # GRASS streaming protocol
├── protocols/ # Communication protocols
│ ├── query-protocol.md # How to query game state
│ ├── action-protocol.md # How to perform actions
│ ├── gameplay-protocol.md # How to interact with gameplay mechanics
│ ├── error-handling.md # Error handling patterns
│ └── authentication.md # Authentication patterns
├── patterns/ # Common patterns and best practices
│ ├── README.md # Pattern documentation index
│ ├── QUICK_REFERENCE.md # Quick pattern lookup guide
│ ├── pagination.md # Pagination patterns
│ ├── rate-limiting.md # Rate limiting strategies
│ ├── caching.md # Caching strategies
│ ├── polling-vs-streaming.md # When to use each
│ ├── retry-strategies.md # Retry logic patterns
│ ├── workflow-patterns.md # Multi-step workflow patterns
│ ├── security.md # Security best practices
│ ├── state-sync.md # Keeping state synchronized
│ └── gameplay-strategies.md # Gameplay strategy patterns
├── examples/ # Working examples
│ ├── simple-bot.json # Simple bot implementation
│ ├── state-monitor.json # State monitoring example
│ ├── action-executor.json # Action execution example
│ ├── gameplay-mining-bot.json # Mining bot example
│ ├── gameplay-combat-bot.json # Combat bot example
│ ├── workflows/ # Workflow examples
│ │ ├── README.md # Workflow examples index
│ │ └── *.json # Individual workflow examples
│ ├── errors/ # Error examples
│ └── auth/ # Authentication examples
└── reference/ # Quick reference
├── endpoint-index.json # All endpoints indexed
├── entity-index.json # All entities indexed
├── action-index.json # All actions indexed
├── api-quick-reference.md # API quick reference guide
└── action-quick-reference.md # Action quick reference guide
├── visuals/ # Visual content (graphs, spatial data)
├── README.md # Visual content overview
├── schemas/ # Visual schema definitions (7 schemas)
├── graphs/ # Machine-readable graph data (4 graphs)
├── spatial/ # Spatial/geometric data
└── reference/ # Visual content index
- JSON Schemas: All data structures defined in JSON Schema format
- YAML for APIs: API specifications in YAML for readability
- Structured Markdown: Markdown with clear structure and machine-parseable sections
- Code Examples: All examples in JSON format (not code snippets)
- Schemas:
{entity}.json(e.g.,player.json,planet.json) - Protocols:
{protocol-name}.md(e.g.,query-protocol.md) - Examples:
{use-case}.json(e.g.,simple-bot.json)
- All schemas include
$schemaandversionfields - Protocol versions tracked in protocol files
- Breaking changes documented in
CHANGELOG.md
- Read
AGENTS.mdfirst - Comprehensive guide for AI agents working with Structs - Covers: Core concepts, workflows, best practices, error handling, performance optimization
- Customizable: Designed as a starting point that can be adapted for your project
- Read
LOADING_STRATEGY.md- Learn how to efficiently load documentation - Start with minimal load - Use indexes and minimal schemas
- Load incrementally - Only load what you need for your task
- Read
schemas/game-state.jsonfor complete state structure - Read
schemas/entities.jsonfor entity definitions - Read
schemas/economics.jsonfor economic entities and formulas
- Read
protocols/query-protocol.mdfor query patterns - For entity queries: Use
api/queries/{entity}.yaml(30-60 lines each) - For all queries: See
api/endpoints.yaml(1180 lines - reference only) - Review
reference/endpoint-index.jsonto find endpoints
- Read
protocols/action-protocol.mdfor action patterns - Read
protocols/economic-protocol.mdfor economic operations - Review
api/transactions/submit-transaction.yaml(andapi/transactions/README.md) for transaction examples
- Read
protocols/error-handling.mdfor error patterns - Review
schemas/errors.jsonfor error codes
- Read
schemas/gameplay.jsonfor gameplay mechanics - Read
protocols/gameplay-protocol.mdfor gameplay interactions - Review
examples/gameplay-mining-bot.jsonfor mining workflows - Review
examples/gameplay-combat-bot.jsonfor combat workflows
- Read
patterns/state-sync.mdfor state synchronization - Read
patterns/polling-vs-streaming.mdfor real-time updates - Read
patterns/gameplay-strategies.mdfor gameplay optimization - Read
patterns/caching.mdfor response caching - Read
patterns/rate-limiting.mdfor rate limit handling - Read
patterns/retry-strategies.mdfor retry logic
- Read
schemas/economics.jsonfor economic entities and formulas - Read
protocols/economic-protocol.mdfor economic operation patterns - Review
examples/economic-bot.jsonfor economic bot implementation
- Read
patterns/security.mdfor security best practices - Read
patterns/workflow-patterns.mdfor multi-step operations - Review
patterns/QUICK_REFERENCE.mdfor pattern selection - Review
reference/api-quick-reference.mdfor API quick reference - Review
reference/action-quick-reference.mdfor action quick reference
Object IDs in Structs follow the format #-# where:
- First number: Object type identifier (0-11)
- Second number: Object index (1-based)
Object Type Identifiers:
0= Guild1= Player2= Planet3= Reactor4= Substation5= Struct6= Allocation7= Infusion8= Address9= Fleet10= Provider11= Agreement
Examples:
0-1= First guild (guild type 0, index 1)1-11= Eleventh player (player type 1, index 11)2-1= First planet (planet type 2, index 1)4-3= Third substation (substation type 4, index 3)
Exception: struct_types use regular integer IDs (e.g., 1, 2, 3) without the #-# format.
When using IDs in API requests or schemas, always use the #-# format for entity IDs.
All schemas use JSON Schema Draft 7 with Structs-specific extensions:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"version": "1.0.0",
"structs:entity": "Player",
"structs:category": "core",
"structs:endpoint": "/structs/player/{id}",
"description": "Player entity definition",
"type": "object",
"properties": {
"id": {
"type": "string",
"structs:format": "entity-id",
"pattern": "^[0-9]+-[0-9]+$",
"description": "Unique player identifier in format 'type-index' (e.g., '1-11' for player type 1, index 11)"
}
}
}structs:entity: Entity type namestructs:category: Entity category (core, resource, economic, etc.)structs:endpoint: Primary API endpointstructs:format: Data format specification (use "entity-id" for#-#format IDs)structs:required-for: What this entity is required forstructs:relationships: Relationships to other entities
When documenting entity IDs in JSON schemas:
- Use
"structs:format": "entity-id"for#-#format IDs - Use
"pattern": "^[0-9]+-[0-9]+$"to validate the format - Include description explaining the format: "Entity identifier in format 'type-index'"
- For struct_types, use
"type": "integer"instead
Protocols are defined in structured markdown with clear sections:
# Protocol Name
**Version**: 1.0.0
**Category**: Query | Action | Error | Authentication
**Status**: Stable | Experimental | Deprecated
## Overview
[Clear description]
## Request Format
[Structured request format]
## Response Format
[Structured response format]
## Examples
[JSON examples]
## Error Cases
[Error handling]
## Best Practices
[Recommendations]All index files use consistent structure:
{
"version": "1.0.0",
"lastUpdated": "2025-12-07",
"items": [
{
"id": "unique-id",
"name": "Display Name",
"category": "category",
"endpoint": "/path/to/endpoint",
"schema": "schemas/entity.json",
"protocol": "protocols/protocol.md"
}
]
}- Major versions: Breaking changes to schemas or protocols
- Minor versions: New features, non-breaking changes
- Patch versions: Bug fixes, clarifications
When adding new documentation:
- Follow schema format conventions
- Include examples in JSON format
- Update relevant index files 4Ensure machine-parseable structure
Copyright 2025 Slow Ninja Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.