Difference between revisions of "Commands"

From LugdunonWiki
Jump to: navigation, search
(Created page with "==Introduction== ==A quick word about DataView, EnhancedDataInput/OutputStream, and String length== ==Client Side Command API== ==Server Side Command API== ==Console F...")
 
(Introduction)
Line 1: Line 1:
 
==Introduction==
 
==Introduction==
  
 +
In Lugdunon, commands are what drive the game state. Any action that occurs should result in a command being generated to be handled in the update loop. Commands are also the method in which the client and server communicate. Commands are specific to a given server, and are loaded from the classpath based on their inclusion in the '''''WORLD/etc/commands.json''''' file.
 +
 +
 +
Commands are referenced in code by their unique command id. Programmatically, commands are referenced by a short int opcode, meaning that commands are limited to at most 215-1 (32767). With the exception of of '''''net.lugdunon.command.core.ErrorCommand''''', '''''net.lugdunon.command.core.GetServerStatusCommand''''', and '''''net.lugdunon.command.core.ConnectToServerCommand''''' the opcode for a command is dynamically assigned at server start and should never be relied upon to remain the same value across server instances.
 +
 +
A command exists as a single instance, loaded and initialized upon server start for server-side commands and upon client connect for client-side commands. Commands are referenced in code via their command id, a unique string that identifies a specific command. How to call commands on the server and client will be examined towards the end of this article.
  
 
==A quick word about DataView, EnhancedDataInput/OutputStream, and String length==
 
==A quick word about DataView, EnhancedDataInput/OutputStream, and String length==

Revision as of 17:38, 13 October 2013

Contents

Introduction

In Lugdunon, commands are what drive the game state. Any action that occurs should result in a command being generated to be handled in the update loop. Commands are also the method in which the client and server communicate. Commands are specific to a given server, and are loaded from the classpath based on their inclusion in the WORLD/etc/commands.json file.


Commands are referenced in code by their unique command id. Programmatically, commands are referenced by a short int opcode, meaning that commands are limited to at most 215-1 (32767). With the exception of of net.lugdunon.command.core.ErrorCommand, net.lugdunon.command.core.GetServerStatusCommand, and net.lugdunon.command.core.ConnectToServerCommand the opcode for a command is dynamically assigned at server start and should never be relied upon to remain the same value across server instances.

A command exists as a single instance, loaded and initialized upon server start for server-side commands and upon client connect for client-side commands. Commands are referenced in code via their command id, a unique string that identifies a specific command. How to call commands on the server and client will be examined towards the end of this article.

A quick word about DataView, EnhancedDataInput/OutputStream, and String length

Client Side Command API

Server Side Command API

Console Fired Commands

GM Only Commands

Server Invoked Commands

Invoking Commands on the Client