Marauroa Database Structure

From Arianne
Revision as of 11:29, 26 February 2010 by imported>Hendrik Brummermann
Jump to navigation Jump to search



This article describes the table structure of the Marauroa database. You might want to have a look at High Level Database Access which explains the high level API to access the database from your program code. The article Low Level Database Access describes how Marauroa accesses the database internally and how you can add support for your own tables.


Accounts

 

Authentication information is stored in the table account. It consists of the username, the password hash, email address and the timestamp of the account creation.

Bans

 

RPObjects

 

Game Logging

 

The whole picture

 

Other stuff

{{Move everything below these lines into the Database Access article}}

JDBC Database HOWTO

TODO: Update to reflect DAOs

TODO: Add H2

JDBC technology is an API that lets you access virtually any tabular data source from the Java programming language. It provides cross-DBMS connectivity to a wide range of relational databases. Unfortunatally it does not hide vendor specific stuff. Marauroa and Stendhal currently only work with MySQL because of that. Adding support for other database software would be very easy as the database specific code is concentrated in the classes JDBCDatabase (Marauroa) and StendhalPlayerDatabase (Stendhal). We have no need for that, so it was not done, yet. We will, however, accept patches for multi database system support, so if you need it, go ahead.


You need to download MySQL Connector/J in order to get it to run: http://www.mysql.com/downloads/api-jdbc-stable.html

To configure Marauroa to work with a JDBC source, run the appropriate GenerateINI program. For Stendhal this is games.stendhal.server.core.engine.GenerateINI.

Before using the application with the database, you need to create the database itself. So, with MySQL just run MySQL and enter:

create database stendhal;
grant all on stendhal.* to stendhal_user@localhost identified by 'stendhal_passwd';

The rest of code is handled by the server itself, and it will create the tables if they don't exist.

Storing objects in the database

Objects are stored in the database to save their state. This is an expensive operation, so it is only done every 10 minutes or on special events (like logout).

This decision is made in RPManager. It calculates how often an object has to be stored.

Marauroa knows two types of objects which can be stored to the database: players and zones. Both objects can contain other objects: Players have items in their bags, zones can contain objects that are flagged as storable.