NAV
lua

Introduction

Welcome to the OpenNetBattle engine!

Documentation for this engine is a heavy work-in-progress!
The engine supports custom user content through Lua, this is what the documentation covers.

You can check out any developments on the GitHub page!

User-Generated Content

+ OpenNetBattle
├─ ...
└─ resources
   ├─ blocks            - character customizer doohickeys
   │  └─ example_block
   │     ├─ entry.lua          - [entry.lua] defines a block
   │     └─ ...                - other files for the character
   ├─ cards             - attacks
   │  └─ example_enemy
   │     ├─ entry.lua          - [entry.lua] defines a character
   │     └─ ...                - other files for the character
   ├─ encounters        - specific battles against ai-controlled opponents
   │  └─ example_encounter
   │     ├─ mob.lua            - [mob.lua] defines an encounter
   │     │  └─ characters        - enemy data is located here
   │     └─ ...
   ├─ enemies           - ai-controlled opponents
   │  └─ example_enemy
   │     ├─ entry.lua          - [entry.lua] defines a character
   │     └─ ...                - other files for the character
   └─ players           - playable characters
      └─ example_player
         ├─ entry.lua         - [entry.lua] defines a character
         └─ ...               - other files for the character

An example of the file layout for user-generated content. It's recommended to follow a similar structure to this.

All user-generated content is located in the OpenNetBattle/resources/mods/ directory.

The starting point of user-generated content (mods) are files called entry.lua (or mob.lua for encounters).
Each set of mods needs at least one of these in order to be properly loaded by the engine.

File Structure

For a Playable Character

example_player
├─ entry.lua
├─ battle.animation
├─ battle.png
├─ mug.animation
├─ mug.png
├─ overworld.animation
├─ overworld.png
├─ phone.png
├─ preview.png
└─ ...

An example of the file layout for a player mod.

entry.lua

This is the main file for the player mod. This is where all of the code goes.

.animation files

These are the files that control how the player character is drawn.

.png files

These are the files that contain the graphics for the player character.

For an Encounter

example_encounter
├─ mob.lua
└─ ...

An example of the file layout for an enemy mod.

Command Line Arguments

-b / -battleonly

Boots up the game, and immediately enters into the battle screen.
The game closes down after the battle concludes.

--mob

Used with the -b / -battleonly argument.
Uses a encounter loaded from the local disk.

Type

string - The package name for the encounter to be used for the battle.

--moburl

Used with the -b / -battleonly argument.
Downloads a encounter from the specified web address to be used for the fight.

Type

string

--player

Used with the -b / -battleonly argument.
Sets the player's character to be a loaded from the local disk.

Type

string - The package name for the player character to be used for the battle.

-e / -errorLevel

-d / -debug

Enables debugging.

-s / -singlethreaded

Runs both the logic and graphic threads in a single thread.

-l / -locale

Type

string (default en)

-p / -port

Sets the port to be used for PvP.

Type

int

-r / -remotePort

Sets the port to be used for the main hub for this game.

Type

int (default 8765)

-w / -cyberworld

Sets the IP address for the main hub to be loaded for this game.

Type

string (default 127.0.0.1) - IPv4 address

-m / -mtu

Sets the MTU, the maximum size for a packet. Only adjust this if you know what you're doing.

Type

int (default 1300)

lua