BaSS ~ Baro’s Scripting System – BETA

27 02 2010

Download BaSS Download

This is a tool I’ve made to develop Tanuki Tail, but decided to release because I’m so awesome and helpful.

BaSS is a script language toolkit I’ve made (and still work on from time to time). It lets you create script files that use a script language of your invention. For example, if you are making an RPG you may want to create scripts for your NPC events. For example, when you talk to someone make him face you, load a text, print the text, maybe give or take an item, etc. It also has other uses, like event animations (example: “walk two tiles up, then turn around, make the character jump…”) or anything that comes into mind. After all, the final result is an array of bytes with the meaning you gave to them.

The current toolkit consists of two tools, Luthier and Performer, both of which are command line text parsers. The toolkit comes with a manual that explains pretty much everything.

Luthier creates BaSS language files from text files. This is, the collection of commands you want to use to compile scripts with Performer. Read the manual and example to get a better idea, but, a quick one:
5 loadtext 1 2 textID
6 printloadedtext 0
X print 1 2 textID // loadtext textID \ printloadedtext

These three lines would put two commands and a construct in the language:

  • Command number 5, named “loadtext”, which receives one parameter of length two (bytes), called textID
  • Command number 6, named “printloadedtext”, which receives no parameters.
  • Construct “print”, which receives one parameter of length 2 (bytes) called textID. This gets translated into “loadtext textID” and “printloadedtext”
  • As you can see, this also implements constructs, which are something similar to macros in C. A construct is translated as one of more commands with parameters (constant or parameters of the construct), which is useful for common script lines, aliases (multiple names) of a command, or, with label references, jump commands.
    Presumably, loadtext would load a text reference into some buffer, printloadedtext would output it, and print would do both things.

    Luthier also lets you define things like maximum script file size, coordinate types size (each script has two coordinates: bank and script, and offset as an offset in the script file), endianess of data bigger than one byte, file extension, etc.

    The second tool is Performer, which is the actual script compiler. Given a text source file and a language file (created with BaSS), generates a file containing the array of bytes that represent such script. For example, with the previous commands, the script

    %TARGET 0 1
    loadtext 10
    printloadedtext
    print 11

    would generate a script with the bytes 5 10 6 5 11 6 (also, would save it in ./scripts/0/1.), which would, presumably, output texts number 10 and number 11. Constructs get translated into the commands they mean

    It is possible to #define things with a %DEFINE directive.
    It is also possible to insert labels. Labels are references to a script bank-script-offset coordinate, and can be added in a script to create a reference to that exact point of the script. You can create constructs that accept Label or Extlabel types, and then, when compiling, Performer looks up that label. If it’s a Label, it looks in the current script. If it is an Extlabel, it looks in a labels file, where all the labels from compiled scripts are stored.

    Once you have your language defined, you have to implement the commands into your game. The logical way to do this is sequentially, with jumps of needed, by creating a while loop that reads the whole array byte by byte and running each command depending on the byte read (with a switch statement, for example).

    This is a beta. There is a lot to improve and a lot of code to clean. Once the code is cleaned enough so it doesn’t embarrass me, I’ll release version 1, which will be open source.
    Feedback is welcomed, being it praise, bug reports, comments, questions…

    Download it right now.



    The story of Tanuki Tail

    25 02 2010

    Since I’ve already talked about the engine in my first, long post, I’ll talk a bit about the story before getting deeper in the engine.
    I warn ya, this post will be a bit hard to understand because the story is messy.
    Also, if you are a religious fanboy that doesn’t believe in evolution, you may not like points of the plot.

    Brief:

    You are Pol Keine, a dude who has a tail from a dead anthropomorphic racoon person from another universe, which lets you transformate into a variety of things, namely stone, cannon-hands, frogs, birds, chameleons, bulls, bear-gods…

    Story:

    In year 2548, the Earth is different from what we know now. One day, a tyrant decided to bomb Middle East, supposedly as a solution to the wars in that are, which got really out of hand. However, the bomb used caused a so big impact the continents moved and rearranged, destroying almost all civilization in the process, as well as many animal species like -it seems- bears. After that, that tyrant took on the world and became the ruler of all survivors, and it was like that for three generations. Now, his grandson, current world dominator, is making a bomb similar to his grandfather’s, for unknown reasons, and a troupe of youngsters from the city of Lowheaven are trying to sabotage it. They are:
    Julie Bourge: expert in software
    Usui Akiyama: expert in hardware
    Bear Sampson: expert in tupperware, and a very strong young man.
    Pol Keine: dude. Wears a cap. He’s also you.

    But one day, during one of many stealth sabotage mission, something goes wrong: a strange being captures Pol and when he wakes up the next morning, he has a racoon tail. Turns out that the being that captured him is a racoon-person (also called Tanukis) from a universe where instead of apes, racoons evolved to be intelligent. The tail Pol wears was from an old Tanuki hero, and, like Tanukis (and every evolved-to-be-intelligent species with tail), will let him transform into many things, although he has to learnt to use it first. Now, with that Tanuki tail, defeating the tyrant will be easier, but turns out there’s a worse enemy behind them: In other universe, where goats evolved and are now the demons, those demons want to control all the universes (also known as the Polyverse) and steal other’s tails so they can too transform because them, like humans, have been taken the tail because of their evilness.

    This needs a bit more background, maybe. (Those may sound more coherent when explained slowly during the game)

    On a side note, bears are the actual gods and creators of the original universe. In the beginning, there was only one universe, but, in the age of dinosaurs, a radioactive meteorite fell from the sky killing all the lizards. The radioactive impact also caused the universe to split into a handful of different parallel universes, and in each one of them, a different mammal developed, evolved, and became intelligent like their gods, and were able to transform their body using their tail. But some of these animals turned out to be evil, so the bear gods took their tail away banning them from the transformation.

    So that was a neat introduction, what then?

    All that is fixed is that at the beginning of the game you will beat the Tyrant’s butt, learn about the actual enemy (demons) and go on a quest to kick their ass too. I’ve also planned some characters and situations, but it’d be impossible to speak about them without more context. Also I have planned things that would be spoilers so I’ll keep them to myself.

    Something else about the game itself, gameplay…?

    Apart from what I had mentioned in the first post, there’s also some things to know:
    Like in the Zelda games where you had to collect the items to use them, you’ll learn your transformations progressively, opening new choices, paths and such.
    You will begin (after the tutorial where you’re just Pol and have a lame-ass punch) with a stone transformation. This will let you make giant-stone-hand punches and transform into an statue, for stealth, weight and who knows. This will be explained as an instinctive reaction for self-defense.
    The game will develop in Earth, but in different Universes. you’ll travel from universe to universe meeting many different evolved species, and different critters, which may be the typical “monsters” but they’re just wild animals. (For example, in human universe you may find coyotes).
    Animals don’t get you money. You get food from them. Food is essential since the transformations will require energy (equivalent to mana, magic, etc in other games), and after spending energy you may want to recover using food. Some foods may also have other effects, and probably I’ll make it so you can also cook your foods to get other (better) effects. Also, you will sell your foods like any other valuable to earn money. So basically you’ll make your living as a hunter/cook.



    A drunken coder? Me?

    23 02 2010

    So!

    Last Saturday I came upon M. Lucanius‘ signature in PAlib’s Forums, and a link to his dev blog. Then I looked around drunkencoders and though “Hey! This is what I need!”. I was planning on making a simple web to speak about my doings and release stuff. I was already considered a blog, and then I saw this place.
    But question is, am I a drunken coder? However, there was no time to answer since it was Saaaaturday night and so it was time to go outside™.
    And so, that night I had:
    1 glass of whisky + cola
    2 3 shots of Licor Café
    1 glass of José Cuervo + cola
    1 glass of whisky + cola

    So next morning I woke up and said: “Yep, I’m a drunken coder”, and registered.

    —————–

    So, what’s this blog going to be about?

    Well, as I already implied before, I’m a member of PAlib. That means I’m doing something about homebrewing for NDS – using PAlib. To be more exactly, and actually saying something, I’m making a videogame. Name is Tanuki Tail, and it’s going to be a zelda-style gameplay adventure. It’s my first game, to be honest, since I absolutely hate Pong (I have, however, made a little dumb game a couple of months ago, I’ll talk about it someday). However, it’s quite an ambitious project. I’m a serious man, you guys. I’m structuring the project in a -I believe- efficient way, and making it as general as possible.
    Why? Because I want to release the engine too. I’m coding the game in a way that it loads as much as possible from files from the file system. All the pictures, all the maps, all the sprites, texts, fonts, data, animations, etcetera will be stored in files, and the code will contain only the engine. In fact, once the engine is 98% done, the rest will be map creating, sprite drawing, etc (i.e. create the game files). So far, I really like the outcome. I’m still learning a lot of things, and I’m doing things like finding uses for geometry (really!), but I believe I’m doing really good.
    I’ll talk more deeply about it on next posts, but, to help you get an idea of the game engine, the game is 2D, but it geometrically simulates 3D shapes in maps and characters. Each character (this will include npc’s, bullets, items and everything that is not map, actually) will have its own properties (speed, amount of jumps, acceleration, brake, behaviors… everything I came up with). The game can run scripts stored in files (this will have an special mention because I’ve made a general purpose script language maker/script compiler toolkit for that), and apart from that the rest of the features are the typical on a game like this.
    About the game, think of a GBA Legend of Zelda where you transform into things rather than using items. This, with the addition of the fact (that I mentioned earlier) that each character have very different behaviours, adds a little twist on the genre.

    The game is being made in C with PAlib, although I’m developing it using object-oriented techniques.

    So, about releasing the engine and such: the plan is to have three releases when the game is done:
    The game itself: a rom with the game you can play.
    The game source: practically a copy of my latest project folder, including all the tools I’ve made and used on it. With this, one would create an “own” version of the game, for instance.
    The engine source: a “blank” version of the game source, with no maps, texts, scripts, etc, and without all the non-generic stuff (script language implementation, etc).

    Well, this is a long post. I’ll leave something for the upcoming ones.