[Tutorial] How to write an multiplayer game server – Part 1 Maven Configuration

This it the first part of the new “How to write an multiplayer game server” tutorial serie.

In this part we will talk about our dependencies and configure our maven project.

We will use Maven as Build & Dependencie Management Tool and create an new project and Netty as fast and asynchronous networking library.

You will find source code here: https://github.com/JuKu/multiplayer-server-tutorial/tree/master/chapter01

 

After your Maven project creation you will have an pom.xml file like this:

Now we will create 2 new maven sub modules:

  • Server (in my case gameserver-tutorial-server)
  • Client (gameserver-tutorial-client)

 

So we can implement client & server in same maven project, but other sub modules.

Gameserver Tutorial Chapter 01

After this we create an main class for client in client module:

For example:

 

And an main class in server module:

 

After this, we will change our parent pom.xml to the following:

 

In properties we can set some maven variables / constants and we set our netty version their, so we can upgrade netty without changing version in all sub modules.

At the bottom of file is the build config (optional), we use Java 8 and have configured an plugin, so an JAR file will be created with an specific MANIFEST file (so we can start the JAR later with an double click or “java -jar <Package>.jar”.

 

Client pom.xml:

 

Server pom.xml:

 

We have set an dependencie for Netty, so maven will download netty automatically on build progress (mvn clean install) and we can use it.

This was part 1, part 2 will follow this week.

 

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.