VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Database Logger

Overview

The Database Logger allows developers to save data to an SQL database. The built-in implementation outputs data to an SQLite database file. However, an example plugin, databaseConnection, implements a connection to a MySQL database server. This example could serve as a starting point for developing further database connection implementations.

Configuration

To enable database logging, you must configure it in ./appData/settings/databaseConfig.mtl. This file is commented to indicate what each parameter does. The key parameters to set for basic functionality are database-logger-type and database-connection-type.

Once configured, the next time you start VR-Forces it will automatically begin writing the the configured SQLite file or connecting and outputting to the configured MySQL server.

Database Tables and Events

VR-Forces outputs a number of tables of data by default. Each table corresponds to some event in the simulation. Some events are written for EntityLevel simulations, others for AggregateLevel simulations, and some are valid for both. For a full list of the default database events, please refer to VR-Forces Database Events.

Developers can also add their own database events. There are two ways to do this.

  1. New events can be registered and logged in C++ plugins. Please see the addDatabaseEvent example for more details.
  2. New events can be logged in Lua scripts via the vrf:logEventToDatabase() function. If you are logging events in Lua, you must first register them. This is most easily done by adding the new event type to additional-event-types in the databaseConfig.mtl file. Please see the Lua documentation for more details on this function and its usage.

Reading Data from the Database

VR-Forces does not provide any out-of-the-box reading or analysis tools for database logging. SQLite and MySQL both have many existing tools available for general database browsing. If you wish to perform specific analysis of the data, VR-Forces provides several simple example Python scripts. Please refer to the databaseClients examples for more information.

Important Classes

The following is a list of the important classes in the sim engine for performing database logging. Please see the documentation on these classes for further details.


Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)