# Testing & Debugging

## Testing In Editor

You can test all primary features of Kronos directly in the editor with the **Null Online Subsystem** by running two or more players in **Standalone Game** mode.

<div align="center"><figure><img src="https://3833329260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfIkwZ5xO6YLccFyQBEgv%2Fuploads%2FSJs5MUhuWuH7Hb93yhQT%2FTestInEditor.jpg?alt=media&#x26;token=5f29358b-62db-461f-a6bb-bc1882992222" alt=""><figcaption></figcaption></figure></div>

In order to run multiple games properly, make sure to use **Standalone Game** mode. Another important option is in the _"Advanced Settings"_ under the multiplayer options disable **Run Under One Process**.&#x20;

{% hint style="info" %}
**TIP:** You only need to do this to test matchmaking and party functionality! In case you just want to start two players in a specific map to test gameplay functionality, feel free to use your preferred options.

I prefer using the **New Editor Window (PIE)** mode with **Run Under One Process** option enabled when no matchmaking functionality is needed for the test.
{% endhint %}

While testing in the editor be wary of **network ports** hiding each other. For example, if you have two `KronosPartyHost` beacons listening on the same port then they'll basically hide each others channels and only one of them will work. As a general rule of thumb, only one session of the same type should be hosted on the same PC at the same time.

## Using the Null Subsystem

While developing and testing the game inside the editor, you should always use the **Null Online Subsystem**. This is an IP based Online Subsystem that is meant to be used for testing purposes. You can find the necessary configurations for this Online Subsystem in the [**Project Configuration**](../configuration#project-configuration) section of the documentation.

<figure><img src="https://3833329260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfIkwZ5xO6YLccFyQBEgv%2Fuploads%2FMvF9LyMk18BxTRPMuClX%2FNullOnlineSubsystemConfig.jpg?alt=media&#x26;token=c6850332-5c0a-4f6b-aa78-4c3cc0800a19" alt=""><figcaption></figcaption></figure>

I usually have both **Online Subsystems** configured (leaving net drivers as is) and just switch between them before packaging the project. In most cases you don't even have to change anything else in `DefaultEngine.ini`.

{% hint style="danger" %}
**Limitations of the Null Online Subsystem:**

* Session operations are limited to the local network (LAN)
* Session searches are slow
* Session settings are only updated locally, meaning remote players won't see the changes if session settings are updated by the host
* Session invites are not supported
{% endhint %}

## Debugging

### Viewing Output Logs

One of the best ways to see what's going on behind the scenes is by looking at the logs. I recommend enabling **realtime logging** for the project.

<figure><img src="https://3833329260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfIkwZ5xO6YLccFyQBEgv%2Fuploads%2FCZuSAqHnPswv8xWNaZg1%2FLogsWindow.jpg?alt=media&#x26;token=4ba7f712-71a0-411f-a09d-9e504d9f9a7f" alt=""><figcaption></figcaption></figure>

Go to **Edit -> Editor Preferences -> Play** and write `-LOG` in the _"Additional Launch Parameters"_ field. This will tell the engine to open a separate window that displays the contents of the log in real time for each instance of the game (when using the **Standalone Game** play mode).

The plugin uses a custom log category called `LogKronos`. The verbosity of this category can be increased to display more information by adding the following option to the project's `DefaultEngine.ini` file:

```ini
[Core.Log]
LogKronos=Verbose
```

<details>

<summary><strong>Viewing Logs For Packaged Projects</strong></summary>

The log window can also be used to debug packaged projects. I recommend using a simple batch script to launch the game with logging enabled. Copy the following code into a `.txt` file, replace `"MyGame"` with your project's name, and save the file as `Launcher.bat`.

```batch
@echo off
:: start the game in windowed mode with logging enabled
:: replace "MyGame" with your project's name
start MyGame.exe -ResX=1280 -ResY=720 -WINDOWED -LOG
```

Alternatively, you can create a shortcut to the game's exe, open its properties and write additional launch params at the end of the _"Target"_ field.

</details>

### Using The Gameplay Debugger

As of version 1.7.0, you can also use the **Gameplay Debugger** of Unreal Engine to view real-time matchmaking and sessions information directly on the screen.

<figure><img src="https://3833329260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfIkwZ5xO6YLccFyQBEgv%2Fuploads%2FNUOigdGxpaj0k7z6a7AC%2FGameplayDebugger.jpg?alt=media&#x26;token=dd36f308-fc2c-49c5-9423-72dd62985237" alt=""><figcaption></figcaption></figure>

The **Gameplay Debugger** can be activated with the apostrophe (') key by default, or with the `EnableGDT` console command. The default visibility of the plugin's debug category can be edited in the "Gameplay Debugger" section of the Project Settings.

{% hint style="info" %}
**NOTE:** The Gameplay Debugger will not react to any input if the game is in "UI Only Input Mode" (e.g. in the main menu). In that case, you'll have to **use the console** to open the debugger.
{% endhint %}

### Console Commands

The plugin has some built in console commands that can help with debugging as well. The console can be opened with the tilde (\~) key by default.

* `kronos.LeaveMatch`: Leave the current match and return to main menu.
* `kronos.LeaveParty`: Leave the current party.
* `kronos.SetLobbyTimer`: Change the current countdown time in the lobby.
* `kronos.LobbyStartMatch`: Start the match immediately regardless of lobby state.
* `kronos.DumpMatchmakingState`: Dumps current matchmaking state to the console.
* `kronos.DumpMatchmakingSettings`: Dumps current matchmaking settings to the console.
* `kronos.DumpPartyState`: Dumps current party state to the console.
* `kronos.DumpReservations`: Dumps reservations to the console.
