If you don't understand something : david.fauthoux@free.fr
If you've done some modifications, SEND ME YOUR ADDONS !
0.1 Add an interface page
0.2 Add a playing character : Bonhomme
0.3 Add a level to play : Fond
0.4 More powerful now : add options !!
0.4.1 A new first simple option : this option puts your power to the max !
0.4.2 A new second simple option : this option freezes the others !
0.4.3 A new third option more complicated : the flame thrower !
0.4.4 Better and better !
1.1. The Bomb ô Bomb engine : interpreted solution and Addon technology
1.2 The Addon technology
A quick word about Addon technology : Addon enables you to add code to the programs' well-structured C++ sources. It reads script with a lot of key words.
Some pre-written scripts are included in src/script.
I will guide you thru the tutorial of the Addon technology :
We begin by adding a useless interface page to the game (our page will be accessed by typing space in the normal beginning page) :
We use src/script/HOWTOAddPage. Copy and modify this file :
An addon has a name and an author (so it will be possible to remove it) : write your addon name below "addon name" and your name below "author". You will modify the pre-written script like this.
We need a background for the page : you can use the default file, but you can also modify it with Gimp for example, or you can create another. Write the file you want after "background:". A note : all the layers of the gif file are used, the upper layers make shadow on the lowest layer (you can modify "decal shadow" ids). Here, we can use the file Page/justForFun.gif.
Now, we link our page to the first page (bomb o bomb) with the key words "change to" and "when key". For the keys, the engine uses keyboard scancodes (for enter, it is 28). With the default 28 value, when you will press enter, you will switch to the bomb o bomb page.
Now, we put a word on our page : the word "fun". Change "clong" by "fun" and try values for the others ids.
Now, we add a sentence wich will pass on the screen (a strip) : modify the values as you want.
We can add some animations on our page, modify the values like you want (for example, you can put the Sprite/femme2.gif instead of lapin.gif).
Now, we must link our page from the existing pages. We will modify the bomb.ini file : this file is read by the engine at the initialisation; with this file, you can change a huge part of the game (nearly all !). With the add roughly section block, we have added some lines in .ini files. To link to the bomb o bomb page, we must watch bomb.ini and find the bomb o bomb page (it is here the fourth page, so we write 3, they are numbered 0,1,2...). And we add the famous id "change to". We use the 57 key : space.
Your script file must look like this.
Ok. Now, we add the addon to the game. In the src/ directory type ./addon --add script/HOWTOAddPage or your file instead of HOWTOAddPage. Ok ! Now you can go in Bomb ô Bomb root directory and run the game... type space in the bomb o bomb page...
Cool isn't it ?
Watch the file : scr/script/HOWTOAddBonhomme.
I think it is not too complicated, try and try again. The hardest part is drawing the sprites !!
Here we need the file : src/script/HOWTOAddFond.
First, we create the background : we will use the file Fond/unfinished.gif. Open it with Gimp for example, we will put the indestructible walls : in the corner, a block is written "paint me + copy me". Paint an indestructible wall in this block (metal wall for example), you can take it in Fond/anti.gif if you are tired. And copy this block in the lowest layer BUT BE CAREFULL : the background will be divided into squares (we will uses 20x20 pixels squares) so, copy the block in multiple of 20 coordinates ! Save your file in Fond/ourFond.gif.
Now we must create the "grille" for our background : the .grille file identifies the location of the walls. We use createGrilleForFond in Bomb ô Bomb root directory : ./createGrilleForFond bomb.ini Fond/ourFond.gif Fond/ourFond.grille. In this program, use enter and space and put indestructible walls every where you have put the blocks.
Now, we will modify the script HOWTOAddFond :
Replace "background:..." by "background:Fond/ourFond.gif" and "grille:..." by "grille:Fond/ourFond.grille". You can modify the others values of the script if you want.
Ok. Now we add the addon : ./addon --add script/your script file here. Be in scr/ to add the addon.
Go in Bomb ô Bomb root directory and run the game. It is working, isn't it ? if not... e-mail !
The Addon technology enables you to add code very easily, and it manages templated addons : so, I pre-wrote script that add options in the game. All you have to do is to type code relative to your option, for a first start, you don't have to understand all my code !!
We use the script src/script/TutorialOptionPuissanceMaxNow.lesson1.
This script uses a templated script that need parameters, the code for the Bonhomme for example, or the gif files. Read the script and modify everything you want, and add the addon : go to src/ and ./addon --add script/TutorialOptionPuissanceMaxNow.lesson1
Very simple... So cool !
We use the script src/script/TutorialOptionFreezeOthers.lesson2.
Now, you know how to include a templated script. But this option needs a function. It is quite simple to add a function... If you don't know how to do, do not worry and try ! the program will help you by asking key words. You can also read the script src/script/HOWTO. A note : you cannot add the same addon twice, you have to remove it first with ./addon --remove script/yourScriptFile.
We use the script src/script/TutorialOptionFlamThrowerInLine.lesson3.
Here, you must know the program structure. See below (2. Learn....) or my doc.
We use the script src/script/TutorialOptionFlamThrowerInLine.lesson4.
Remember to remove the old version !./addon --remove script/TutorialOptionFlamThrowerInLine.lesson4
Bomb ô Bomb is a powerful game engine that DO NOT separate game and interface. Example : because the game stays consistent every time, it is possible to change the number of players without stopping the current game : a new player comes in purely and simply ! (try the f1-f8 keys)
The engine performs a huge part of the game (the biggest it can) by reading the bomb.ini file (or another file of course). So, it is possible to add or modify parts of the game without re-compiling the code !
Just by tamperring with the bomb.ini file, you can create another game !! Don't be afraid to modify something in bomb.ini, the engine will check its validity and correct it itself as much as possible !
But you know that it is not possible to modify the core of the game by reading a file (in C++) : the engine cannot modify itself, or you have to write interpreted code. There is another solution !! :
With the Addon technology, YOU can modify the engine !!
I wrote the Addon technology to enable you to modify my code VERY easily. Example : with the Addon technology, you can add an option in the game only by telling to the addon the animations files !
Bomb ô Bomb is a base for a new point of view for the free software : Bomb ô Bomb is given with sources of course, but Bomb ô Bomb is also given with the possibility (easily) to modify these sources...
The Addon technology enables you to add C++ code in another code. Example : in Bomb ô Bomb, you can add code for an option very very easily by using the script/EasilyAddedOption file (see the tutorial in the quickstart).
The addon program reads a script file. This script file is written with a lot of key words to check validity. And the original sources are completed with some code included in script.
Very powerful : the added code can be REMOVED !
The Addon technology can check addons dependences, can include other addons with parameters, can be exhaustive by using if:, is easily usable with verbose, can be hierarchical (an addon can include addons wich include itself others addons)...
I am proud of the Addon technology because, with that, my code becomes open to you ! The original code is well structured, so you'll understand it quite quickly, so you can build complicated addons quite easily and quickly : YOU can add options, interface pages, and all the others ideas I will never think about !!!
All the power of the Addon is described in src/script/HOWTO. You should use emacs editor, I have given a quit good config (scr/.emacs), so you will have colors (in emacs : alt-x makefile-mode).
But first, you should get yourself an idea of my code structure (classes are bold):
I am french, so I called playing characters Bonhomme: they are managed by Bonhomme divided into Bonhomme60 (when choosing) and Bonhomme20 (when playing). All the Bonhommes are managed by a container : BonhommeContainer.
The interface switching is managed by PageChanger. The PageChanger creates the BonhommeContainer. The PageChanger loads all the Pages (interface). The game pages are inherited from Page, but normal pages can be added with bomb.ini by loading the DefaultPage.
The game is managed with Grille : a square park to manages all the squares (flames, bombs...). In french, square is case, so I called the class that manages squares is Case. This class is the mother class of CaseFlamme for flame for example. For options : Case class is the mother class of CaseOption wich is the mother class of CaseOptionSpeed for example.
For more details, see my doc or e-mail me.
I hope it is enough to understand simple example scripts in src/script.
I lack time to write others scripts but if you have ideas, don't be afraid to mail me, I will help you by writting pre-written scripts like EasyAddedOption. You're welcome !