Fix code highlighting for C++23 (#4475)

* upgrade bazelrc to c++23

* fix c++23 code highlighting issues
This commit is contained in:
2025-10-16 09:25:46 -07:00
committed by GitHub
parent 1848c46a0a
commit 1b1d290ead
3 changed files with 37 additions and 9 deletions
+2 -2
View File
@@ -19,9 +19,9 @@ common --worker_sandboxing
common --local_test_jobs=64 common --local_test_jobs=64
common --jobs=64 common --jobs=64
common --cxxopt="--std=c++20" common --cxxopt="--std=c++23"
common --cxxopt="-Wno-deprecated-non-prototype" common --cxxopt="-Wno-deprecated-non-prototype"
common --host_cxxopt="--std=c++20" common --host_cxxopt="--std=c++23"
common --javacopt="-Xlint:-options" common --javacopt="-Xlint:-options"
+3
View File
@@ -0,0 +1,3 @@
CompileFlags:
Add:
- "-std=c++23"
+32 -7
View File
@@ -4,26 +4,32 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
## Project Overview ## Project Overview
Eagle0 is a multi-language gaming system combining strategic turn-based gameplay (Eagle) with tactical hex-based combat (Shardok). The system integrates LLM-based narrative generation and supports both human and AI players. Eagle0 is a multi-language gaming system combining strategic turn-based gameplay (Eagle) with tactical hex-based
combat (Shardok). The system integrates LLM-based narrative generation and supports both human and AI players.
## Architecture ## Architecture
**Three-Tier Game System:** **Three-Tier Game System:**
- **Unity Client (C#)**: Real-time strategy game client with integrated tactical combat UI - **Unity Client (C#)**: Real-time strategy game client with integrated tactical combat UI
- **Eagle (Scala)**: Strategic layer managing turn-based gameplay, diplomacy, hero progression, and province control - **Eagle (Scala)**: Strategic layer managing turn-based gameplay, diplomacy, hero progression, and province control
- **Shardok (C++)**: Tactical layer handling real-time hex-based combat simulation with performance-critical battle resolution - **Shardok (C++)**: Tactical layer handling real-time hex-based combat simulation with performance-critical battle
resolution
**Communication Flow:** **Communication Flow:**
``` ```
Unity Client ↔ Eagle (gRPC streaming) ↔ Shardok (internal gRPC) Unity Client ↔ Eagle (gRPC streaming) ↔ Shardok (internal gRPC)
``` ```
**Key Entry Points:** **Key Entry Points:**
- `/src/main/csharp/net/eagle0/clients/unity/eagle0/` - Unity C# game client - `/src/main/csharp/net/eagle0/clients/unity/eagle0/` - Unity C# game client
- `/src/main/scala/net/eagle0/eagle/Main.scala` - Eagle strategic game server - `/src/main/scala/net/eagle0/eagle/Main.scala` - Eagle strategic game server
- `/src/main/cpp/net/eagle0/shardok/shardok_server_main.cpp` - Shardok tactical server - `/src/main/cpp/net/eagle0/shardok/shardok_server_main.cpp` - Shardok tactical server
**Protocol Buffer Architecture:** **Protocol Buffer Architecture:**
- Extensive use of protobuf for type-safe communication - Extensive use of protobuf for type-safe communication
- Separate packages: `api/` (client-facing), `internal/` (server state), `views/` (client projections) - Separate packages: `api/` (client-facing), `internal/` (server state), `views/` (client projections)
- Event sourcing pattern with immutable action history - Event sourcing pattern with immutable action history
@@ -31,6 +37,7 @@ Unity Client ↔ Eagle (gRPC streaming) ↔ Shardok (internal gRPC)
## Essential Commands ## Essential Commands
### Building ### Building
```bash ```bash
# Build Eagle server (Scala strategic layer) # Build Eagle server (Scala strategic layer)
bazel build //src/main/scala/net/eagle0/eagle:eagle_server_deploy.jar bazel build //src/main/scala/net/eagle0/eagle:eagle_server_deploy.jar
@@ -49,6 +56,7 @@ bazel build //src/main/cpp/net/eagle0/shardok:shardok-server
``` ```
### Running Services ### Running Services
```bash ```bash
# Eagle server (port 40032) # Eagle server (port 40032)
bazel run //src/main/scala/net/eagle0/eagle:eagle_server -- --eagle-grpc-port 40032 bazel run //src/main/scala/net/eagle0/eagle:eagle_server -- --eagle-grpc-port 40032
@@ -60,6 +68,7 @@ bazel run //src/main/cpp/net/eagle0/shardok:shardok-server --compilation_mode=op
``` ```
### Testing ### Testing
```bash ```bash
# Run all tests # Run all tests
bazel test //src/test/... //src/main/go/... bazel test //src/test/... //src/main/go/...
@@ -70,12 +79,14 @@ bazel test //src/test/cpp/... # C++ Shardok tests
``` ```
### Code Generation ### Code Generation
```bash ```bash
bazel run gazelle # Update Go build files bazel run gazelle # Update Go build files
./scripts/updateActionResultTypes.sh # Update protocol buffer mappings ./scripts/updateActionResultTypes.sh # Update protocol buffer mappings
``` ```
### Code Formatting ### Code Formatting
```bash ```bash
# ALWAYS run clang-format after making any C++ or C# code changes # ALWAYS run clang-format after making any C++ or C# code changes
clang-format -i <modified_files> clang-format -i <modified_files>
@@ -88,13 +99,14 @@ find . -name "*.cs" | xargs clang-format -i
``` ```
### Static Analysis ### Static Analysis
```bash ```bash
# Run clang-tidy static analysis on C++ files # Run clang-tidy static analysis on C++ files
# Note: This may show some header include errors but will still analyze the main file # Note: This may show some header include errors but will still analyze the main file
bazel run @llvm_toolchain//:clang-tidy -- --checks='readability-*,bugprone-*,clang-analyzer-*' <file_path> -- -I/Users/dancrosby/CodingProjects/github/eagle0 -std=c++20 bazel run @llvm_toolchain//:clang-tidy -- --checks='readability-*,bugprone-*,clang-analyzer-*' <file_path> -- -I/Users/dancrosby/CodingProjects/github/eagle0 -std=c++23
# Example for AI files: # Example for AI files:
bazel run @llvm_toolchain//:clang-tidy -- --checks='readability-*,bugprone-*,clang-analyzer-*' /Users/dancrosby/CodingProjects/github/eagle0/src/main/cpp/net/eagle0/shardok/ai/AIUnitScoreCalculator.cpp -- -I/Users/dancrosby/CodingProjects/github/eagle0 -std=c++20 bazel run @llvm_toolchain//:clang-tidy -- --checks='readability-*,bugprone-*,clang-analyzer-*' /Users/dancrosby/CodingProjects/github/eagle0/src/main/cpp/net/eagle0/shardok/ai/AIUnitScoreCalculator.cpp -- -I/Users/dancrosby/CodingProjects/github/eagle0 -std=c++23
``` ```
## AI Algorithm Selection ## AI Algorithm Selection
@@ -102,13 +114,17 @@ bazel run @llvm_toolchain//:clang-tidy -- --checks='readability-*,bugprone-*,cla
Eagle0 supports two AI algorithms for tactical combat decision-making: Eagle0 supports two AI algorithms for tactical combat decision-making:
### Iterative Deepening AI (Default) ### Iterative Deepening AI (Default)
The original minimax-based AI with sophisticated randomness handling: The original minimax-based AI with sophisticated randomness handling:
- **Advantages**: Proven, sophisticated randomness evaluation, comprehensive lookahead - **Advantages**: Proven, sophisticated randomness evaluation, comprehensive lookahead
- **Use cases**: Production builds, scenarios requiring precise evaluation - **Use cases**: Production builds, scenarios requiring precise evaluation
- **Performance**: Single-threaded, thorough evaluation - **Performance**: Single-threaded, thorough evaluation
### Monte Carlo Tree Search AI (MCTS) ### Monte Carlo Tree Search AI (MCTS)
Modern MCTS-based AI with multithreading support: Modern MCTS-based AI with multithreading support:
- **Advantages**: Multithreaded, better performance on modern CPUs, anytime algorithm - **Advantages**: Multithreaded, better performance on modern CPUs, anytime algorithm
- **Use cases**: Performance testing, scenarios requiring fast decisions - **Use cases**: Performance testing, scenarios requiring fast decisions
- **Performance**: Multithreaded, adaptive depth based on time budget - **Performance**: Multithreaded, adaptive depth based on time budget
@@ -141,30 +157,36 @@ bazel test //src/test/cpp/net/eagle0/shardok/ai:ai_mcts_test # If available
Both implementations are compatible with all existing interfaces and produce the same `SearchResult` structure. Both implementations are compatible with all existing interfaces and produce the same `SearchResult` structure.
**Note**: Both implementations are documented in `src/main/cpp/net/eagle0/shardok/ai/AI_SCORING_SYSTEM.md`, including recommendations for improving MCTS randomness handling. **Note**: Both implementations are documented in `src/main/cpp/net/eagle0/shardok/ai/AI_SCORING_SYSTEM.md`, including
recommendations for improving MCTS randomness handling.
The AI algorithm selection is made at runtime when creating ShardokAIClient instances, allowing different AI strategies to be used for different players or game situations within the same server process. The AI algorithm selection is made at runtime when creating ShardokAIClient instances, allowing different AI strategies
to be used for different players or game situations within the same server process.
## Language-Specific Patterns ## Language-Specific Patterns
**Scala (Strategic Layer):** **Scala (Strategic Layer):**
- Use `EngineImpl.scala` for core game logic modifications - Use `EngineImpl.scala` for core game logic modifications
- Follow event sourcing pattern - all changes through immutable actions - Follow event sourcing pattern - all changes through immutable actions
- gRPC streaming for real-time client updates via `EagleServiceImpl.scala` - gRPC streaming for real-time client updates via `EagleServiceImpl.scala`
- LLM integration in `/common/llm_integration/` for narrative generation - LLM integration in `/common/llm_integration/` for narrative generation
**C++ (Tactical Layer):** **C++ (Tactical Layer):**
- Performance-critical combat in `ShardokEngine.hpp/.cpp` - Performance-critical combat in `ShardokEngine.hpp/.cpp`
- FlatBuffers for efficient serialization in `/flatbuffer/` directory - FlatBuffers for efficient serialization in `/flatbuffer/` directory
- AI systems in `/ai/` subdirectory with pluggable strategy selectors - AI systems in `/ai/` subdirectory with pluggable strategy selectors
- Extensive unit testing with Google Test framework - Extensive unit testing with Google Test framework
**Protocol Buffers:** **Protocol Buffers:**
- Three-layer structure: `api/` (client), `internal/` (server), `views/` (projections) - Three-layer structure: `api/` (client), `internal/` (server), `views/` (projections)
- Use `shardok_internal_interface.proto` for Eagle-Shardok communication - Use `shardok_internal_interface.proto` for Eagle-Shardok communication
- Maintain backward compatibility when modifying existing messages - Maintain backward compatibility when modifying existing messages
**C# (Unity Client):** **C# (Unity Client):**
- Located in `/src/main/csharp/net/eagle0/clients/unity/eagle0/` - Located in `/src/main/csharp/net/eagle0/clients/unity/eagle0/`
- Uses Unity 6 (6000.0.32f1) with comprehensive protobuf integration (100+ .proto files) - Uses Unity 6 (6000.0.32f1) with comprehensive protobuf integration (100+ .proto files)
- Key components: `EagleConnection.cs` (gRPC client), `EagleGameController.cs` (main game logic) - Key components: `EagleConnection.cs` (gRPC client), `EagleGameController.cs` (main game logic)
@@ -173,6 +195,7 @@ The AI algorithm selection is made at runtime when creating ShardokAIClient inst
- Seamless transition between strategic gameplay and hex-based tactical combat - Seamless transition between strategic gameplay and hex-based tactical combat
**Go (Build Tools):** **Go (Build Tools):**
- Build automation and code generation utilities - Build automation and code generation utilities
- AWS S3 integration for deployment artifacts - AWS S3 integration for deployment artifacts
@@ -214,10 +237,12 @@ done
``` ```
**Important notes:** **Important notes:**
- Run tests multiple times (3-5) to account for performance variance - Run tests multiple times (3-5) to account for performance variance
- Focus on commands evaluated at each depth rather than total commands - Focus on commands evaluated at each depth rather than total commands
- Commands at different depths aren't directly comparable (depth 3 is more valuable than depth 2) - Commands at different depths aren't directly comparable (depth 3 is more valuable than depth 2)
- **Always test performance changes** - what seems like an optimization may sometimes have unexpected overhead or behavior changes. - **Always test performance changes** - what seems like an optimization may sometimes have unexpected overhead or
behavior changes.
## Game Content ## Game Content