Modding Tanks/Droids/Spaceships/Bombers characters

Look in the games folder and you will see several subfolders. Many of them contain a Groovy script which configures one of the UniBlaster games. For instance, take a look at droids/droids_script.groovy which configures the Droids game.

        name: "Droids",
        description: "A fast-paced twin stick shooter.  (UniBlaster Engine)",
        startingCrates: 1,
        crateSpawnTime: 5f,
        crateAnim: CRATE_METALLIC,
        powerups: [
                new FiringRateAndSpeedUp(10f),
                new AccelerationPlus300(10f),
                new HealthUp(10f, 10f),
                new BlastRadiusUp(3f, 1f),
                new SpreadShot(15f),
                new Rush(20f)
        characterFactory: characterFactory(
                health: 10f,
                bulletSpeed: 200f,
                bulletKnockback: 0.5f,
                firingRate: 15f,
                maxSpeed: 400f,
                acceleration: 500f,
                trigger: false,
                anims: DROIDS,
                bulletExplosions: 0,
                bulletBounce: 0f,
                bulletAntifriction: 1f,
                bulletMomentum: false,
                characterKnockback: 0.3f,
                bulletDamage: 1f,
                bulletLifeTime: 3f,
                engineType: STANDARD_MOVEMENT,
                characterBounce: 0.0f,
                bulletMinVelocity: 20f
        path: pathPrefix

This script is written in Groovy, a Java-like scripting language. If you change it, you will change the Droids game in RetroWar. However any changes you make will probably be overwritten next time the game is updated. Therefore you should put your modifications into the mods folder.

Make a new folder mods/mygame. Copy the droids_script.groovy script into it. (The name of the script file does not matter; you may rename it.) Also copy the levels folder if you want the same levels in your version.

Now you will find a new game has appeared on the mods menu - your game!

Unigame Parameters

name String Short name displayed in menu
description String Longer text describing game, may contain linebreaks.
startingCreates Int The number of powerup crates added to the level randomly at the start of the game.
crateSpawnTime Float Interval between spawning of new power-up crates (seconds).
crateAnim Animation<TextureRegion> The animation (or static image) drawn for each power-up crate. There are two pre-defined images you can use: CRATE and CRATE_METALLIC (TODO: how to create new ones)
powerups Array<PowerupFactory> A list of powerups. The predefined ones are listed below. Usually they take two arguments: the relative probability of them appearing, and the amount of boost they give the player.
characterFactory CharacterFactory object See below for the params to the convenient characterFactory() constructor method.
path String This path is passed to the game to tell it where to find level files, etc. Set it to built-in variable pathPrefix to have RetroWar automatically determine this.


(TODO: how to create new powerups.)

List of current powerups:

CharacterFactory Parameters

health Float Health points the player starts with.
bulletKnockBack Float How powerful the player's bullets are at knocking things they collide with, usually in range 0.0...1.0.
bulletSpeed Float Speed of player's bullets, in pixels per second.
firingRate Float Firing rate of player's gun, in bullets per second.
maxSpeed Float Cap on how fast the player can move, in pixels per second.
acceleration Float How quickly the player can change speed, in pixels per second per second. Set this high to make movement feel responsive.
trigger Boolean Whether the player's gun requires a button press to fire (else it just fires automatically).
anims Animation The graphics for the character. (TODO: how to add new graphics.) Current options are DROIDS, TANKS, BOMBBOTS, SHIPS, JOCKS
bulletExplosions Integer The size of the explosion when the bullet hits something. Set to zero for no explosion. Unit is map tiles.
bulletBounce Float How much velocity is maintained in primary axis of a collision with a level block. Value of 1 means no velocity is lost, i.e. collision is completely elastic.
bulletAntifriction Float How much velocity is maintained in secondary axis of a collision with level block. Value of 1 means no velocity is lost, i.e. collision is completely elastic. For Newtonian physics, set bounciness and antifriction to the the same value, i.e the coefficient of restitution.
bulletMomentum Boolean Whether the player's velocity is passed on to his bullets at time of firing.
characterKnockback Float Amount player is knocked back when hit by bullets. Usually in range 0.0 ... 1.1.
bulletDamage Float How much health of target is reduced when hit by player's bullet.
bulletLifeTime Float How long bullets last, in seconds.
engineType Boolean Current valid values: STANDARD_MOVEMENT, ROCKET_THRUSTER, GRID_MOVEMENT
characterBounce Float How much the character bounces when hitting a wall.
bulletMinVelocity Float If a bullet slows to less than this velocity it is automatically destroyed. Set to zero to allow stationary mines.

There's also a functions that sets up Bomber type and only takes a subset of the parameters, like this

 characterFactory: bomberCharacterFactory(
        health:  100.0F,
        maxSpeed: 100.0F,
        acceleration:  1000.0F,
        characterKnockback:  0.7f
        gridEngine: false