38 Commits

Author SHA1 Message Date
empty
8915a4b074 feat: implement AI Director & Narrative Voting System (Phase 9)
Add complete AI Director system that transforms the survival simulation
into a user-driven interactive story with audience voting.

Backend:
- Add DirectorService for LLM-powered plot generation with fallback templates
- Add VoteManager for dual-channel voting (Twitch + Unity)
- Integrate 4-phase game loop: Simulation → Narrative → Voting → Resolution
- Add vote command parsing (!1, !2, !A, !B) in Twitch service
- Add type-safe LLM output handling with _coerce_int() helper
- Normalize voter IDs for case-insensitive duplicate prevention

Unity Client:
- Add NarrativeUI for cinematic event cards and voting progress bars
- Add 7 new event types and data models for director/voting events
- Add delayed subscription coroutine for NetworkManager timing
- Sync client timer with server's remaining_seconds to prevent drift

Documentation:
- Update README.md with AI Director features, voting commands, and event types

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 03:37:41 +08:00
empty
93fed8b9ca fix: add missing 'id' attribute to AgentSnapshot class
AgentSnapshot was missing the 'id' attribute which is required by
memory_service.get_relevant_memories() in llm.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 02:48:49 +08:00
empty
07acfa5801 fix: prevent ParticleSystem "duration while playing" warnings
- Stop ParticleSystem immediately after AddComponent to prevent auto-play
- Set playOnAwake=false on all procedural particle systems
- Also add missing EventType definitions for Phase 23/24 features

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 02:46:23 +08:00
empty
da49223685 fix: remove duplicate }) causing Python syntax error
Remove extra }) at line 1338 that was causing unmatched brace error
on startup.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 02:39:40 +08:00
empty
9d248f2cdb fix: remove extra closing brace in GameManager.cs
Remove duplicate } at line 504 that was breaking the class structure
and causing CS1022 compilation error.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 02:38:06 +08:00
empty
5476260efa fix: avoid detached SQLAlchemy session in conversation reply
Extract agent ids and names before creating async task to prevent
"Instance is not bound to a Session" error when accessing attributes
after the original session is closed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 02:31:06 +08:00
empty
adfd197451 fix: add missing self parameter to generate_social_interaction
The method was missing 'self' as first parameter, causing
"got multiple values for argument 'initiator_name'" error.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 02:22:25 +08:00
empty
642205529c fix: remove duplicate code blocks in AgentVisual.cs
Remove accidentally duplicated code that was causing compilation errors:
- Duplicate closing braces and comments around line 244
- Duplicate Destroy(itemObj) call around line 674
- Duplicate field definitions for _socialCheckTimer and _relationships

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 02:20:32 +08:00
empty
dee374286e feat: Implement NavMesh pathfinding and Deep Social visuals
- Phase 20-F: NavMesh Integration
  - Added 'com.unity.ai.navigation' package
  - Implemented Runtime NavMesh Baking in EnvironmentManager
  - Added NavMeshObstacle to environmental assets
  - Updated AgentVisual to use NavMeshAgent for movement
  - Implemented 'Instinctive Avoidance' via target offsetting

- Phase 21: Social Interaction & Expressions
  - Added procedural Dance and Wave animations in AgentAnimator
  - Implemented 'Dance Party' triggering logic in engine.py and AgentVisual
  - Added social relationship syncing (Backend -> Frontend)
  - Implemented proximity-based social greetings (Heart emote + Wave)
  - Updated Models.cs to support relationship data parsing
2026-01-02 01:48:32 +08:00
empty
6ad6665d5f feat: add SpawnFootstepDust method to VFXManager
Add missing footstep dust particle effect that was being called from
AgentVisual but not implemented, causing CS1061 compilation error.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 01:38:50 +08:00
empty
ce0be0045d fix: add is_sheltered attribute to AgentSnapshot class
- Add is_sheltered parameter to AgentSnapshot in both locations
- Include is_sheltered in agent_data dictionary for idle chat

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 01:18:14 +08:00
empty
4f3bd5695c chore: remove Unity AI Toolkit packages to fix enum warnings
- Remove com.unity.ai.assistant, com.unity.ai.generators, com.unity.ai.inference
- Update packages-lock.json
- Additional Phase 19 visual polish updates

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 00:42:08 +08:00
empty
f270a8b099 feat: Phase 19-D/E - social behavior and velocity-based animation
- Add soft-repulsion to prevent agent crowding
- Implement dynamic Z-sorting based on world position
- Add social orientation (agents face nearby agents)
- Use velocity-based animation instead of isMoving flag
- Track lastPosition for smooth velocity calculation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 00:30:46 +08:00
empty
0187c5ecbe feat: Phase 19-C/D - sprite loading, transparency, and animation
- Add runtime sprite loading from Characters.png and Environment.png
- Implement ProcessTransparency for chroma-key white background removal
- Add AgentAnimator for procedural idle/movement animations
- Add Billboard component support for 2.5D perspective
- Normalize sprite scales based on world units
- Fix SetMovement parameter mismatch

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 00:23:13 +08:00
empty
01abd3c2dc fix: resolve compilation errors and warnings
- Add missing MoveTowardsTarget() method in AgentVisual
- Remove unused _breathScale field
- Replace deprecated FindObjectOfType with FindFirstObjectByType
- Remove unused shaderCode variable

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 00:05:40 +08:00
empty
119afede55 fix: add missing System.Collections.Generic using directive
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 00:02:23 +08:00
empty
b0e6a3488c feat: Phase 19 - visual polish and cinematic lighting
Backend:
- Add weather transition processing logic

Unity Client:
- Add smooth UI bar transitions with lerp animations
- Implement cinematic lighting system (dawn/day/dusk/night cycle)
- Add VisualEffectsManager for advanced effects
- Support premium sprite loading for agents
- Add character and environment sprite sheets

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 23:58:02 +08:00
empty
91694ba802 docs: update README with new game systems and features
- Add memory_service.py to project structure
- Document new game systems: autonomous actions, sickness, crafting,
  resource scarcity, social roles, memory system, random events
- Add agent attributes table (immunity, social_role, action, location)
- Update Unity scripts documentation
- Add new event types (AGENT_ACTION, CRAFT, USE_ITEM, RANDOM_EVENT)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 23:33:26 +08:00
empty
8277778106 feat: implement survival, crafting, memory, and social systems
- Phase 13: Autonomous Agency - agents now have actions and locations
- Phase 15: Sickness mechanics with immunity and weather effects
- Phase 16: Crafting system (medicine from herbs)
- Phase 17-A: Resource scarcity with tree fruit regeneration
- Phase 17-B: Social roles (leader, follower, loner) with clique behavior
- Phase 17-C: Random events support
- Add AgentMemory model for long-term agent memory storage
- Add memory_service for managing agent memories
- Update Unity client models and event handlers

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 23:28:38 +08:00
empty
432f178fc5 feat(unity): add beach ground details
- Add scattered seashells near water line
- Add pebbles across the beach
- Procedural sprite generation for shells and pebbles

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 22:07:39 +08:00
empty
20c82276fa feat(unity): enhance visual effects and animations
- Add cloud system with procedural sprites and parallax movement
- Add tree swaying animation for palm trees
- Improve agent breathing with squash & stretch animation
- Add jump animation routine for agent reactions
- Add custom CartoonWater shader support
- Add SetupVisuals editor tool and GlobalProfile asset
- Lower speech bubble alpha for glass effect

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 22:07:12 +08:00
empty
d1b02b4dfd feat: Phase 8 - VFX 和 AI 打赏反应系统
- Unity: 添加 VFXManager 实现金币雨和爱心爆炸特效
- Unity: NetworkManager 支持 GiftEffect 事件
- Unity: AgentVisual 支持自定义时长的 SpeechBubble
- Backend: LLMService 支持生成个性化感谢语
- Backend: Engine 统一处理礼物逻辑 (handle_gift)
- Backend: TwitchBot 接入新的礼物处理流程
2026-01-01 21:38:49 +08:00
empty
1f29010de6 docs: 更新 README 和游戏引擎
- 更新 README 中的 Twitch 配置说明
- 更新游戏引擎相关代码
2026-01-01 19:23:21 +08:00
empty
0cd7c9c4d9 fix: 修复 Unity 环境背景和字体问题
- 添加 Environment 对象和 EnvironmentManager 组件到场景
- 重新生成 SourceHanSansSC-Regular SDF 字体资产
- 添加 FixTMPFont 和 RegenerateChineseFont 编辑器工具
2026-01-01 19:22:24 +08:00
empty
3e89a17b69 fix: 修复 Twitch 集成 - 降级到 twitchio 2.x
- 从 twitchio 3.x 降级到 2.10.0 (IRC-based)
  - 3.x 使用 EventSub API 需要更复杂的配置
  - 2.x 使用 IRC 方式更简单可靠
- 简化 Twitch 配置,只需要 Token 和频道名
- 移除 client_id, client_secret, bot_id 要求
- 更新 .env.example 配置说明
2026-01-01 18:59:14 +08:00
empty
a261eaa8ab feat: add event log panel, Chinese font support, and documentation
- Add EventLog.cs: scrollable event log panel showing game events
  - Color-coded entries for different event types
  - Toggle visibility, clear button, timestamps
  - Auto-scroll to newest entries

- Add Chinese font support (Source Han Sans SC)
  - SourceHanSansSC-Regular.otf font file
  - ChineseFontSetup.cs editor tool for TMP font asset generation
  - Configure as fallback font for TextMeshPro

- Fix particle system velocity curve warnings in WeatherEffects.cs
  - Ensure all velocity axes use consistent curve mode

- Add comprehensive README.md with project documentation
  - Architecture overview, features, tech stack
  - Quick start guide, Unity client structure
  - Communication protocol, development notes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 16:46:56 +08:00
empty
6c66764cce feat: add gameplay enhancements and visual improvements
Backend:
- Add weather system with 6 weather types and transition probabilities
- Add day/night cycle (dawn, day, dusk, night) with phase modifiers
- Add mood system for agents (happy, neutral, sad, anxious)
- Add new commands: heal, talk, encourage, revive
- Add agent social interaction system with relationships
- Add casual mode with auto-revive and reduced decay rates

Frontend (Web):
- Add world state display (weather, time of day)
- Add mood bar to agent cards
- Add new action buttons for heal, encourage, talk, revive
- Handle new event types from server

Unity Client:
- Add EnvironmentManager with dynamic sky gradient and island scene
- Add WeatherEffects with rain, sun rays, fog, and heat particles
- Add SceneBootstrap for automatic visual system initialization
- Improve AgentVisual with better character sprites and animations
- Add breathing and bobbing idle animations
- Add character shadows
- Improve UI panels with rounded corners and borders
- Improve SpeechBubble with rounded corners and proper tail
- Add support for all new server events and commands

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 15:25:15 +08:00
empty
8264fe2be3 fix: auto-set provider API key env var for LiteLLM validation
LiteLLM validates provider-specific API key env vars before making calls.
When using custom headers, auto-set ANTHROPIC_API_KEY or OPENAI_API_KEY
to pass validation (actual auth still uses extra_headers).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 14:12:35 +08:00
empty
07c8388289 feat: add custom API key header support for LLM providers
- Add LLM_API_KEY_HEADER for providers using non-standard auth headers
- Support Xiaomi MiMo (uses "api-key" header instead of "x-api-key")
- Add extra_headers to LiteLLM calls when custom header is configured
- Document LITELLM_ANTHROPIC_DISABLE_URL_SUFFIX for full path URLs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 14:09:50 +08:00
empty
8bb78a808d revert: remove auto-prefix, user specifies full provider/model
Support both OpenAI-compatible and Anthropic-compatible endpoints.
User must specify full model name with provider prefix.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 14:07:17 +08:00
empty
7c8337821e fix: auto-add provider prefix for custom LLM endpoints
LiteLLM requires model names in format "provider/model-name".
When LLM_API_BASE is set, automatically prefix model with "openai/"
if no provider prefix is present.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 14:05:45 +08:00
empty
fbf3de0238 chore: add Input System package and ignore TMP font assets
- Add com.unity.inputsystem package dependency
- Ignore TextMesh Pro auto-generated font assets in gitignore

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 14:00:37 +08:00
empty
7e3872cdd8 feat: add multi-provider LLM support with LiteLLM
- Replace openai with litellm for unified LLM interface
- Support 100+ providers: OpenAI, Anthropic, Gemini, Azure, Ollama, etc.
- Add custom API base URL support (LLM_API_BASE)
- Add .env file support with python-dotenv
- Add .env.example configuration template

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 13:49:28 +08:00
empty
64ed46215f feat: add Unity 6 client with 2.5D visual system
Unity client features:
- WebSocket connection via NativeWebSocket
- 2.5D agent visuals with programmatic placeholder sprites
- Billboard system for sprites and UI elements
- Floating UI panels (name, HP, energy bars)
- Speech bubble system with pop-in animation
- RTS-style camera controller (WASD + scroll zoom)
- Editor tools for prefab creation and scene setup

Scripts:
- NetworkManager: WebSocket singleton
- GameManager: Agent spawning and event handling
- AgentVisual: 2.5D sprite and UI creation
- Billboard: Camera-facing behavior
- SpeechBubble: Animated dialogue display
- CameraController: RTS camera with UI input detection
- UIManager: HUD and command input

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 12:17:04 +08:00
empty
e96948e8a4 feat: add LLM integration and enhance game engine
- Add OpenAI-compatible LLM integration for agent dialogue
- Enhance survival mechanics with energy decay and feeding system
- Update frontend debug client with improved UI
- Add .gitignore rules for Unity and Serena

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 12:15:13 +08:00
empty
cf1739b7f8 feat: pivot to island survival simulation with SQLite persistence
Phase 3 - "The Island" transformation:
- Add SQLAlchemy + SQLite for data persistence (database.py)
- Rewrite models.py with User, Agent, WorldState ORM models
- Refactor engine.py for survival mechanics (energy decay, starvation)
- Implement feed command (10 gold -> +20 energy)
- Auto-seed 3 NPCs on startup (Jack/Luna/Bob)
- Update frontend with agent card view and Chinese UI
- Remove old Boss/Player RPG mechanics
- Add .gitignore for database and cache files
- Fix SQLAlchemy session detachment issue

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 17:15:35 +08:00
empty
4c08b00832 feat: implement basic RPG mechanics with boss counter-attack
- Add Player and Boss data models (models.py)
- Implement command processing via regex matching (attack/heal/status)
- Add boss counter-attack mechanism (15 dmg per player attack)
- Add player death/respawn system (lose half gold, respawn full HP)
- Update frontend with boss HP bar, player stats panel, quick action buttons
- Add colored event log (red for attack, green for heal)
- Change port from 8000 to 8080

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 16:50:07 +08:00
empty
714b5824ba feat: initialize interactive live-stream game backend MVP
- Add FastAPI backend with WebSocket support
- Implement ConnectionManager for client connections
- Create GameEngine with async game loop (2s tick)
- Add RuleBasedAgent for keyword-based responses
- Define Pydantic schemas for GameEvent protocol
- Create debug frontend dashboard for testing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 14:58:38 +08:00