= multiplayer_template
:author:
:revnumber:
:revdate: 2016/03/17 20:48
ifdef::env-github,env-browser[:outfilesuffix: .adoc]


This page is to make your own multiplayer game, mainly by using a template and understanding how it works.

The template for a multiplayer project can be found here:
link:https://hub.jmonkeyengine.org/t/multiplayer-game-template/29904[https://hub.jmonkeyengine.org/t/multiplayer-game-template/29904]

Additional information e.g. links to jars can be found here:
link:https://hub.jmonkeyengine.org/t/need-help-need-jar-files-for-a-project/30065[https://hub.jmonkeyengine.org/t/need-help-need-jar-files-for-a-project/30065]

//Class diagram (template only):
//link:http://puu.sh/a4azI/8c37cd8cf4.png[http://puu.sh/a4azI/8c37cd8cf4.png]

A lot of work has to be done, but the best thing to start with, is summing up the classes, with  the variables and explaining what the use is of those.

Classes (by package):

NetworkRpg:

.  GameClient (Interface)
.  GameConstants
.  GameGuiController
.  Main

....
  private AppSettings settings;  sets the resolution
  private boolean isFullScreen = false;  obvious: fullscreen
....

.  MenuInputMapping (No variables)
.  RemoteGameClient
.  ServerMain
.  ThirdPersonCamera
.  TimeProvider (Interface)

NetworkRpg.AppStates:

.  BaseAppState
.  ConnectionState
.  EntityDataState
.  ErrorState
.  GamePlayState
.  MainMenuState
.  ModelState
.  WorldState

NetworkRpg.Components:

.  ModelType
.  Position
.  walkDirection (No variables)

NetworkRpg.Factories:

.  EntityFactories
.  GameModelFactory
.  ModelFactory

NetworkRpgt.Handlers:

.  GameMessageHandler

NetworkRpg.Networking:

.  Util

....
  public static final int tcpPort = 1337;   portnumber used for tcp connections
  public static final int udpPort = 1337;   portnumber used for udp connections (http://www.diffen.com/difference/TCP_vs_UDP)
  public static final String GAME_NAME ="Network RPG"; name of the game
  public static final int PROTOCOL_VERSION = 1; version of the udp/tcp protocol being used
....

NetworkRpg.Networking.Msg:

.  ChatMessage
.  CommandSet
.  GameTimeMessage
.  PlayerInfoMessage
.  ViewDirection

NetworkRpg.Objects:

.  Avatar

....
  public Spatial avatarSpatial;      holds information about the character
  private Node avatarNode;     a node which contains the modelnode
  private Node model;          a node which contains your character (the green thing on the map)
  public BetterCharacterControl avatarControl;  this is used to set the gravity
  private SimpleApplication App;  we need this to get the rootnode
  private BulletAppState bulletAppState; allows using bullet physics in an Application.
  private Node rootNode;   the node which gets all the nodes (add to this one, and it'll be visible)
  private AnimChannel animChannel; used to change the current anitmation
  private AnimControl animControl;   this is needed to create an animchannel
  private BitmapText label;     label where we add a the textnode to
  private Node textNode;           name above the head of the player
  private String idleAnim = "IdleBase";   name of the animation (not 100% sure)
  private String walkAnim = "RunBase";
  private String attackAnim = "SliceHorizontal";
  private String jumpAnim = "JumpLoop";
  private BitmapFont guiFont;    the font
  private String playerName;     name above the avatar
....

NetworkRpg.Services:

.  EntityDataService
.  GameSystems
.  MovementService
.  Service (Interface)

This is a total of 35 classes.
