Neural Network Bot Runner#111
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements the foundational neural network bot inference system for TowerFall, enabling trained ML models to play in end-user games. It introduces
NeuralNetBotandNeuralNetBotRunnerclasses that integrate trainedActorCriticNetworkmodels with the game client infrastructure, following the existingRuleBasedBotpattern.Closes: #96
Changes
New Files
bot2/src/bot/bots/neural_net_bot.py(359 lines)NeuralNetBot: Core bot class that uses neural network inference for decision-makingNeuralNetBotRunner: Runner class that integrates the bot withGameClientNeuralNetBotConfig: Configuration dataclass for bot behaviorbot2/tests/unit/test_neural_net_bot.py(715 lines)Modified Files
bot2/src/bot/bots/__init__.pyNeuralNetBot,NeuralNetBotConfig, andNeuralNetBotRunnerKey Features
1. Neural Network Inference
ActorCriticNetworkwith deterministic action selectionObservationBuilder2. Action Translation
3. Efficient Input Deduplication
4. State Management
reset()methods on both bot and runner for new game/episode5. Pattern Consistency
RuleBasedBotandRuleBasedBotRunnerarchitectureBotActiontypes and return patternsBaseBotinterface correctlyGameClientinfrastructureTechnical Implementation
Neural Network Integration
Smart Deduplication
Sentinel Value Pattern
-1.0as sentinel for uninitialized aim direction0.0(right) for shooting without prior aimTesting
Test Coverage
GameClientTest Results
Code Quality
Adherence to Project Standards
list,str | None)botpackage namePerformance Considerations
Review Feedback Addressed
This PR includes fixes for issues identified during code review:
Integration Points
This implementation is ready for integration with:
NeuralNetBotRunnerto connect bots via WebSocket)Files Changed
Acceptance Criteria
All acceptance criteria from issue #96 have been met:
NeuralNetBotextendsBaseBotand implementsdecide_actions()ObservationBuilderto convertGameStateto observation vectorsActorCriticNetwork.get_action_and_value()withdeterministic=TrueActionenum values toBotActiontuplesNeuralNetBotRunnerfollowsRuleBasedBotRunnerpatternreset()methods implemented for both bot and runnerNeuralNetBotConfigdataclass for configurationbot/bots/__init__.pytask bot2:test:unit)task bot2:check)Future Enhancements
Out of scope for this PR (addressed in subsequent tasks):