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

Table of Contents

The Database Clients examples demonstrate how to query database information from a Python application.

Introduction

VR-Forces can be configured to log data to a SQL database for later analysis. For more information, see the documentation on the database logging capability.

This directory contains a few simple example Python scripts for accessing the data logged by VR-Forces into your database. The examples can be used with either SQLite or MySQL. Also included are a few files containing some utility functions that can be used in Python scripts.

Configuring

The vrfSql.ini file allows you to configure the database connection for the Python clients. It contains similar settings to those in databaseConfig.mtl. It also allows you to specify either database implementation that is included with VR-Forces: MySQL or SQLite. Just set the databaseType to either mysql or sqlite.

Prerequisites

If you are using MySQL, you will need to install the MySQL Connector for Python (pip install mysql-connector-python). VR-Forces uses version 8.4. Other versions may work, but are not tested. VR-Forces cannot log to MySQL out of the box. Please see the databaseConnection example for more details on how to add this capability.

Clients

  1. entityShootingStats.py - Displays a simple GUI to allow you to choose a scenario run and look at the results of all shots fired in that run. You can select multiple entities and graph their shooting statistics.
  2. printResources.py - Prints all resource amount events to the console.
  3. printSensors.py - Prints all sensor detection events to the console.
  4. printAnimals.py - Works in conjunction with the addDatabaseEvent example. Prints all animal creation events to the console.
  5. detectionStats.py - Shows entity detection statistics.

Utility Scripts

  1. vrfSql.py - Defines functions for connecting to a SQL database and performing queries. Just a wrapper to support either MySQL or SQLite.
  2. vrfMySql.py - Used by vrfSql.py for accessing a MySQL database.
  3. vrfSqlite.py - Used by vrfSql.py for accessing a SQLite database.
  4. vrfUtils.py - Contains utility functions for accessing and processing database data.

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)