Skip to content
Javidx9 edited this page Jun 29, 2018 · 5 revisions

You have taken the bold step of entering a tournament of unparalleled reputation, skill and magnitude! Behold...

Battle Royale - One Lone Coder Style!


OneLoneCoder Battle Royale Game

The challenge is to script a simple robot in Lua and battle it against other scripts created by members of the community. The robot is limited to simple actions such as moving and firing, and several defensive options such as shields and cloaks. The robot has a variety of sensors which can be used to determine information about the battle, itself and the arena. Movements take time to occur, so they need to be chosen wisely. Robots have limited health(MaxRobotHealth) and energy (MaxRobotEnergy) reserves. Deploying shields, or activating cloaking devices depletes this reserve. When your robot reaches zero health it is eliminated from battle.

An advanced version of the game allows robots to exist in teams. Teams of robots have the ability to exchange basic signals with other members of the team, allowing for group strategy. Robots from other teams cannot interfere or receive these signals.

Movement Commands

Your bot can only move along the line it is facing. Your bot can rotate to face different directions. The world uses a coordinate system where 0 degrees is along the X+ axis. The battle will be initialised with fixed parameters MoveSpeed, MoveTime, TurnSpeed and TurnTime which affect the motion of your bot. You have no control over the value of these, but you can query their values.

command description
MoveForward Move bot forward at MoveSpeed for MoveTime seconds. Collisions with walls will prohibit bot.
MoveBackward Move bot backward at MoveSpeed for TurnTime second. Collisions with walls will prohibit bot.
TurnLeft Rotate bot CCW at TurnSpeed for TurnTime seconds.
TurnRight Rotate bot CW at TurnSpeed for TurnTime seconds.
TurnToAngle(a) Rotate bot via shortest route at Turnspeed to face angle a in radians.

Action Commands

Your bot is capable of a variety of actions. Some take time to complete, others last for a specified duration.

command description
Fire() Fire a bullet in the direction you are facing. You can only fire bullets every GunCooldown seconds. Bullets do BulletDamage HP of damage.
Cloak(ON OFF)
Shield(ON OFF)
SelfDestruct() Blow yourself up. This is terminal for the bot, but the detonation of your bot releases SelfDestructBullets bullets evenly spread around the bot.

Signalling Commands (NOT YET IMPLEMENTED)

In team events, you can communicate with bots on your team using a simple semaphore signalling system. Enemy bots cannot detect these signals.

command description
ActivateFlag(n) This will activate beacon n [1..10]. Other bots running your script can detect this and change their behaviour.
DeactivateFlag(n) This will deactivate beacon n [1..10].
DetectFlag(n) This will return TRUE if another bot running your script has activated beacon n [1..10], otherwise false. You can use this to change your bots behaviour accordingly.

Sensors

Your bot is equipped with sensors to understand its environment. Some are very simple, and some are low level. How you decide to use your sensors is completely up to you, and no restrictions are placed on the user of Lua functions to help you.

command description
GetRadar() Returns 4 values (N,E,S,W) which represent quadrants around your bot. Each value is the distance to the nearest enemy in that quadrant.
GetWalls() Returns 4 values (N,E,S,W)which represent quadrants around your bot. Each value is the distance to the nearest wall in that quadrant.
GetMap() Returns a table populated with bots that are alive and not cloaked. The table is sorted in order of the bots distance from you. Your bot will always be element 0.
GetStatus() Returns a table populated with status information about your bot.
GetBattle() Returns a table populated with battle information.

GetMap

bots = GetMap()

-- where bots becomes
-- bots are sorted by distance to the player
{
    0 = {id, team, x, y},	-- Element 0 is always your bot
    1 = {id, team, x, y},       -- id = bots global ID
    2 = {id, team, x, y},       -- team = team ID bot belongs to
    3 = {id, team, x, y},       -- x = x position of bot on playing field
    4 = {id, team, x, y},       -- y = y position of bot on playing field
}

GetStatus

me = GetStatus()

-- where me becomes
{
    id          -- Global ID of your bot
    team        -- Team ID of your bot
    x           -- Position in X-axis of your bot
    y           -- Position in Y-axis of your bot
    angle       -- Direction your bot is facing in radians
    health      -- Remaining health of your bot, 0 = dead
    energy      -- Remaining energy available in seconds, 0 = none
    shielded    -- Your bot currently has shields deployed if true
    cloaked     -- Your bot currently has cloaking enabled if true
}

GetBattle

game = GetBattle()

-- where game becomes
{
    gametime    -- current elapsed time in seconds of battle
    enemies     -- number of opponents still alive
    allies      -- number of your team mates still alive
    rank        -- your bots current rank in battle
}

Playing the game

Battles need a BattleRoyaleRules.lua file which establishes the format of the battle. This file contains various parameters that alter the behavior of the bots, enable debugging information, and establish team formation. By default the application will search for BattleRoyaleRules.lua in the root directory, but you can override this at the command line, or by dragging a custom rules file onto the executable to start the application.

When started, the simulation will test compile the Lua scripts and report syntax errors back to the user. If all bots are loaded correctly, press SPACE BAR to start the simulation. There is no further interaction until the battle is completed, or times out depending on MaxGameTime.

Customisation

The olcBattleRoyaleEngine core is completely encapsulated and cross platform. It handles the simulation, and provides statistical and positional data to an application that contains the core. This means custom rendering systems (other than olcConsoleGameEngine) can be used to render the battle, so let's get those OpenGL versions with really fancy graphics in soon!