Create a Game
From Gardenwiki
Note: this tutorial is out of date. You should probably start with the Reversi Tutorial which is more detailed and should be up to date.
Contents |
Creating Your Own Game
The first thing you should do is read through the code for the included games as that will give you a good idea of how the toolkit works under normal circumstances. At some point you will probably also want to read the documentation on the framework used to send data over the network, known as distributed objects. You can get by without it but we may use a few terms in this document that are explained in the distributed objects documentation.
As a starting point, we have also provided a game which is nothing more than a template that you can copy and change the names to start yourself off with all the necessary bits in place. This template game is located in the sample directory of the games archive.
It should be noted that the architecture of the sample game is not the only way to make games with the toolkit. However, much of this structure is useful for nearly all simple multiplayer games and it is certainly a good place to start until you are more familiar with the functionality available. That said, let us look at each of the elements of the sample game in turn:
- SampleObject - contains the distributed state of your game
- SampleManager - handles the server side of your game
- SampleController, SamplePanel, SampleBoardView - handle the client side of your game
- sample.xml, sample.properties - configuration files used by your game
Running your game
If you develop your game in the same directory as the sample games, you can use the provided scripts to run your game during testing. In the following examples sample should be replaced with the identifier you choose for your game.
# Running the server ant server # Running the client (must be done after the server is started and you can # run as many as you like as long as they have different usernames) ant -Dusername=george client
Uploading to Game Gardens
Once you have something up and running that you want to share with the world, you can upload your game project on the create a game page. It should be pretty self-explanatory but you need to provide a name, some description, your game.xml file and your game's jar file and you should be up and running. If you have problems getting your game running on the site even though it works when you run it in the development environment, check the forums or shoot an email to gardens@threerings.net and we'll try to work out the kinks.
Happy Gardening
That's about the size of it. Be sure to check out the message boards if you have questions or want to talk about game ideas and implementation details.

