Giter Club home page Giter Club logo

bomberlua's Introduction

Introduction

BomberLua is a botgame, inspired from Robocode. You don't control the character like in any other bomberman clone; instead, you write a script which will use the information provided by the game on the playing board to move the character and attack the others (which are controlled by other scripts).

Bomberman was chosen because of the particularity of the gaming board (which is not empty as Robocode's was): bombermen need to find their path on the board and to make a way to its enemies. Dodging bombs is not always easy, because you need to find a safe place to go everytime you or an enemy drops a bomb.

The game is written in C++, using SDL, SDL_image and Lua 5.1, by remram44, Insomniak (display and graphics) and acieroid (Python interface, still WIP).

Rules

For the moment, the playing board is fixed (11x11): grid of ROCK blocks completed by BRICK blocks, except in the 4 corners, where the bombermen begin.

Only the BRICK blocks are destroyable. Bombs have a fixed range of 1 block in each direction.

The scripts are executed in parallel in separated threads. They are loaded before the beginning of the game and the placing of bombermen; however they already have access to the gaming board. A script may use this preliminary phase of 5 seconds to calculate some informations, for instance concerning pathfinding (even if the current board size does not justify it). The ready() function must be called before the 5 seconds are spent, or the bot will not be allowed to play. The ready() function returns at the beginning of the game, when all functions are available.

The functions that allow a script to act are blocking, which means they only return when the action is finished and when the bomberman can act again. The duration of the action is:

  • 0.5 seconds for a movement (move() function);
  • 0.1 seconds to drop a bomb (bomb() function);

Scripts

For the moment, only the Lua and Python scripting language are supported (with a limitation for Python; cf bug 1). The support of other languages is not planned but may be added easily (please contact me if you can add support for a new language).

During the game, bots have access to the following function:

  • get_self : this function returns informations on the bomberman which is controlled by the bot. It returns a table containing two fields: posx and posy, the position of the character on the board.
  • get_bombers : returns a table of all bombermen. Each bomberman is represented by a number (which identifies the bomberman for the whole game); the structure associated is the same as get_self returns.
  • get_field : returns the board, in form of a table. The fields w and h indicates the size of the board, and to each string "x,y" is associated the type of the cell, which may be: ** "rock": an undestroyable wall ** "brick": a wall that may be destroyed by a bomb ** un nombre : no wall, but a bomb that will explode in that amount of time (in seconds) ** "explosion" : an explosion ** "empty" : nothing
  • move : allows the character to move. You may pass "left", "right", "up" or "down" to move in the desired direction.
  • bomb : drops a bomb.

Planned

Planned features for future versions:

  • Several boards, of different sizes (loading from a file and random generation);
  • Bonuses, appearing randomly when a BRICK block is destroyed: ** Range: each bonus improves the range of the bombs by 1 block; ** Speed: improves the walking speed of the character.
  • Saving and playing back replays.

Downloading and installing

As many of my projects, BomberLua is hosted on Github; you will find the latest version of the sources there, along with packages for so-called 'stable' versions of the program.

Usage

A graphical "launcher" written with Qt allows you to launch the game without using the commandline. Otherwise, you can use the following parameters:

  • -i to enable graphical display
  • 1 to 4 scripts to load

Examples :

./bomberlua -i bots/test.lua bots/scripted.lua bots/test.lua # Linux
bomberlua.exe -i bots\test.lua bots\scripted.lua bots\test.lua # Windows

bomberlua's People

Contributors

remram44 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bomberlua's Issues

Only one Python script

Only one Python script can be loaded at a time, because they would share
the same context (and thus share the globals). The code has been modified
(changeset b906867, 2009-07-15) to only allow one Python script (and any
number of Lua scripts) to prevent the program from crashing.

This limit comes from the Python API and can only be fixed by a Python
user, which I'm not.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.