|
| 1 | +Running with a Standalone Environment from CLI |
| 2 | +============================================== |
| 3 | + |
| 4 | +Running Schola from the command line interface (CLI) is a powerful way to interact with the system. This guide will walk you through the steps to run Schola from the CLI, including how to set up your environment and execute commands. |
| 5 | + |
| 6 | + |
| 7 | +Building Your Environment |
| 8 | +------------------------- |
| 9 | + |
| 10 | +Before you can run a standalone executable from the Command-line with Schola, you need to build your environment into a standalone executable. This involves packaging your Unreal Engine project which is detailed in the `official unreal engine documentation <https://dev.epicgames.com/documentation/en-us/unreal-engine/packaging-unreal-engine-projects>`_. |
| 11 | + |
| 12 | +Running From CLI |
| 13 | +---------------- |
| 14 | + |
| 15 | +To launch a standalone environment (i.e. A game built in Development or Shipping mode), you can use the following command: |
| 16 | + |
| 17 | +.. tabs:: |
| 18 | + .. group-tab:: Stable Baselines 3 |
| 19 | + .. code-block:: bash |
| 20 | + |
| 21 | + schola-sb3 --launch-unreal --executable-path <PATH_TO_EXECUTABLE> |
| 22 | +
|
| 23 | + .. group-tab:: Ray |
| 24 | + .. code-block:: bash |
| 25 | + |
| 26 | + schola-rllib --launch-unreal --executable-path <PATH_TO_EXECUTABLE> |
| 27 | +
|
| 28 | +The `<PATH_TO_EXECUTABLE>` should be replaced with the path to your packaged Unreal Engine executable. |
| 29 | + |
| 30 | + |
| 31 | +Headless Mode |
| 32 | +~~~~~~~~~~~~~ |
| 33 | + |
| 34 | +Schola can be run in headless mode, which is useful for running scripts or automating tasks. To run Schola in headless mode, use the following command: |
| 35 | + |
| 36 | +.. tabs:: |
| 37 | + .. group-tab:: Stable Baselines 3 |
| 38 | + .. code-block:: bash |
| 39 | + |
| 40 | + schola-sb3 --launch-unreal --executable-path <PATH_TO_EXECUTABLE> --headless |
| 41 | +
|
| 42 | + .. group-tab:: Ray |
| 43 | + .. code-block:: bash |
| 44 | + |
| 45 | + schola-rllib --launch-unreal --executable-path <PATH_TO_EXECUTABLE> --headless |
| 46 | +
|
| 47 | +This command will start Schola without the graphical user interface (GUI), allowing for accelerated simulation speeds. |
| 48 | + |
| 49 | +.. note:: |
| 50 | + Any features requiring rendering will not work when running in headless mode (e.g. :cpp:class:`CameraObserver <UCameraObserver>`). |
| 51 | + |
| 52 | +Fixed Simulation Timestep |
| 53 | +~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 54 | + |
| 55 | +Schola allows you to set a fixed frames per second (FPS) for the simulation. This can be useful for ensuring consistent performance across different runs. To set a fixed FPS, use the following command: |
| 56 | + |
| 57 | +.. tabs:: |
| 58 | + .. group-tab:: Stable Baselines 3 |
| 59 | + .. code-block:: bash |
| 60 | + |
| 61 | + schola-sb3 --launch-unreal --executable-path <PATH_TO_EXECUTABLE> --fps <FPS> |
| 62 | +
|
| 63 | + .. group-tab:: Ray |
| 64 | + .. code-block:: bash |
| 65 | + |
| 66 | + schola-rllib --launch-unreal --executable-path <PATH_TO_EXECUTABLE> --fps <FPS> |
| 67 | +
|
| 68 | +Replace `<FPS>` with the desired frames per second value. For example, to set the FPS to 30, use: |
| 69 | + |
| 70 | +.. tabs:: |
| 71 | + .. group-tab:: Stable Baselines 3 |
| 72 | + .. code-block:: bash |
| 73 | + |
| 74 | + schola-sb3 --launch-unreal --executable-path <PATH_TO_EXECUTABLE> --fps 30 |
| 75 | +
|
| 76 | + .. group-tab:: Ray |
| 77 | + .. code-block:: bash |
| 78 | + |
| 79 | + schola-rllib --launch-unreal --executable-path <PATH_TO_EXECUTABLE> --fps 30 |
| 80 | +
|
| 81 | +.. note:: |
| 82 | + The FPS determines the delta used when calculating updates in Unreal Engine, however the number of timesteps simulated per second is independant of this setting. For example if `--fps=100` and Unreal simulates your environment at 1000fps then for every second in the real world, 10 seconds in the environment will be simulated. |
| 83 | + |
| 84 | +Controlling The Map |
| 85 | +~~~~~~~~~~~~~~~~~~~ |
| 86 | + |
| 87 | +Schola allows you to specify the map to load when launching the environment. To do this, use the `--map` argument followed by the path to the map. For example: |
| 88 | + |
| 89 | +.. tabs:: |
| 90 | + .. group-tab:: Stable Baselines 3 |
| 91 | + .. code-block:: bash |
| 92 | + |
| 93 | + schola-sb3 --launch-unreal --executable-path <PATH_TO_EXECUTABLE> --map <MAP_NAME> |
| 94 | +
|
| 95 | + .. group-tab:: Ray |
| 96 | + .. code-block:: bash |
| 97 | + |
| 98 | + schola-rllib --launch-unreal --executable-path <PATH_TO_EXECUTABLE> --map <MAP_NAME> |
| 99 | +
|
| 100 | +The map should be specified as a relative path from the `Content` folder, with content replaced with `Game` For exammple `/Content/LevelOne/Map` would be specified as `Game/LevelOne/Map`. |
| 101 | + |
| 102 | +.. note:: |
| 103 | + The map must be a valid Unreal Engine map file. If the map is not found or isn't specified, Schola will default to the main map specified in the project settings. |
| 104 | + |
| 105 | +.. note:: |
| 106 | + The map parameter will not work with Shipping builds by default, you need to take additional steps to allow the map to be loaded based on a command line flag. |
| 107 | + |
| 108 | + |
| 109 | +Additional Settings |
| 110 | +~~~~~~~~~~~~~~~~~~~ |
| 111 | + |
| 112 | +For details on settings specific to Stable Baselines 3 and RLLib see, :doc:`/scripts/schola-rllib` and :doc:`/scripts/schola-sb3` respectively. |
0 commit comments