Scripting System

BlitzMax Forums/BlitzMax Programming/Scripting System

_Skully(Posted 2009) [#1]
I'm at a point in my Tile Engine development where I think attaching a scripting system to it would be wise... otherwise, it becomes that much harder to add later... any suggestions?


xlsior(Posted 2009) [#2]
LUA seems to be the most commonly used.


GaryV(Posted 2009) [#3]
BriskVM seems popular around the community:

http://www.koriolis-fx.com

There are also modules floating around for Lua and Squirrel and likely a few others


ImaginaryHuman(Posted 2009) [#4]
Or make your own.


_Skully(Posted 2009) [#5]
I was thinking of making my own... it just needs to be able to process stuff like:

If I didn't have three kids, a job and a life, I would


I'm just not sure where to start with processing the keywords there... Kids, Job... and Life. LOL

But seriously... I would rather spend my time making the game not in the weeds


Blueapples(Posted 2009) [#6]
I'm still a fan of BinaryPhoenix's MicroC module, pretty cleanly written, pure BlitzMax, very hackable code.


plash(Posted 2009) [#7]
Seems like Helios site is down.. Can you put up a link to the latest version of MicroC?
Also, did it ever go class-based?


slenkar(Posted 2009) [#8]
lol @ skully

LUA is pretty good


N(Posted 2009) [#9]
Lua is the only option I'd recommend.


therevills(Posted 2009) [#10]
How would you use Lua?

Ive never used a scripting system in my games, how would you code it to do triggers etc?


N(Posted 2009) [#11]
There's already a considerable wealth of information on Lua out there, so I would recommend starting with Google. There've also been numerous discussions about it on here, so the search tool for the forums is handy as well.


Htbaa(Posted 2009) [#12]
Although I'm sure BriskVM is a good product, I'd say go with Lua. It's a very easy, fast and powerful language to use, free (although BriskVM is really really cheap), and comes with BlitzMax by default.

There's lots of online examples an Lua discussion to be found on the net. They also put the complete copy of the 1st edition of the Blue Pil (Programming in Lua) online. I've got a hardcopy of the 2nd edition and it's a well written book.


therevills(Posted 2009) [#13]
Ive looked at Lua, but not sure how to use it to create triggers etc


Htbaa(Posted 2009) [#14]
You'll have to write the interaction layer between Lua and your program yourself.

I figure you already have, or should, write a trigger system in your program. Then you just need to export the functionality to Lua so Lua can interact with your program, and vice versa.


therevills(Posted 2009) [#15]
write a trigger system in your program


LOL... my "trigger system" is:

if collideImage[player,x,y,0,key,kx,ky,0] then opendoor[0] 


etc... hard coded... :(


N(Posted 2009) [#16]
For what it's worth, trying to fit Lua or any other interpreter into a project mid-way is not likely to be worth it.


Htbaa(Posted 2009) [#17]
It depends on how you designed your program. But it doesn't hurt to keep it in mind whilst designing your program.


N(Posted 2009) [#18]
In other, shameless pimping news, I just released LuGI, my Lua wrapper generator/core code:

http://github.com/nilium/lugi.mod/tree/master

It's basically a very small core and a generator. You import the generator, generate glue code, then include the glue code and import the core. There were speed issues with the last one of these things I wrote, since it all depended on the reflection module and resolving everything at runtime, so this is a fair deal faster, since it's all generated and compiled into your project instead.

Anyhow, if you decide to look at using it, there are some basic instructions/documentation in the wiki section (top bar, click 'Wiki') on how to use it that I probably can't explain informally.


_Skully(Posted 2009) [#19]
Thats why I was asking at this point. I'm just created my base actor class and started thinking 'if I don't do this now I'll regret it'

I'll definately check that wrapper out...tks!


_Skully(Posted 2009) [#20]
Htbaa,

Lua comes with BMax by default? I don't see any doc references to that.

The reason i want to use scripting is because the character in my game will (hopefully) be able to jump into other vehicles/characters etc and there will also be mini-games. I want the mini-games and movement code for the various vehicles to be scripted... the point being that script code can transfer over the net ;)

Nilium,
I keep seeing references to glew code.. is that the interaction layer between the game and the script code? as in "glewing" the two together?


Htbaa(Posted 2009) [#21]
Yeah in the latest 2 releases of BlitzMax it's available again. I believe with was also available before but somehow disappeared?


N(Posted 2009) [#22]
I keep seeing references to glew code.. is that the interaction layer between the game and the script code? as in "glewing" the two together?
Essentially, glue code is the (generated in this case) code that provides a sort of translation or interop layer between BMax and Lua. Some people write it by hand, some people generate it, etc. I prefer to not write it by hand because that takes ages and there's no much point to doing that with Lua when the interface is pretty much going to look the same for everything (it's also possible to use one glue method for everything, but there are severe speed penalties for that).