Blitz Virtual Machine : script systems made easy

Community Forums/Showcase/Blitz Virtual Machine : script systems made easy

Koriolis(Posted 2003) [#1]
Hi all blitzers.
If you have not gone on the blitzcoder forums while the blitzbasic ones were down, you may have missed my annoucement:

I'm happy to announce the release of "Blitz Virtual Machine".
I think many of you know how usefull and cool a scripting engine can be. BVM will allow to easily add your own script system to your app.

Blitz Virtual Machine is a virtual machine for Blitz3D/BlitzPlus. It is packed with a compiler that generates bytecode modules that are then executed by the virtual machine. Generally speaking, BVM is the solution to easily include a full-featured script system in your application. Now in Blitz you can :
- Make portable code that can even be sent over the net at runtime.
- Make Blitz Basic-based interpreters embeded in your game.
- Do modular programming by importing other modules without any need of having their source code.
- Use a "plugin oriented" architecture that will let users create MODs for your game.
- ...
All that with a few lines of code, and with the benefits of using normal Blitz Basic code rather than a proprietary language.
Yes, with BVM you'll write your scripts in plain BlitzBasic!
This means that for almost everything you can already do in your BlitzBasic apps, you'll be able to do the same in your scripts. This includes:
- custom types declaration and manipulation
- all kinds of loops (including for each)
- ifs
- selects
- functions calls
- consts, globals, locals, arrays.
etc.
Furthermore, you can share code and types between independant modules (via importing/exporting).

In addition, it's very easy to customize BVM to suit your needs (creating your own command set in particular).


You can download the trial version from my site in the "projects" section, as well as purchase the full version.

There are 2 kinds of End User Licence Agreement for BVM:
- The independant developper license. It allows you to use BVM to write freewares and sharewares applications that you distribute by yourself as an independant developper. It costs 15 euros or 15 american dollars.
- The commercial license. It allows you to use BVM to write commercial applications (commonly distributed by a software publisher). It costs 50 euros or 50 american dollars.


I hope you will all appreciate the possiblities BVM gives you :)
Any feedback appreciated.


Koriolis(Posted 2003) [#2]
I have also made another little demo (you should first check the ones that go with the trial version).
This is only for Blitz3D this time. It's a 3d function viewer: you type the code of a BlitzBasic function that takes 3 parameters (x,y,t) where t is the time, and returns the height. It thus defines a surface, with the possiblity to animate this surface (if you use the 't' parameter). Then you can see this surface in full 3d, possibly animated
Thanks to BVM, this is a real (basic) viewer, in that you don't have to recompile the full app if you want to change the function. This isn't graphically impressive of course, but it shows how everything is dynamic (run time compilation of the function in this case).

By example, here I have entered a simple function:

and then I get the following (animated):


You can download this demo from here:
http://koriolis.free.fr/files/surf.zip


Koriolis(Posted 2003) [#3]
You can also check this thread on blitzcoder:
http://www.blitzcoder.com/cgi-bin/ubb-cgi/postdisplay.cgi?forum=Forum3&topic=001145


simonh(Posted 2003) [#4]
Excellent work. There are surely endless possibilities as to what this could be used for.

I think I may at some point incorporate this into Super Hamster Ball, so people can write their own scripts in addition to designing their own levels, to give them extra control.


Koriolis(Posted 2003) [#5]
Yeah, that would be great. This is indeed one of the main goals of BVM. Easily adding the ability to let users do MODs of your game is really cool, especially given that it's in plain blitz :)
It will be hard for me to wait until some cool games like this show what BVM is capable of ;)
Patience, it will come soon.


(tu) sinu(Posted 2003) [#6]
just been messing around with this again(gonna purchase soon) and it is brilliant.
Once you get past the initial setup everything is sweet.
Gonna save alot of time coding lots of stuff using features from this.

ps will there be any new tutorials?


Binary_Moon(Posted 2003) [#7]
This sounds really cool but i have downloaded the demo and installed it and none of the demos will run. I guess I have done (or not done) something wrong...? Probably something really obvious :)


Koriolis(Posted 2003) [#8]
sinu > Yes there will :)
The one that is included mainly covers the issue of setting up a complete plugin-like architecture. In that, it can be labeled as an "advanced" tutorial, even if the basic idea is pretty simple.
On the contrary the demos show basic/common things.
What I plan to add is a series of mid-level step by step tutorials, meant to be used as a reference pattern for your own code.

Before that, I have to finish the next update, which still involves a fair amount of work (it will add some powerfull optional features).

Binary_Moon> Did you copy the dll and its .decls into the blitz's userlib directory? If you have, what do you see exactly?


Also, I would like to let you know that PooPants just released the alpha version of its game, using BVM. You should really have a look, it's really cool and promising.
It's mainly targeted to people with a minimum of programming knowledge, as the game purpose is to measure your programing skills by writing the IA of fighting bots. The good thing being that noone, even PooPants, can tell in advance which tactics are really the best, so anyone has a chance to become the king of the hill with some clever programming ;p
Go to BlitzCoder, it's in the showcase (don't forget that it's a very early version, and there is still a lot of room for improvements).


Binary_Moon(Posted 2003) [#9]
Did you copy the dll and its .decls into the blitz's userlib directory?


Nope. Didn't know there was one.

Done it and now everything works properly. You should add a faq page to your docsa thing so that people know about this. I just tried installing it again and noticed that it does tell you to copy the files in the readme. However I never read the license agreements or text files in things like this (as I'm sure a lot of others don't) so completely missed it. Now I have had a look it appears to be working fine.

I now need to read and understand what is going on since, as I said in my first post, this looks really interesting, and could be good for my future games.


jfk EO-11110(Posted 2003) [#10]
I am planing to implement this into my engine as well. It is a great project.


(tu) sinu(Posted 2003) [#11]
what i can't believe is the little hype around this project, to me it's the best thing released for blitz other than blitz itself.


Koriolis(Posted 2003) [#12]
Thanks :)
I guess we will have to wait to have several kick ass games made with BVM, in order for more people to see its real potential. Since BVM seems to be already appreciated by some talented game programers, I am pretty confident that it will come sooner or later :)


jfk EO-11110(Posted 2003) [#13]
I have a question (Don't have the Time to play around with it atm.)

Let's say I have a game with a mainloop and some variables.

Now I add a command somewhere in that mainloop, that will call a BVM Script. Can this Script access my Variables if it knows the Names? Or how would I have to do that?


Koriolis(Posted 2003) [#14]
You can expose all your global variables to the scripts. For this, you just need to declare these variables in your "command set", then generate your "invoker" (fully automatic), recompile and voila, now your scripts can access these variables :). And of course, only these variables, which is a good new for safety.
A "command set" is just a file in which you declare the functions, types and global variables of the main app that must be accessible from the scripts (a bit like functions in a .decls file).
The "invoker" is a piece of generated code (a function) that you just need to include, and that is the bridge between your app and the scripts.


(tu) sinu(Posted 2003) [#15]
"You can expose all your global variables to the scripts. For this, you just need to declare these variables in your "command set", then generate your "invoker" (fully automatic), recompile and voila, now your scripts can access these variables :). And of course, only these variables, which is a good new for safety.
A "command set" is just a file in which you declare the functions, types and global variables of the main app that must be accessible from the scripts (a bit like functions in a .decls file).
The "invoker" is a piece of generated code (a function) that you just need to include, and that is the bridge between your app and the scripts. "

one of the great simple things about BVM :)


Physt(Posted 2003) [#16]
Koriolis - BVM is INSANE! I love it. Now I have to drop everything I'm working on just for this. I just can't believe you've done this. Thanks!

BTW, I love the pricing too!


Koriolis(Posted 2003) [#17]
BTW, I love the pricing too!
:)


(tu) sinu(Posted 2003) [#18]
"Koriolis - BVM is INSANE! I love it. Now I have to drop everything I'm working on just for this. I just can't believe you've done this. Thanks!"

i've been messingwith it loads to, the possibilites are amazing.

ps shame you can't do/aren't doing something like this for DB, then you would make alot more money of which you surely deserve, the BB community doesn't seem to like spending money :)


Physt(Posted 2003) [#19]
Sinu - Well, now I HAVE to buy it!


jfk EO-11110(Posted 2003) [#20]
Thanks a lot! This is amazing! The Perfect Plugin Interface IMHO!!! And also for Mods! I have to finish some Project States and clean up some thing, then I'll start work with it. Is it possible to send you cash to purchase?


Koriolis(Posted 2003) [#21]
Yes. BVM is available for purchase on ShareIt. The relevant link is on my site in the "project section", right under the link for the trial version. You can't miss it.
ShareIt handles a wide range of payment options, including cash sending by mail.


Synchronist(Posted 2003) [#22]
Koriolis, BVM definately rocks! I'll be buying this one for sure! The best thing is, IMO, that I don't have to mess around LYAL (Learning Yet Another Language)! Thanks and please keep it going!


Koriolis(Posted 2003) [#23]
Thanks. Don't worry, I keep working on BVM, adding new features...stay tuned :)


Koriolis(Posted 2004) [#24]
Just a little post to let everyone know that the new BVM features are on their (looong) way. It may take a while before everything passes the beta test phase (and before I finally reduce my TODO list to near empty), but it's definitely coming along nicely.

Until then, I have set up a forum on my site, so for any question/suggestion, feel free to drop a post.

http://koriolis.free.fr/forum


Kuron(Posted 2004) [#25]
Sounds cool. Can't wait to get the new version :c)


RiK(Posted 2004) [#26]
Why didnt I spot this before.....!!!!

This is exactly the answer I need to script the NPC behaviours in my current project..

A happy, happy chap....


Mustang(Posted 2004) [#27]
Ummm... eh.. what? Maybe it's the morning, but I don't quite fully get the benefits of the BVM (this just by reading this thread and not testing th thing itself - which will follow next). So for example how can I use BVM to make my WIP FPS game better?


RifRaf(Posted 2004) [#28]
wow, very nice.


Koriolis(Posted 2004) [#29]
So for example how can I use BVM to make my WIP FPS game better
To give the short and easy answer, BVM let's you add a scripting engine to your game.
Take Unreal, all the game logic (AI in particular) code is put in separate scripts, rather than having everything hard coded in the core engine. This has a lot of advantages, and for Unreal the most noticeable is probably that it allows the end user of your game to make MODs of your game (the unreal MOD comunity is really huge, and it has done a lot for its popularity). This is one of the things that you can do with BVM. One point that tends to make most BVM users happy is that the language for the scripts is blitz itself, meaning that code that runs in blitz can run as BVM scripts (usually without even any modification).
For more, just have a look at the site and the trial version.


JoeRetro(Posted 2004) [#30]
Koriolis,

I believe there is a memory link in BVM. After conducting a couple of test runs with my project I see that I'm losing 4 to 8 bytes every few seconds. I left a post on your forum which appears to be inactive at the moment with some code snippets.

If you need more info, send me email at jhillman@...


Koriolis(Posted 2004) [#31]
Hi P-Q4, I have answered to your post. In short (and because I'd better set other's people mind at rest on that point), it appears that you are simply seing the growing memory consumption of the debuglog. So this is not related to BVM at all, just remove your calls to 'DebugLog' :)


JoeRetro(Posted 2004) [#32]
Thanks Koriolis, that appears to be the answer!


JaviCervera(Posted 2004) [#33]
I can't wait for the BVM update!!! When will it be out?


Koriolis(Posted 2004) [#34]
I prefer not to give any date, because my previous last rough estimate was to release it ... about right now. And truth is it's not ready yet :-/
*But*, I'm on the last big item on my TODO list, and I guess most of the other items could be postponed to further updates.
So let's say "in not *too much* time", that's really all I can say for sure.