
Cobblemon:Crzbrain
CRZbrain is a Kotlin-based Fabric mod for Minecraft/Cobblemon that gives Pokemon an AI-powered brain featuring reinforcement learning, sentiment analysis, cross-trainer knowledge sharing, and adaptive response generation to make Pokemon interaction
Список изменений
● v2.7 TPS Optimization - Summary
Fix 1: PokemonDefenseSystem (HIGH impact)
- Tick interval increased from 5 (0.25s) to 20 ticks (1s) → 75% fewer calls
- Entity search now runs once per player instead of once per Pokemon per player (was NM, now 1N). If 10 players have 6 Pokemon each, that's 60 AABB searches → 10
- Auto-deactivate: defense mode automatically disables when no threats remain, preventing useless detectThreats() calls every tick
Fix 2: Async File I/O (HIGH impact)
- MemorySystem.batchSave(), ReinforcementLearning.saveData(), AdvancedPatternMining.saveData(), and CollectiveIntelligence.saveData() now all run on CompletableFuture.runAsync instead of the main server thread
- AtomicBoolean lock prevents concurrent saves from overlapping
- Main thread no longer freezes during JSON serialization (was several MB every 60s)
Fix 3: Memory Leak Prevention (22 systems, MEDIUM impact)
- Added reset(pokemonId) functions to 19 AI systems that had none (EmotionalMomentum, ConversationMemory, NarrativeEngine, DeepThinking, DeepPersonality, UltraConsciousness, ProactiveAI, VoicePatterns, LexicalVariety, AdvancedPersonalitySystem, MasterMind, EmotionalIntelligence, PokemonSocialAI, SmartResponseGenerator, PokemonGoals, DynamicPersonality, PokemonLifeStory, PokemonBondSystem, LearningContextIntegration)
- Wired 4 existing resets that were never connected (PersonalityEvolution, MoodSystem, SmartConversation, WisdomSystem)
- PokemonLifecycleManager now cleans up all 39 systems on stale Pokemon eviction (was only 17)
Fix 4: Chat Learning Throttle (MEDIUM impact)
- 2-second cooldown between learning triggers from the same player
- Max 3 Pokemon learn per chat message (was unlimited - every Pokemon of every nearby player)
- Drastically reduces CPU load on servers with active chat
Estimated TPS improvement ┌─────────┬─────────────────┬──────────────┐ │ Players │ Before │ After │ ├─────────┼─────────────────┼──────────────┤ │ 1-2 │ ~0.5-1 TPS lost │ ~0.1-0.2 TPS │ ├─────────┼─────────────────┼──────────────┤ │ 5-10 │ ~1-3 TPS lost │ ~0.3-0.7 TPS │ ├─────────┼─────────────────┼──────────────┤ │ 20+ │ ~3-5+ TPS lost │ ~0.5-1.5 TPS │ └─────────┴─────────────────┴──────────────┘