-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
"Refactor AI and improve Snake game behavior"
This commit features various changes in the SnakeAgent and SpriteBoardDisplay scripts that refine the behavior of the Snake game. The snake's movement is now defined by rotating in response to action, rather than using explicit directions, allowing for smoother and more logical gameplay. The agent's heuristic function has been adjusted to match this new movement style. The behavior has also been enhanced by reducing the VectorObservationSize to optimize performance, and the game board size has been reduced to 8x8 for simpler and quicker gameplay during testing. An unused ONNX file (used for ML model storage) was also removed, which cleaned up the project and reduced unnecessary files. In SpriteBoardDisplay, collected rewards are visualized to offer better insight on the agent's performance. The calculation for rewards, based on food proximity, has been simplified and the display now includes a reward gradient.
- Loading branch information
Showing
9 changed files
with
722 additions
and
383 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"count":1,"self":15.8643904,"total":16.2532724,"children":{"InitializeActuators":{"count":4,"self":0.0005043,"total":0.0005043,"children":null},"InitializeSensors":{"count":4,"self":0.0015023,"total":0.0015023,"children":null},"AgentSendState":{"count":118,"self":0.0016319,"total":0.033648,"children":{"CollectObservations":{"count":472,"self":0.0283876,"total":0.0283876,"children":null},"WriteActionMask":{"count":472,"self":0.0005137,"total":0.0005137,"children":null},"RequestDecision":{"count":472,"self":0.0031148,"total":0.0031148,"children":null}}},"DecideAction":{"count":118,"self":0.0668677,"total":0.0668677,"children":null},"AgentAct":{"count":118,"self":0.2863591,"total":0.2863591,"children":null}},"gauges":{"SnakeAi.CumulativeReward":{"count":9,"max":-10,"min":-10,"runningAverage":-10,"value":-10,"weightedAverage":-10}},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1689076069","unity_version":"2023.1.3f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2023.1.3f1\\Editor\\Unity.exe -projectpath C:\\Users\\felix\\SnakeGame -useHub -hubIPC -cloudEnvironment production","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.3.0-exp.3","scene_name":"AI","end_time_seconds":"1689076086"}} | ||
{"count":1,"self":40.0425568,"total":40.238061599999995,"children":{"InitializeActuators":{"count":16,"self":0.0020276,"total":0.0020276,"children":null},"InitializeSensors":{"count":16,"self":0.0005068,"total":0.0005068,"children":null},"AgentSendState":{"count":60,"self":0.0030371,"total":0.070967099999999991,"children":{"CollectObservations":{"count":480,"self":0.0035174,"total":0.0035174,"children":null},"WriteActionMask":{"count":480,"self":0,"total":0,"children":null},"RequestDecision":{"count":480,"self":0.0644126,"total":0.0644126,"children":null}}},"DecideAction":{"count":60,"self":0.045922,"total":0.045922,"children":null},"AgentAct":{"count":60,"self":0.076081799999999991,"total":0.076081799999999991,"children":null}},"gauges":{"SnakeAi.CumulativeReward":{"count":106,"max":-0.003001213,"min":-10.008,"runningAverage":-9.815557,"value":-10.005,"weightedAverage":-10.0048523}},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1689087858","unity_version":"2023.1.3f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2023.1.3f1\\Editor\\Unity.exe -projectpath C:\\Users\\felix\\SnakeGame -useHub -hubIPC -cloudEnvironment production","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.3.0-exp.3","scene_name":"AI","end_time_seconds":"1689087899"}} |
Binary file not shown.
2 changes: 1 addition & 1 deletion
2
Assets/SnakeGame/_Levels/SnakeAi.onnx.meta → Assets/SnakeAi.onnx.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.