InitialStepsWithMarauroa: Difference between revisions
No edit summary |
imported>Kymara m →Create server.ini file: can't remember how to do wiki links, blah |
||
| (194 intermediate revisions by 12 users not shown) | |||
| Line 1: | Line 1: | ||
{{Navigation for Marauroa Top|Using}} |
|||
{{Navigation for Marauroa Users}} |
|||
OK, you have successfully compiled Marauroa and are wondering what to do next? |
OK, you have successfully compiled Marauroa and are wondering what to do next? |
||
<pre> |
<pre> |
||
| Line 6: | Line 10: | ||
Nice, isn't it? |
Nice, isn't it? |
||
Basically, if you have built a Marauroa server it must be because you either want to play with the server a bit yourself or because you want to run your own game server or because you are a developer who wishes to develop your own game. |
|||
If you want to run a [[Stendhal]] Server then this is not the guide for you. You do not need to run marauroa separately of the Stendhal Server, please see [[Host a Stendhal Server]] instead. |
|||
If you are none of the above it is possible you are looking for http://arianne.sourceforge.net instead. |
|||
If none of the above apply it is possible you are looking for http://arianne.sourceforge.net instead. |
|||
=Configuration= |
|||
Once we have built Arianne the next step is to setup the configuration file. |
|||
Each game must have a configuration file that will configure the server to run that particular game. Here is an example: |
|||
=Configuration= |
|||
== Create a MySQL database and user == |
|||
Run the sql client (bin/mysql.exe on the windows noinstall package). |
|||
Replace <user> and <password> with the desired values and paste the following lines to the prompt that opens: |
|||
<pre> |
<pre> |
||
create database marauroa; |
|||
# Please don't remove. Needed for test cases. |
|||
grant all on marauroa.* to <user>@localhost identified by '<password>'; |
|||
test_ATestString=ATestString |
|||
# The database type |
|||
# Options are: |
|||
# - MemoryPlayerDatabase |
|||
# - JDCBPlayerDatabase |
|||
marauroa_DATABASE=MemoryPlayerDatabase |
|||
# JDBC Database configuration |
|||
jdbc_url=jdbc:mysql://127.0.0.1/marauroa |
|||
jdbc_class=com.mysql.jdbc.Driver |
|||
jdbc_user=marauroa_dbuser |
|||
jdbc_pwd=marauroa_dbpwd |
|||
# Network configuration of Marauroa |
|||
marauroa_PORT=3214 |
|||
# RP Configuration ( This is provisional ) |
|||
rp_RPZoneClass=marauroa.game.MarauroaRPZone |
|||
rp_RPRuleProcessorClass=marauroa.game.MarauroaRPRuleProcessor |
|||
rp_RPAIClass=marauroa.game.MarauroaRPAIManager |
|||
rp_turnDuration=1000 |
|||
syncPerception_frecuency=30 |
|||
python_script= |
|||
python_script_rules_class= |
|||
python_script_zone_class= |
|||
python_script_ai_class= |
|||
bannedIPNetworkList= |
|||
# Server related configuration |
|||
# Types of game are: |
|||
# - marauroa |
|||
# - simplegame |
|||
# - the1001 |
|||
# Changes should be related to rp_RPZoneClass and rp_RPRuleProcessorClass |
|||
server_typeGame=marauroa |
|||
server_name=Marauroa jserver |
|||
server_version=@version@ |
|||
server_contact=https://sourceforge.net/tracker/?atid=514826&group_id=66537&func=browse |
|||
# Place where Statistics and server activity report are generated. |
|||
server_stats_directory=~/public_html |
|||
server_logs_directory=~/.marauroa |
|||
</pre> |
|||
Let look at each section individually. <br> |
|||
==Database== |
|||
Our first item is *marauroa_DATABASE*, this attribute sets the type of database that you will use: |
|||
* MemoryPlayerDatabase, this type of database is prebuilt in memory and so to modify it you need to recompile the server and manually edit sources to add new accounts. Obviously when application is shut down everything that has been modified is discarded. |
|||
* JDBCPlayerDatabase, this is mainly a MySQL database. It won't run as-is on other SQL compliant databases because it uses MySQL features as special tables types to get transactions and auto_increment column types to generate pk. |
|||
My recomendation is that you should embrace MySQL and choose JDBCPlayerDatabase. |
|||
The next section describes the connection string to the database. |
|||
* jdbc_url=jdbc:mysql://127.0.0.1/marauroa<br>This attribute explains where the database is running _(127.0.0.1)_and the name of the database _(marauroa)_. |
|||
* jdbc_class=com.mysql.jdbc.Driver<br>this is the class that describes the driver used for this JDBC connection |
|||
* jdbc_user=marauroa_dbuser<br>username of the database account for marauroa |
|||
* jdbc_pwd=marauroa_dbpwd<br>password of the database account for marauroa |
|||
Remember that to setup the database you need to log in to MySQL as administrator: |
|||
<pre> |
|||
mysql -u root |
|||
</pre> |
</pre> |
||
It should produce output similar to this: |
|||
And after that run: |
|||
<pre> |
<pre> |
||
Welcome to the MySQL monitor. Commands end with ; or \g. |
|||
create database marauroa; |
|||
Your MySQL connection id is 1 to server version: 4.1.10 |
|||
grant all on marauroa.* to marauroa_dbuser@<serverip> identified by 'marauroa_dbpwd'; |
|||
Type 'help;' or '\h' for help. Type '\c' to clear the buffer. |
|||
mysql> create database marauroa; |
|||
Query OK, 1 row affected (0.03 sec) |
|||
mysql> grant all on marauroa.* to stendhal_user@localhost identified by 'stendhal_passwd'; |
|||
Query OK, 0 rows affected (0.00 sec) |
|||
mysql> |
|||
</pre> |
</pre> |
||
The marauroa_PORT section defines which TCP/IP port it will use. '''All''' the traffic of Marauroa is UDP based. |
|||
== Create server.ini file == |
|||
The next section talks about the Role playing engine configuration: |
|||
* rp_RPZoneClass points to the class that contains our game RPZone logic |
|||
* rp_RPRuleProcessorClass points to the class that contains our game RPRuleProcessor logic |
|||
* rp_turnDuration defines the turn time. The lower the turn time the more bandwidth that will be generated. |
|||
* syncPerception_frecuency defines the time frame that a player have to wait before a sync perception comes and he/she so can login into the system. |
|||
If you don't have a game yet, see [[ClientServerChatExample|Marauroa Tutorial]] for how to generate a minimum server.ini and how to write the two required classes. |
|||
The available games currently are: |
|||
* the1001 |
|||
* mapacman |
|||
To create the marauroa.ini file you need to can write it by hand, copy from another place or use your game application to generate it.<br> |
|||
The gane should be set with server_typeGame |
|||
Please refer to your game documentation about how to write it. |
|||
Stendhal Documentation: [[VisualGuideToInstallingStendhalStep5]] |
|||
The server section contains information that will be sent to the clients using the Server info message. Whatever begins with server_ is sent on this message to the clients. |
|||
Finally you should define where the output of statistics and logs messages should be done: |
|||
* server_stats_directory defines the folder where the statistics files are generated, usually a public HTML folder. |
|||
* server_logs_directory defines where to store the logs. Please keep this one safe and private. |
|||
=Running= |
=Running= |
||
Once you have it configured, just run the server by executing: |
Once you have it configured, just run the server by executing: |
||
<pre> |
<pre> |
||
java -classpath |
java -classpath .;mysql-connector-java-3.0.7-stable-bin.jar;log4j.jar;marauroa.jar marauroa.server.marauroad -c <server.ini> |
||
</pre> |
</pre> |
||
Make sure that you have the MySQL running too. Marauroa will build all the needed table structure for itself. |
|||
''NOTE'': On Unix use : instead of ; to define the classpath. |
|||
This will start Marauroa |
|||
''NOTE'': You may change what it is logged by default, so you need to edit the log4j.properties file. |
|||
=Creating accounts= |
|||
For example: |
|||
Before anything else, you MUST create accounts for your players. The idea is simple enough, you can even wrap it in to a webpage interface, much like we did with http://gladiators.game-server.cc |
|||
<pre> |
<pre> |
||
# Set root logger level to DEBUG and its only appender to A1. |
|||
<game>.<game>createaccount -u <user> -p <password> -c <character> -e <email> |
|||
log4j.rootLogger=INFO, Console, File |
|||
</pre> |
|||
# Paste all logger entries with a threshold of WARN to the console |
|||
log4j.appender.Console=org.apache.log4j.ConsoleAppender |
|||
log4j.appender.Console.layout=org.apache.log4j.PatternLayout |
|||
log4j.appender.Console.layout.ConversionPattern=%-4r %-5p %c %x - %m%n |
|||
log4j.appender.File=org.apache.log4j.DailyRollingFileAppender |
|||
log4j.appender.File.File=server.log |
|||
log4j.appender.File.layout=org.apache.log4j.PatternLayout |
|||
log4j.appender.File.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n |
|||
# Disabled debug messages for stendhal...some 10 thousand logs each minute is |
|||
For example in mapacman: |
|||
# way too much |
|||
<pre> |
|||
log4j.logger.marauroa.server.game.RPServerManager=WARN |
|||
mapacman.mapacmancreateaccount -u root -p pazzw0rd -c MaSSive -e root@localhost.com |
|||
</pre> |
</pre> |
||
Each game has a different number of parameters, check them out with the -h parameter. |
|||
Make sure that you have the MySQL server running too. Marauroa will build all the needed table structure for itself. |
|||
=Testing= |
|||
To test that your connection is working use nullClient. It is a simple client that connects to the server, chooses a character and receives perceptions. If it works it means that everything else is also working. |
|||
This will start Marauroa. |
|||
<pre> |
|||
java -classpath marauroa.jar marauroa.nullClient root pazzw0rd MaSSive |
|||
Now refer to game documentation about how to start the game server and how to create accounts and so on. |
|||
</pre> |
|||
[[Category:Marauroa]] |
|||
=Playing with clients= |
|||
{{#breadcrumbs: [[Marauroa]] | [[Navigation for Marauroa Users|Using]] | [[InitialStepsWithMarauroa|Initial Steps]]}} |
|||
Please read the client pages at http://arianne.sourceforge.net |
|||
Latest revision as of 10:09, 2 December 2010
OK, you have successfully compiled Marauroa and are wondering what to do next?
BUILD SUCCESSFUL Total time: 3 seconds
Nice, isn't it? Basically, if you have built a Marauroa server it must be because you either want to play with the server a bit yourself or because you want to run your own game server or because you are a developer who wishes to develop your own game.
If you want to run a Stendhal Server then this is not the guide for you. You do not need to run marauroa separately of the Stendhal Server, please see Host a Stendhal Server instead.
If none of the above apply it is possible you are looking for http://arianne.sourceforge.net instead.
Configuration
Create a MySQL database and user
Run the sql client (bin/mysql.exe on the windows noinstall package). Replace <user> and <password> with the desired values and paste the following lines to the prompt that opens:
create database marauroa;
grant all on marauroa.* to <user>@localhost identified by '<password>';
It should produce output similar to this:
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 4.1.10 Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> create database marauroa; Query OK, 1 row affected (0.03 sec) mysql> grant all on marauroa.* to stendhal_user@localhost identified by 'stendhal_passwd'; Query OK, 0 rows affected (0.00 sec) mysql>
Create server.ini file
If you don't have a game yet, see Marauroa Tutorial for how to generate a minimum server.ini and how to write the two required classes.
To create the marauroa.ini file you need to can write it by hand, copy from another place or use your game application to generate it.
Please refer to your game documentation about how to write it.
Stendhal Documentation: VisualGuideToInstallingStendhalStep5
Running
Once you have it configured, just run the server by executing:
java -classpath .;mysql-connector-java-3.0.7-stable-bin.jar;log4j.jar;marauroa.jar marauroa.server.marauroad -c <server.ini>
NOTE: On Unix use : instead of ; to define the classpath.
NOTE: You may change what it is logged by default, so you need to edit the log4j.properties file. For example:
# Set root logger level to DEBUG and its only appender to A1. log4j.rootLogger=INFO, Console, File # Paste all logger entries with a threshold of WARN to the console log4j.appender.Console=org.apache.log4j.ConsoleAppender log4j.appender.Console.layout=org.apache.log4j.PatternLayout log4j.appender.Console.layout.ConversionPattern=%-4r %-5p %c %x - %m%n log4j.appender.File=org.apache.log4j.DailyRollingFileAppender log4j.appender.File.File=server.log log4j.appender.File.layout=org.apache.log4j.PatternLayout log4j.appender.File.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n # Disabled debug messages for stendhal...some 10 thousand logs each minute is # way too much log4j.logger.marauroa.server.game.RPServerManager=WARN
Make sure that you have the MySQL server running too. Marauroa will build all the needed table structure for itself.
This will start Marauroa.
Now refer to game documentation about how to start the game server and how to create accounts and so on. {{#breadcrumbs: Marauroa | Using | Initial Steps}}