Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .claude/project-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,37 @@ Quick reference for Claude Code sessions.
- **Founders**: Andrew Madison & Justin Madison
- **Organization**: JustInternetAI

## GitHub Configuration
- **Project Board**: Agent Arena Development Board (Project #3)
- **Project Board ID**: `PVT_kwDODG39W84BHw8k`
- **Issue Labels**:
- `enhancement`: New feature or request
- `backend`: LLM backends and inference
- `tools`: Agent tools
- `memory`: Memory systems
- `evals`: Evaluation and benchmarks
- `critical`: Critical priority
- `high-priority`: High priority

### GitHub CLI Commands
```bash
# List projects
gh project list --owner JustInternetAI

# View project board
gh project view 3 --owner JustInternetAI

# Create issue (may auto-add to project if automation enabled)
gh issue create --title "Title" --body "Description" --label "enhancement"

# Create issue and add to project
gh issue create --title "Title" --body "Description" --label "enhancement"
gh project item-add 3 --owner JustInternetAI --url https://github.com/JustInternetAI/AgentArena/issues/ISSUE_NUMBER

# Refresh auth with project scopes (if needed)
gh auth refresh -h github.com -s read:project -s project
```

## Tech Stack
- **Godot 4.5**: C++ GDExtension module for simulation
- **Python 3.11**: Agent runtime, LLM backends, tools (3.11 required - many ML packages don't support 3.14 yet)
Expand Down
33 changes: 33 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Auto detect text files and perform LF normalization
* text=auto

# Ensure these files always have LF endings (even on Windows)
*.cpp text eol=lf
*.h text eol=lf
*.hpp text eol=lf
*.c text eol=lf
*.gd text eol=lf
*.tscn text eol=lf
*.tres text eol=lf
*.gdshader text eol=lf
*.md text eol=lf
*.txt text eol=lf
CMakeLists.txt text eol=lf
*.cmake text eol=lf

# Windows-specific files should use CRLF
*.bat text eol=crlf
*.ps1 text eol=crlf
*.cmd text eol=crlf

# Binary files
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.dll binary
*.so binary
*.dylib binary
*.exe binary
*.app binary
84 changes: 84 additions & 0 deletions BUILD_GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Build Guide for Agent Arena GDExtension

## Quick Start

### Rebuild Everything (Recommended)
```powershell
.\rebuild_clean.ps1
```
This script will:
1. Clean the build
2. Build Debug configuration
3. Build Release configuration
4. Output DLLs to `bin/windows/` with correct names

### Build Debug Only
```powershell
cmake --build godot/build --config Debug
```

### Build Release Only
```powershell
cmake --build godot/build --config Release
```

### Force Clean Rebuild
```powershell
cmake --build godot/build --config Debug --clean-first
```

## After Building

### Clear Godot Cache
If Godot doesn't pick up changes, clear the cache:
```powershell
Remove-Item .godot -Recurse -Force
```
Then restart Godot editor.

### Verify Build
Check DLL timestamps:
```powershell
Get-Item bin/windows/*.dll | Select-Object Name, LastWriteTime
```

## Build Output Locations

- **Debug DLL**: `bin/windows/libagent_arena.windows.template_debug.x86_64.dll`
- **Release DLL**: `bin/windows/libagent_arena.windows.template_release.x86_64.dll`

## CMake Configuration

The project uses CMake with Visual Studio generator (multi-config).

### Reconfigure CMake (if CMakeLists.txt changes)
```powershell
cmake -S godot -B godot/build -G "Visual Studio 17 2022" -A x64
```

## Troubleshooting

### "cmake: command not found"
CMake needs to be in your PATH. Either:
1. Restart your terminal/VS Code after installing CMake
2. Use full path: `& "C:\Program Files\CMake\bin\cmake.exe"`

### "EventBus node not found in scene"
1. Make sure DLL was rebuilt: `Get-Item bin/windows/*.dll | Select-Object LastWriteTime`
2. Clear Godot cache: `Remove-Item .godot -Recurse -Force`
3. Restart Godot editor

### Wrong DLL location
If DLL goes to `bin/windows/Debug/`, the CMakeLists.txt wasn't updated correctly.
Make sure lines 96-105 in `godot/CMakeLists.txt` have the `RUNTIME_OUTPUT_DIRECTORY_*` properties.

## Architecture Notes

The GDExtension includes these C++ classes:
- `SimulationManager` - Manages simulation tick loop
- `EventBus` - Handles event recording/replay (critical for deterministic simulation)
- `Agent` - Agent representation with perception/action
- `ToolRegistry` - Manages available agent tools
- `IPCClient` - Communication with Python runtime

All classes are registered in `godot/src/register_types.cpp`.
16 changes: 16 additions & 0 deletions clear_godot_cache.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Clear Godot cache to fix class registration issues
Write-Host "Clearing Godot cache..." -ForegroundColor Cyan

$cachePath = "c:\Projects\Agent Arena\.godot"

if (Test-Path $cachePath) {
Write-Host "Found .godot cache directory" -ForegroundColor Yellow

# Remove the entire .godot directory
Remove-Item "$cachePath\*" -Recurse -Force -Exclude ".gdignore"

Write-Host "Cache cleared!" -ForegroundColor Green
Write-Host "Restart Godot to regenerate the cache." -ForegroundColor Cyan
} else {
Write-Host "No cache directory found at $cachePath" -ForegroundColor Yellow
}
25 changes: 25 additions & 0 deletions copy_dll.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copy the newly built DLL to the correct location for Godot
Write-Host "Copying newly built DLL to correct location..." -ForegroundColor Cyan

$sourceDll = "c:\Projects\Agent Arena\bin\windows\Debug\libagent_arena.windows.template_release.x86_64.dll"
$targetDll = "c:\Projects\Agent Arena\bin\windows\libagent_arena.windows.template_debug.x86_64.dll"

# Check if source exists
if (Test-Path $sourceDll) {
Write-Host "Found newly built DLL in Debug folder" -ForegroundColor Green
Write-Host "Source: $sourceDll" -ForegroundColor Gray

# Show file info
$fileInfo = Get-Item $sourceDll
Write-Host "Build time: $($fileInfo.LastWriteTime)" -ForegroundColor Gray
Write-Host "Size: $([math]::Round($fileInfo.Length / 1MB, 2)) MB" -ForegroundColor Gray

# Copy to target location
Write-Host "`nCopying to: $targetDll" -ForegroundColor Yellow
Copy-Item $sourceDll $targetDll -Force

Write-Host "`nDone! DLL has been copied." -ForegroundColor Green
Write-Host "You can now restart Godot and test the scene." -ForegroundColor Cyan
} else {
Write-Host "Error: Source DLL not found at $sourceDll" -ForegroundColor Red
}
26 changes: 26 additions & 0 deletions fix_dll.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Script to replace the old DLL with the newly built one
Write-Host "Fixing DLL issue..." -ForegroundColor Cyan

$binPath = "c:\Projects\Agent Arena\bin\windows"
$oldDll = "$binPath\libagent_arena.windows.template_debug.x86_64.dll"
$newDll = "$binPath\~libagent_arena.windows.template_debug.x86_64.dll"

# Check if new DLL exists
if (Test-Path $newDll) {
Write-Host "Found newly built DLL (with ~ prefix)" -ForegroundColor Green

# Remove old DLL if it exists
if (Test-Path $oldDll) {
Write-Host "Removing old DLL..." -ForegroundColor Yellow
Remove-Item $oldDll -Force
}

# Rename new DLL to correct name
Write-Host "Renaming new DLL to correct name..." -ForegroundColor Yellow
Move-Item $newDll $oldDll -Force

Write-Host "Done! DLL has been updated." -ForegroundColor Green
Write-Host "You can now restart Godot and test." -ForegroundColor Cyan
} else {
Write-Host "Error: New DLL not found at $newDll" -ForegroundColor Red
}
24 changes: 19 additions & 5 deletions godot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,18 @@ elseif(UNIX)
set(PLATFORM_ARCH "x86_64")
endif()

# Build type
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(BUILD_TYPE "template_debug")
# Build type (handle both single-config and multi-config generators)
if(CMAKE_BUILD_TYPE)
# Single-config generator (Ninja, Unix Makefiles)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(BUILD_TYPE "template_debug")
else()
set(BUILD_TYPE "template_release")
endif()
else()
set(BUILD_TYPE "template_release")
# Multi-config generator (Visual Studio, Xcode)
# Use generator expression for build type
set(BUILD_TYPE "$<IF:$<CONFIG:Debug>,template_debug,template_release>")
endif()

# godot-cpp path (you'll need to clone godot-cpp as a submodule or dependency)
Expand Down Expand Up @@ -86,9 +93,16 @@ endif()
# Output directory
set(OUTPUT_NAME "libagent_arena.${PLATFORM_NAME}.${BUILD_TYPE}.${PLATFORM_ARCH}")
set_target_properties(${PROJECT_NAME} PROPERTIES
OUTPUT_NAME ${OUTPUT_NAME}
OUTPUT_NAME_DEBUG "libagent_arena.${PLATFORM_NAME}.template_debug.${PLATFORM_ARCH}"
OUTPUT_NAME_RELEASE "libagent_arena.${PLATFORM_NAME}.template_release.${PLATFORM_ARCH}"
OUTPUT_NAME_RELWITHDEBINFO "libagent_arena.${PLATFORM_NAME}.template_release.${PLATFORM_ARCH}"
OUTPUT_NAME_MINSIZEREL "libagent_arena.${PLATFORM_NAME}.template_release.${PLATFORM_ARCH}"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../bin/${PLATFORM_NAME}"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../bin/${PLATFORM_NAME}"
LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../bin/${PLATFORM_NAME}"
LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/../bin/${PLATFORM_NAME}"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../bin/${PLATFORM_NAME}"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/../bin/${PLATFORM_NAME}"
)

# Install rules
Expand Down
16 changes: 9 additions & 7 deletions godot/include/agent_arena.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define AGENT_ARENA_H

#include <godot_cpp/classes/node.hpp>
#include <godot_cpp/classes/node3d.hpp>
#include <godot_cpp/classes/ref_counted.hpp>
#include <godot_cpp/classes/time.hpp>
#include <godot_cpp/classes/http_request.hpp>
Expand Down Expand Up @@ -33,7 +34,7 @@ class SimulationManager : public godot::Node {
uint64_t current_tick;
double tick_rate;
bool is_running;
godot::Ref<EventBus> event_bus;
EventBus* event_bus;

protected:
static void _bind_methods();
Expand All @@ -42,6 +43,7 @@ class SimulationManager : public godot::Node {
SimulationManager();
~SimulationManager();

void _ready() override;
void _process(double delta) override;
void _physics_process(double delta) override;

Expand All @@ -64,8 +66,8 @@ class SimulationManager : public godot::Node {
/**
* Event bus for deterministic event ordering and replay
*/
class EventBus : public godot::RefCounted {
GDCLASS(EventBus, godot::RefCounted)
class EventBus : public godot::Node {
GDCLASS(EventBus, godot::Node)

private:
struct Event {
Expand Down Expand Up @@ -97,8 +99,8 @@ class EventBus : public godot::RefCounted {
/**
* Base agent class with perception, memory, and action capabilities
*/
class Agent : public godot::Node {
GDCLASS(Agent, godot::Node)
class Agent : public godot::Node3D {
GDCLASS(Agent, godot::Node3D)

private:
godot::String agent_id;
Expand Down Expand Up @@ -137,8 +139,8 @@ class Agent : public godot::Node {
/**
* Tool registry for managing available agent actions
*/
class ToolRegistry : public godot::RefCounted {
GDCLASS(ToolRegistry, godot::RefCounted)
class ToolRegistry : public godot::Node {
GDCLASS(ToolRegistry, godot::Node)

private:
godot::Dictionary registered_tools;
Expand Down
15 changes: 15 additions & 0 deletions godot/rebuild.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Quick rebuild script for Agent Arena GDExtension
Set-Location -Path "c:\Projects\Agent Arena\godot\build"

Write-Host "Building Agent Arena GDExtension..." -ForegroundColor Cyan

# Try using cmake
cmake --build . --config Debug

if ($LASTEXITCODE -eq 0) {
Write-Host "Build successful!" -ForegroundColor Green
Write-Host "DLL location: c:\Projects\Agent Arena\bin\windows\" -ForegroundColor Yellow
} else {
Write-Host "Build failed with exit code $LASTEXITCODE" -ForegroundColor Red
exit $LASTEXITCODE
}
Loading