This page describes the steps required to create your Play By E-Mail game using the PBEM Engine. Each step will be described in as much detail as possible, linking to other pages if necessary.
Please make sure you have the proper tools installed, and have mastered the proper skills to make a PBEM game. Also, please keep in mind that the PBEM Engine developers have their own projects and hobbies to worry about, so even if you have an awesome idea for a PBEM, you'll probably have to build it yourself. So, before you start, please use the following checklist:
If for some reason you can't figure out what to do next, or the Engine is giving you unexpected errors, feel free to contact us on our Ruleset Developers mailing list. If you find a bug with the software you can post a bug report on our issue tracking site.
This section describes the first steps required to create your own PBEM. We will assume you have the following tools installed:
And before we go any further, we want to explain some basic terminology:
| Word | Meaning |
|---|---|
| PBEM | Play By E-Mail game, a game played by sending and receiving e-mails |
| Ruleset | An implementation of a PBEM for use with the Engine. Basically a plugin that runs on top of the Engine, and uses it for most tasks |
| Turn | The simultaneous processing of all major player actions within a game |
| Check action | Each time the Engine checks if it has received any e-mails, it will also, for each received e-mail, check if it contains any commands it can process. The process of checking for and processing of received e-mails is called a Check Action |
| Process action | The processing of a turn is called a Process Action. All game-specific logic is carried out at this point, and each player is sent a report once it is done. |
To clarify, a typical PBEM using the Engine will work as follows:
Assuming you have Apache Maven installed, we start by creating our own project using the PBEM Engine quickstart.
$ mvn archetype:generate -DarchetypeCatalog=http://maven.pbemengine.nl/ -DarchetypeRepository=http://maven.pbemengine.nl/
This will generate a list of all available project quickstart packages on our server, which should only contain a single package. Enter the group and artifact ID of your PBEM (if you're new to Maven, consider the group ID to be similar to a package name, and the artifact ID to be a name for your project). After this action is completed you now have a new directory containing a basic Maven project structure containing a Ruleset class and some sample classes to use it with.
As we said in the “before you start” section earlier - before we start creating our play by e-mail game, we need to have an idea of the sort of game we want to make. Since this is supposed to be a simple tutorial, we will be creating a rather simple game based on Rock-paper-scissors. If you are unfamiliar with this game we suggest you check out the previous link first.
Our game is going to work as follows:
Each game monitors a single e-mail address, and users can send the following types of e-mails:
In addition to these e-mails, our game has the following “entities”. These are classes that are going to be mapped to database tables.
We will illustrate the use of the Engine with this example design.
We start by initializing a PBEM quickstart project with our pre-chosen parameters.
$ $ mvn archetype:generate -DarchetypeCatalog=http://maven.pbemengine.nl/ -DarchetypeRepository=http://maven.pbemengine.nl/
Use the following parameters:
| Parameter | Value |
|---|---|
| groupId | nl.pbemengine.tutorial |
| artifactId | Tutorial |
| version | 1.0-SNAPSHOT |
| packageName | nl.pbemengine.tutorial |
Make sure you have a Subversion copy of the Engine installed (using mvn install), otherwise your build will fail when you try to compile your ruleset! After Maven finishes, we have the following directory structure:
+ Tutorial
| pom.xml
+--+ src
+--+ main
+--+ java
+--+ nl
+--+ pbemengine
+--+ tutorial
| Rules.java
| MyReportGenerator.java
| MyTurnProcessor.java
| MyMailProcessor.java
This is a basic layout for a PBEM project. Once compiled, we can use the created Jar file directly as plugin for the PBEM Engine.
Now we will start the actual job of creating a PBEM. We will begin by inspecting the Rules class.