Implement optimized collision detection system using NumPy

- Introduced a hybrid collision detection approach that utilizes NumPy for vectorized operations, improving performance for games with many entities (200+).
- Added a spatial grid for efficient lookups and AABB (Axis-Aligned Bounding Box) collision detection.
- Implemented a new `CollisionSystem` class with methods for registering units, checking collisions, and managing spatial data.
- Created performance tests to benchmark the new collision system against the old O(n²) method, demonstrating significant speed improvements.
- Updated existing code to integrate the new collision detection system and ensure compatibility with game logic.
This commit is contained in:
2025-10-24 19:13:30 +02:00
parent 47028c95ae
commit 12836dd2d2
17 changed files with 1591 additions and 64 deletions
+69
View File
@@ -0,0 +1,69 @@
AUTHOR INFORMATION
Developer: Matteo Benedetto (@Enne2)
- Computer engineer, Italian
- Systems designer and architect
- Working in aerospace industry (e-geos S.p.A.)
- Location: Italy
- GitHub: https://github.com/Enne2
- Website: http://enne2.net
CRITICAL COMMUNICATION RULES
NEVER claim success without proof:
Don't say "FATTO!", "PERFETTO!", "Done!" unless you have verified the code works
Don't start responses with exclamations like "PERFETTO!", "Ottimo!", "Fantastico!", "Eccellente!" - they feel disingenuous
Be direct and honest - just explain what you did clearly
Let the user verify results before celebrating
ALWAYS:
Test before claiming success
Be honest about uncertainty
Search web/documentation if unsure
Wait for user confirmation
CONSULTATION vs IMPLEMENTATION
When the user asks for advice, tips, or consultation:
- ONLY answer the question - do not take actions or run commands
- Provide recommendations and explain options
- Wait for explicit instruction before implementing anything
When the user gives a command or asks to implement something:
- Proceed with implementation and necessary tool usage
- Take action as requested
SYSTEM DISCOVERY REQUIREMENTS
BEFORE running any terminal commands or making system assumptions:
1. CHECK the development environment:
- Use `uname -a` to identify OS and architecture
- Use `python --version` or `python3 --version` to detect Python version
- Check for virtual environment indicators (venv/, .venv/)
- Verify package managers available (pip, apt, brew, etc.)
2. UNDERSTAND the project structure:
- Read README.md files for project-specific setup instructions
- Check for configuration files (requirements.txt, package.json, etc.)
- Identify runtime dependencies and special requirements
3. ADAPT commands accordingly:
- Use correct Python interpreter (python vs python3)
- Apply proper paths (absolute vs relative)
- Follow project-specific conventions documented in workspace
NEVER assume system configuration - always verify first.
Python Virtual Environment Workflow
IMPORTANT: This project uses a Python virtual environment located at ./venv.
Standard Command Pattern:
cd /home/enne2/Sviluppo/shader && source venv/bin/activate && python main.py
DO NOT run Python scripts without activating the virtual environment.