GameDesign: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 53:
and a we have created a PlayerEntry for this player with an unique correct clientid.
 
</pre>
 
<pre>
Process C2S ChooseCharacter ( STATE_LOGIN_COMPLETE )
Precondition: The state MUST be STATE_LOGIN_COMPLETE
Line 74 ⟶ 75:
should be completely filled or if the character choise was wrong the state is STATE_LOGIN_COMPLETE
 
</pre>
<pre>
 
Process C2S Logout ( STATE_GAME_END )
Line 93 ⟶ 96:
 
Postcondition: Either the same as the input state or the state currently in
 
</pre>
<pre>
 
Process C2S Perception ACK
Line 101 ⟶ 107:
Postcondition: The state is STATE_LOGIN_BEGIN and Timestamp field in
PlayerContainer is updated.
 
</pre>
<pre>
 
Process C2S Transfer ACK
Line 116 ⟶ 125:
</pre>
 
= Basic idea behind Database storage =
 
3.a ==Database Tables and Relationships ==
Last updated: 2003/10/07
 
The database table relationship schema is:
<pre>
 
Tables:
---------
 
Table PLAYER
{
Line 177 ⟶ 182:
PK(slot_id)
)
</pre>
 
 
Relationships:
<pre>
----------
Relationship PLAYER_CHARACTERS
{
Line 192 ⟶ 197:
PK(login_event_id)
}
</pre>
So we can translate this to SQL easily and we should create the following SQL Queries:
Translate this to SQL easily and you have the SQL schema of Marauroa
 
CREATE TABLE player
(
id BIGINT PRIMARY KEY NOT NULL,
username VARCHAR(30) NOT NULL,
password VARCHAR(30) NOT NULL
);
 
CREATE TABLE characters
(
player_id BIGINT NOT NULL,
charname VARCHAR(30) NOT NULL,
contents VARCHAR(4096)
 
PRIMARY KEY(player_id,character)
);
 
CREATE TABLE loginEvent
(
player_id BIGINT NOT NULL,
address VARCHAR(20),
timedate TIMEDATE,
result TINYINT
);
 
 
CREATE TABLE statistics
(
timedate TIMESTAMP,
 
bytes_send INTEGER,
bytes_recv INTEGER,
 
players_login INTEGER,
players_logout INTEGER,
players_timeout INTEGER,
players_online INTEGER,
 
PRIMARY KEY(timedate)
);
 
CREATE TABLE rpobject
(
id INTEGER NOT NULL PRIMARY KEY,
slot_id INTEGER
);
 
CREATE TABLE rpattribute
(
object_id INTEGER NOT NULL,
name VARCHAR(64) NOT NULL,
value VARCHAR(255),
PRIMARY KEY(object_id,name)
);
 
CREATE TABLE rpslot
(
object_id INTEGER NOT NULL,
name VARCHAR(64) NOT NULL,
slot_id INTEGER AUTO_INCREMENT NOT NULL,
 
PRIMARY KEY(slot_id)
);
Home
3.b JDBC Database HOWTO
Last updated: 2003/10/23
 
== JDBC Database HOWTO==
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 SQL databases, and now, with the new JDBC API, it also provides access to other tabular data sources, such as spreadsheets or flat files.
 
JDBCPlayerDatabase is anyway not database independent; on the Player table we are using AUTOINCREMENT that is a unique keyword of MySQL that is not part of the SQL standard.
 
You need to download MySQL Connector/J in order to get it to run. http://www.mysql.com/downloads/api-jdbc-stable.html.<br>
http://www.mysql.com/downloads/api-jdbc-stable.html
 
To configure Marauroa to work with a JDBC source we need to modify the configuration of the JDBC Connection.
 
So open the configuration file marauroad.ini file''(or any other)'' and edit the next fields
<pre>
 
marauroa_DATABASE=JDBCPlayerDatabase
 
Line 276 ⟶ 219:
jdbc_user=marauroa_dbuser
jdbc_pwd=marauroa_dbpwd
</pre>
 
jdbc_class is the field that says what Driver to use. Please refer to your software manual to see the multiple options.
 
jdbc_url points to the type and source of the information, for MySQL the string must be as follow:
 
jdbc:mysql://[ip:]database_name/
 
jdbc_user is the username for the database and jdbc_pwd is the password for that username in the database.
 
Line 286 ⟶ 232:
 
Before using the application with the database, you need to create the database itself. So in case of MySQL just open MySQL and write:
<pre>
 
create database marauroa;
grant all on marauroa.* to marauroa_dbuser@localhost identified by 'marauroa_dbpwd';
</pre>
 
The rest of code is handled by the server itself, and will create the tables if they don't exits.
 
Home
3.c PlayerContainer Explained
Last updated: 2003/10/23