APOCALYX is a...

free Game Engine based on OpenGL (MAIL) (SITE) (FORUM) (BLOG)

Thursday, June 26, 2008


The results of the last poll about the preferred programming languages (read the post) had an unexpected side effect. I discovered the existence of ScriptBasic, a BASIC interpreter that is easy to embed and extend.
As you may know, I designed APOCALYX to be a 3D engine that people can program without the need of a compiler. That's why all its features are accessible to Lua scripts: this is the main characteristics I was looking for in 3D engines years ago, but then I had to develop one by myself because the engines available at that time were only C or C++ based.
Lua possesses very powerful capabilities (eg. its tables and metatables) that make it a language opened to different solutions and programming styles, but also a bit particular and, probably, not easy to master for novices. Recently I succeeded in the modification of the default behavior of the Lua interpreter, so now I can control its execution instruction by instruction, also control the memory allocation (read the post) and this language became suitable for games like GUN TACTYX.
Only a thing is still missing to make the whole thing accessible to novices at a very basic level... to use BASIC as the scripting language. I don't mean that I want to drop Lua, of course; I simply realized that the BASIC language is simpler and well known by amateur programmers, so it's not a bad idea to embed it into the engine. In conclusion, I started a poll to remove languages not very useful, and now I'm back including an additional one, that I hope more useful.
The BASIC flavor that was suggested is ScriptBasic. In a few hours I have analyzed its features and realized that a programmer can easily extend and embed it in his own applications. There is also an easy way to control the memory allocated by the interpreter; moreover its bytecode can be executed instruction by instruction and then suspended. As I already told above, these are the characteristics that I was looking for and it's a real sin that I never found this interpreter years ago in my searches, on the contrary even the old GUN TACTYX could be based on it, catching much more players than the difficult to use SMALL interpreter did.
I have already successfully compiled the interpreter and linked it to the engine. The next step is to provide a sandbox similar to the one used by modified the LuaScript interpreter, so players can program the bots of SOCCER TACTYX (and the forthcoming GUN TACTYX 2) in BASIC.
A further step could be to bring ScriptBasic at the same level of the Lua language, so programmers can write directly their APOCALYX demos or games in BASIC, side by side with Lua, but this is a larger step because I should expose all the engine functions to ScriptBasic and that is a very long work. I think that a limited support, devoted to SOCCER TACTYX, is enough for the moment.


Siaržuk Piatroŭski said...

Hello! You wrote about features ScriptBasic, and on first place - ease for beginners. But, in ScriptBasic not yet have good IDE or NotePad with highliting. Also, community ScriptBasic not very big, how community BlitzMax or PureBasic, or FreeBasic.

In BlitzMax, PureBasic and FreeBasic have good IDE's, big community and more&more other modules, ex. LibXML, Physics etc

You think about Apocalyx module for this three Basic-like languages?

Leonardo said...

Thank you for suggesting other BASIC flavors. I'll try BlitzMax, PureBasic and FreeBasic, to see if they are open source, easy embeddable in the engine and controllable at a low level as ScriptBasic is.
For what regards the IDE, I plan to integrate the NASCI editor in the game itself, so an external IDE, even if full-featured, is not easy as an in-game IDE.
Thank you again for the suggestions!

Siaržuk Piatroŭski said...

>>> "to see if they are open source, easy embeddable in the engine and controllable at a low level"

I'm think, that this is FreeBasic. ;-)

Leonardo said...

Siaržuk Piatroŭski said:
> I'm think, that this
> is FreeBasic. ;-)

This FreeBasic is really great! I haven't tested it extensively yet, but it seems only compiled. This is not a disadvantage, of course, but for my particular needs... I need an interpreted version.
Thank you again for the suggestions!

Mike said...

If you're considering spending all that time implementing a new scripting language, have you considered Python? It's an easy-to-learn (yet powerful) and mature (with lots of documentation on extending and embedding) language with a big community. Python is also used in a number of commercial games, including Civilization IV, Battlefield 2142, and Eve Online.

(Okay, I'm also a big fan of Python)


Leonardo said...

> If you're considering spending
> all that time implementing a new
> scripting language...

No, I use scripting languages (Lua, ScriptBasic and other) that already exists. I only said that I modified their interpreter a little to fit my particular needs.

> have you considered Python?

Yes, but I don't use it in my engine because it needs a 40Mb installation, while my full featured engine is only 4Mb (or less in particular configurations). If I deploy a small demo of less than 1 Mb, I can't pretend that my users also download and install Phyton, if they haven't already installed it.

However I think that Python is GREAT and I occasionally use it to personalize Blender.

Mike said...

> because it needs a 40Mb installation,

Wow, I didn't think Python would require that much space.

Well... great work on your engine and all of your contributions!


Verhás Péter said...

If you need assistance with ScriptBasic I am open to answer them.

Peter Verhas

Leonardo said...

Peter Verhas said...
> If you need assistance with
> ScriptBasic I am open to
> answer them.

Thank you very much!
Now I'm developing the simulator/viewer of the game (MekaWars), but in a short time I'll work on the AI interpreter. In the current design it is based on Lua, but I think that Basic (in particular your ScriptBasic) is simpler for my target players.
For my particular needs, the execution of the scripts must yield after a specified amount of steps and I need also full control on memory allocation. I realized that the ScriptBasic interpreter can fulfill these needs. The only things that is missing yet is a simple way to disable particular functions (such as those that write files on disk) to avoid that sharing scripts among players causes the diffusion of malicious code. In conclusion, very soon I'll ask if it's possible to disable certain "functions" in a easy way.
Thanks for your great Basic interpreter!

Sanyaade said...

This great since I have been thinking several times of using apocalyx in my BTEC foundation and Nationals classes but always run away when I think of my students level and the kit. Things like property editor can be incorporated to make it easy for Kids and Teens to use this great piece of game-engine. I am so addicted with Apocalyx that I always download the sourceforge packages monthly and keep the archives on my machine. Inclusion of Basic Language scripting will be a dream come true for many students out there. A Great step in the right direction --> Kundos.

Have you look at SdlBasic: http://www.sdlbasic.altervista.org/main/, Basic4GL: http://www.basic4gl.net/, ThinBasic: http://www.thinbasic.com/ and ForceBasic: http://forcebasic.sourceforge.net/

These packages are opensource and all have in common for being designed to do some games and animations. Also have calls for openGL in some cases which mmay reduce embedding time in Apocalyx. I think ForceBasic has meta-programming in place too.

Please let me know if you need more infos on some more basic language scripting (of course opensource)

God blesses!!!

Best regards,

Leonardo said...

sanyaade said:
> This great since I have been
> thinking several times of using
> apocalyx in my BTEC...
> Inclusion of Basic Language
> scripting will be a dream come
> true for many students...

I am a teacher, too. I plan to include Basic scripting in the engine at some level (more probably for AI scripting than engine scripting), but I think also that Lua is not so difficult to master (at a "basic" level) than Basic. It's true that students, already trained in Basic, prefer to use that language instead of studying another language, but it's very educative to show that the language syntax may be different but the underlaying structures of procedural languages are the same.

Anyway, don't expect an Apocalyx based on Basic too soo: now I'm developing a game that requires a lot of my spare time (MekaWars) and actually I'm developing the AI through Lua scripts, because they already work in 0.9.3

Thanks for the links. They are going to be very useful!

John Spikowski said...

Hi Leonardo,

It's been a while since we communicated about using ScriptBasic with your projects. Since then we have standardized on MinGW-gcc for Windows that will generate both a 32 and 64 bit executables. I hope you found time to implement ScriptBasic in your gaming engine.

John Spikowski
ScriptBasic Project Manager