-
-
Notifications
You must be signed in to change notification settings - Fork 4
バイナリ地名・地物データの読み込み対応&A*アルゴリズムと集落移動描画の改良&フロー曲線と領域線の色入力対応 #153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
| } | ||
|
|
||
| // 2バイト目:データの個数のバイト数 | ||
| if (!reader.safeCheck(1)) return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[cppcheck-warning] reported by reviewdog 🐶
warning: Identical condition '!reader.safeCheck(1)', second condition is always false [identicalConditionAfterEarlyExit]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements three major improvements to the simulation system: (1) Binary data format support for faster loading of place names and locale data, (2) A pathfinding bug fixes* to eliminate "stick" and "loop" visual artifacts in settlement movement rendering, and (3) Hex color string support for flow curves and territories to enable data-driven color customization.
Key Changes
- Fixed A* pathfinding artifacts by adding parent node validation, endpoint proximity filtering, and fallback to direct lines when paths are invalid
- Optimized agent lookup performance with O(1) hash map indexing and marriage candidate caching
- Added binary table reader/writer infrastructure with typed columns for coordinates, dates, and sizes
- Implemented hex color parsing (#RRGGBB format) for visual customization of map features
Reviewed changes
Copilot reviewed 31 out of 60 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Library/PAX_SAPIENTICA/Simulation/Algorithm/AStar.hpp | Complete A* rewrite with priority queue, parent validation, endpoint filtering, and stick/loop prevention |
| Library/PAX_SAPIENTICA/Simulation/Entity/Settlement.hpp | Agent indexing optimization, marriage cache, and A* integration improvements |
| Library/PAX_SAPIENTICA/IO/Data/BinaryTable.hpp | New binary format reader with typed columns and optimized memory layout |
| Library/PAX_SAPIENTICA/IO/Data/UnifiedTable.hpp | TSV/binary format abstraction layer with automatic format detection |
| Library/PAX_GRAPHICA/ColorUtility.hpp | Hex color string parser (#RRGGBB/#RRGGBBAA support) |
| Library/PAX_MAHOROBA/Map/Content/Feature/TerritoryFeature.hpp | Color parsing integration for territory rendering |
| Library/PAX_MAHOROBA/Map/Content/Feature/FlowCurveFeature.hpp | Color parsing integration for flow curve rendering |
| Data/Settings/*.tsv | Updated to use hex color strings instead of "black" |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
このプルリクエスト(#153)は、 シミュレーションのパフォーマンス向上(バイナリ対応) と 可視化の品質向上(移動線・色指定・バグ修正) の2つが大きな柱となっています。
具体的な改修内容を3つのポイントに整理して解説します。
1. A*アルゴリズムの改良と「棒・ループ」バグの修正
集落の移動経路を計算する
AStarクラス(経路探索)と、その描画ロジックに重要な修正が入っています。「棒(Stick)」と「ループ」の防止策(
setPath関数)(0,0)の場合の不正アクセスチェックを追加し、異常な経路を遮断。skip_dist_sq以内)、そのグリッド点を間引く処理を追加。これにより、スプライン曲線で結んだ際に端点が不自然に歪むのを防いでいます。集落移動の描画リッチ化(
drawMovementLines関数)paxg::Spline2D)で描画するように変更されました。drawArrow)が追加され、集落が「どちらの方向に移動したか」が視覚的に明確になりました。2. バイナリ形式の地名・地物データ読み込み対応
これまでTSV(テキスト)形式のみだったデータ読み込みにおいて、より高速なバイナリ形式のサポートが拡充されました。
latitude(緯度)、first_year/last_year(年代)、min_size/max_size(表示ズームレベル)といった数値を、バイナリデータとして適切に読み書きする機能(BinaryColumnType)が実装されました。getInt32やgetFloatといった型指定の取得メソッドが追加され、キャストのコストを下げつつ精度を維持しています。forEachRowによる行反復処理がサポートされないため、個別のセル取得メソッドを使用するよう設計が変更されています(警告ログPAXS_WARNINGが追加されています)。3. フロー曲線と領域線の「色指定」対応
海流(FlowCurves)や文化圏(Territories)の描画色を、データファイル側から柔軟に指定できるようになりました。
Kuroshio.tsvやShimotabaru.tsvなどのデータファイルにcolorカラムが追加されました。black一辺倒から、#3C6491(海流の青系)や#888888(領域のグレー系)など、具体的なHEXカラーコードが指定されています。ColorUtility.hpp):#fe78ba)をパースして、エンジンの色オブジェクト(paxg::Color)に変換する機能が追加されました。これで、データ側で視覚表現をコントロールしやすくなります。まとめ
このPRによって、 「集落の移動線が綺麗になり(矢印付き・バグ解消)」 、 「海流や文化圏を色分けして見やすく表示」 できるようになり、かつ 「大規模データの読み込み高速化(バイナリ対応)」 の準備が整ったことになります。
特に移動シミュレーションの可視化において、経路が荒ぶる現象が解消されているはずですので、確認時は集落移動の軌跡の滑らかさに注目すると良いでしょう。