GameDesign: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
No edit summary
No edit summary
Line 53: Line 53:
and a we have created a PlayerEntry for this player with an unique correct clientid.
and a we have created a PlayerEntry for this player with an unique correct clientid.


</pre>

<pre>
Process C2S ChooseCharacter ( STATE_LOGIN_COMPLETE )
Process C2S ChooseCharacter ( STATE_LOGIN_COMPLETE )
Precondition: The state MUST be STATE_LOGIN_COMPLETE
Precondition: The state MUST be STATE_LOGIN_COMPLETE
Line 74: Line 75:
should be completely filled or if the character choise was wrong the state is STATE_LOGIN_COMPLETE
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 )
Process C2S Logout ( STATE_GAME_END )
Line 93: Line 96:


Postcondition: Either the same as the input state or the state currently in
Postcondition: Either the same as the input state or the state currently in

</pre>
<pre>


Process C2S Perception ACK
Process C2S Perception ACK
Line 101: Line 107:
Postcondition: The state is STATE_LOGIN_BEGIN and Timestamp field in
Postcondition: The state is STATE_LOGIN_BEGIN and Timestamp field in
PlayerContainer is updated.
PlayerContainer is updated.

</pre>
<pre>


Process C2S Transfer ACK
Process C2S Transfer ACK
Line 116: Line 125:
</pre>
</pre>


= Basic idea behind Database storage =

3.a Database Tables and Relationships
==Database Tables and Relationships ==
Last updated: 2003/10/07


The database table relationship schema is:
The database table relationship schema is:
<pre>

Tables:
---------

Table PLAYER
Table PLAYER
{
{
Line 177: Line 182:
PK(slot_id)
PK(slot_id)
)
)
</pre>



Relationships:
Relationships:
<pre>
----------
Relationship PLAYER_CHARACTERS
Relationship PLAYER_CHARACTERS
{
{
Line 192: Line 197:
PK(login_event_id)
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.
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.
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.
You need to download MySQL Connector/J in order to get it to run. <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.
To configure Marauroa to work with a JDBC source we need to modify the configuration of the JDBC Connection.


So open marauroad.ini file and edit the next fields
So open the configuration file marauroad.ini ''(or any other)'' and edit the next fields
<pre>

marauroa_DATABASE=JDBCPlayerDatabase
marauroa_DATABASE=JDBCPlayerDatabase


Line 276: Line 219:
jdbc_user=marauroa_dbuser
jdbc_user=marauroa_dbuser
jdbc_pwd=marauroa_dbpwd
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_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_url points to the type and source of the information, for MySQL the string must be as follow:


jdbc:mysql://[:]/
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.
jdbc_user is the username for the database and jdbc_pwd is the password for that username in the database.


Line 286: Line 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:
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;
create database marauroa;
grant all on marauroa.* to marauroa_dbuser@localhost identified by 'marauroa_dbpwd';
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.
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
3.c PlayerContainer Explained
Last updated: 2003/10/23
Last updated: 2003/10/23