MassiveBattle

From BerryBots Wiki
Jump to: navigation, search
sample.massivebattle at 1/20 zoom
BerryBots
See a replay of MassiveBattle in action: click here to watch

A sample battle stage packaged with BerryBots as sample/massivebattle.lua. It features a huge playing field (6400x4000) with staggered walls across the stage, and uses the default scoring from the battlestage scoring module.

Can be used for massive free-for-all or teams battles or to check that your ship behaves sanely on a large stage where ships can reach very high speeds.

Source code

-- A massive battle field.
--
-- Sample battle ships: Chaser, FloatingDuck, MyFirstShip, RandomBot,
-- WallHugger, and BasicBattler.
 
require "battlestage"
 
function configure(stageBuilder)
  stageBuilder:setSize(6400, 4000)
  stageBuilder:setBattleMode(true)
 
  for i = 1, 7 do
    for j = 1, 5 do
      if (i % 2 ~= j % 2) then
        local wallCenter = {x = (i * 800), y = (j * 800) - 400}
        stageBuilder:addWall(wallCenter.x - 100, wallCenter.y - 100, 200, 200)
      end
    end
  end
end
 
ships = nil
world = nil
admin = nil
 
function init(shipsArg, worldArg, adminArg)
  ships = shipsArg
  world = worldArg
  admin = adminArg
end
 
function run(stageSensors)
  battlestage.basicScoring(ships, world, admin)
end
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox