Debugging & Tools

Project DVN

This document describes debugging and performance profiling tools.

Contents


Debug Input

In the game view (visual novel view) you can eanble certain debug features with the following hot-keys:

  • Toggle Debug Panel: F2
  • Refresh current scene: F5
  • Skip to next choice: F1
  • Load last save point: F9

Debug console

There are two ways to get a debugging console in DVN.

Sometimes it might be useful to have both.

Built-in console

Simply create a file called debug.txt in the root of your game and a console will be opening up when you launch the application.

This is useful to get a debugging console without building DVN.

This is generally how debugging information is logged in DVN.

The built-in console has the following functions you can use to log with:

void logInfo(string msg);
void logWarning(string msg);
void logError(string msg);
void logDialogue(string msg);
void logNetwork(string msg);

void logInfo(Char, Args...)(in Char[] fmt, Args args);
void logWarning(Char, Args...)(in Char[] fmt, Args args);
void logError(Char, Args...)(in Char[] fmt, Args args);
void logDialogue(Char, Args...)(in Char[] fmt, Args args);
void logNetwork(Char, Args...)(in Char[] fmt, Args args);

void printLineToConsoleColor(Char, Args...)(in Char[] fmt, string color, Args args);
void printLineToConsole(Char, Args...)(in Char[] fmt, Args args);
void printLineToConsole(string msg, string color = "fff");

Native console

DVN supports a native console too, on Windows you need to disable the subsystem and do a small change in main.d

In dub.json change this line:

"lflags": ["/LIBPATH:libs_derelict_sdl", "/SUBSYSTEM:windows"]

To this:

"lflags": ["/LIBPATH:libs_derelict_sdl"]

Then open source/main.d and change this line:

version (Windows)

To this:

version (WindowsEx)

Afterwards build DVN and a console should pop up.

This is useful for real-time logging or if you need to log certain things yourself that can't be run on the main UI thread.

Performance profiling

If you need to profile your application then it is generally recommended to use the built-in profiler the D compiler has.

Please consult the documentation here for more information: https://wiki.dlang.org/Development_tools#Profiling