This is a script that implements a Recurrent Neural Network (RNN) with reinforcement learning in C# for computer games developed in Unity. The script allows you to configure inputs and outputs, and it stores the weights in text files.
The RNNRLAgent class provides the core functionality for the RNN-based agent. It includes methods for forward propagation, backward propagation, and saving/loading weights. The class is designed to be integrated into Unity projects for creating intelligent bots or agents that can learn and make decisions based on the game environment.
- RNN architecture with configurable input size, hidden size, and output size.
- Forward propagation to compute output based on input vector.
- Backward propagation to update weights based on target output.
- Saving and loading weights from text files.
- Integration with Unity for game development.
-
Copy the
RNNRLAgent.cs
script into your Unity project. -
Create an instance of the
RNNRLAgent
class in your bot or agent script, and configure the input size, hidden size, and output size. -
Use the
ForwardPropagation
method to compute the output of the agent based on the input vector. -
Make decisions based on the output vector to control the behavior of your bot or agent.
-
Provide feedback to the agent using a scoring logic, and call the
BackwardPropagation
method to update the weights and reinforce learning. -
Use the
SaveWeights
andLoadWeights
methods to store and retrieve weights from text files, if needed.
This script is licensed under the MIT License.
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.