Skip to content

Schola is a plugin for enabling Reinforcement Learning (RL) in Unreal Engine. It provides tools to help developers create environments, define agents, and connect to python-based RL frameworks such as OpenAI Gym, RLlib or Stable Baselines 3 for training agents with RL.

License

Notifications You must be signed in to change notification settings

GPUOpen-LibrariesAndSDKs/Schola

Repository files navigation

Schola

The Schola project is an effort to build a toolkit/plugin for controlling Objects in Unreal with Reinforcement Learning. It provides tools to help the user create Environments, define Agents, connect to python based RL Frameworks (e.g. Gym, RLLib or Stable Baselines 3), and power NPCs with RL during games.

Getting Started

Install Unreal Engine

As Schola is an Unreal Engine Project, you will need to first install Unreal Engine. Refer to the below table to identify the correct version of Unreal Engine for each version of Schola.

Note

Each Schola release may be compatible with other versions of Unreal Engine beyond the ones listed here, however these are the version(s) tested for each release.

Schola version Unreal Version
2.0 5.5-5.6
1.3 5.5-5.6
1.2 5.5
1.1 5.5
1.0 5.4

Installing Schola Into Your Project

To use schola in an existing Unreal Engine Project copy this repository to the /Plugins folder of your project, and pip install the schola python package in /Resources/python using pip install -e <path to folder containing setup.py>[all].

Important

Since Schola is provided as C++ source you must recompile your project after adding it. Otherwise, you will receive a warning about Schola being built for another version of Unreal Engine regardless of what version you are using.

Dependencies

Python

See setup.py for a comprehensive list of dependencies. The following flags are available when installing via pip:

Flag Desc
"sb3" Installs dependencies for running training with StableBaselines 3
"rllib" Installs dependencies for running training with RLlib
"minari" Installs dependencies for collecting Minari datasets with Schola
"all" Installs for setting sb3, rllib and imitation flags.
"docs" Installs dependencies for building documentation with Sphinx
"test" Installs pytest and dependencies for running the tests

C++

All C++ dependencies for using Schola are bundled with the plugin under /Source/ThirdParty and do not need to be installed separately. These consist of gRPC, protobuf and absl(dependency of gRPC).

Build and Test

Important

Schola comes with all dependencies included. Only run these if you encounter issues during the setup.

Building Third Party Dependencies

Third party dependencies, specifically gRPC and Protobuf can be built using Schola\Plugins\Schola\Resources\Build\windows_dependencies.bat or Schola\Plugins\Schola\Resources\Build\linux_dependencies.sh depending on your OS. This will update the plugin ThirdParty folder to include copies of the dependencies including .lib/.a files, and copy protoc, and relevant plugins to the tools directory.

Generating gRPC/Protobuf Code

To generate code for gRPC and Protobuf run schola compile-proto. This will generate *.pb.cc, *.pb.h and *.pb.py files to the correct folders as well as fix several bugs in the default generator (e.g. ignore warnings in C++ code, and fix relative imports for python)

Generating Documentation

Documentation for Schola is build using a combination of Doxygen + Sphinx + Breathe.

  1. Install Doxygen from the website
  2. Install documentation requirements for Schola using pip pip install -e .<Path to schola python package>[docs]
  3. Run the command schola build-docs --builder html from the root of this project (or supply the path to the plugin folder)

Contributing

Unreal Coding Style

All unreal code with be styled following the Unreal Style Guide in the Unreal Documentation.

One potential auto-formatter is the Clang Formatter which has visual studio support.

Comments

Comments are based on doxygen /** style to match closely with javadoc (which Unreal uses) but support handy visual studio features such as comment previews. To enable autogenerated doxygen stubs go to Tools -> Options -> Text Editor -> C/C++ -> Code Style -> General and change the option from XML to Doxygen (/**). This will enable autogeneration of stubs with ctrl + /, or whenever you type /** in visual studio.

Python Coding Style

All python code will be styled( and formatted) following the Black style guide. Code style: black as well as pep.

Black has an automatic formatter as well as Visual Studio support.

Comments

Docstrings in python are in numpydoc style and can use any rst directives supported by sphinx. Inherited functions and members can be left undocumented if the implementation doesn't require any additonal details to explain.

Testing

Schola includes unit tests for both python and C++ source. The primary method of testing is using python+pytest, even for the C++ code. Python only tests are available in the /Test folder. C++ tests are implemented for each module as Unreal Automation tests in Source/<Module>/Private/Test and will be collected and invoked by Pytest. These tests are also available through the editor.

About

Schola is a plugin for enabling Reinforcement Learning (RL) in Unreal Engine. It provides tools to help developers create environments, define agents, and connect to python-based RL frameworks such as OpenAI Gym, RLlib or Stable Baselines 3 for training agents with RL.

Resources

License

Stars

Watchers

Forks

Packages

No packages published