The general strategy for developing Voxatron's toolset is to provide specialized features (modifiers, microscripting, physics properties etc) that capture 90% of a typical designer's requirements, and then leave the rest to Lua scripting. Lua will be kind of like a glue that that holds the engine together and fills in the gaps of functionality.
Working on custom player inventories and menus that have a plethora of possible requirements, I feel I've hit that 90% boundary. The engine is now complete enough that it is possible to create a Lua API that is grounded in something stable and maintainable. For this purpose, I've created a text editor that can be used within Designer, and a custom version of Lua designed to work efficiently with Voxatron (both of which you can see in action in PICO-8). It's time to (carefully) plug everything in and see what happens!
It will also be possible to write cartridges from scratch in Lua, of course. This would be handy for making games that need their own style of physics, or things like RTS, sim or puzzle games that deviate a lot from typical Voxatron shooty-runny things. The purest cartridge can contain simply one Lua script, and no rooms or object definitions.
If all goes well, I'll start to roll out a minimal API later next month for anyone to experiment with. It is a typical object-wise callback scheme, where things happening in the world/engine call Lua functions that the cart designer provides.
Here's a simple example:
This is a regular twirly gun using emitters to shoot out the bullets. I've attached a script to each bullet (it's just a SCRIPT item that sits anywhere in the bullet's resource tree) that looks like this:
function this.new() local a = new_bullet() a.col = 12 return a end function this.draw(a) local x,y,z = a:xyz() line3d(x,y,z-30,x,y,z-5,a.col) end
Every time a bullet is created, the new() function is called (if one exists), and some Lua data (a table, to be precise) is attached to that object. Now, any time something happens to the bullet -- it's moved or drawn or collides -- a corresponding function is called. Here I've only provided a single function that is called by the engine each time the bullet is drawn which grabs the bullet's world position and draws a line straight up.
If you're new to programming and want to get a head-start, I would suggest playing around with PICO-8, which is free for all existing Voxatron alpha users (including the earlier Humble Bundles). Have a look at the Updates Page for download instructions.
Incidentally, I am relatively new to Lua scripting myself! So if you have any feedback or questions about Voxatron scripting, feel free to post here.
also zep I posted this on your last blog I'll ask it again here:
--"will there be a separate attribute like command that can scan exactly how much bullets you have in a specific weapon? So I can make a quiver in the back of a character change when they have a specific amount of arrows?
Also I am having a problem with a specific cartridge : here
I don't know why but I can't upload it, and when i tried the first time it prevented me from accessing the Lexaloffle webstite completely, for a whole month. I had to upload Point Crash 2.0 in March when it was due in February"--
Yes! I added microscripting trigger for this: HOST:ITEM(DEF_ID).AMMO > N
It's also possible to control things like showing number of arrows carried in the inventory at the top of the screen, but it's nice to modify the in-world player graphics too.
I sent you an email about the broken cartridge. I think the bbs login problem was a separate issue, and might have been because of a false ip blacklisting (my site goes through cloudflare for some security protection). Feel free to mail me or tweet @lexaloffle if it happens again so I can try whitelisting your ip address. Otherwise I'm not sure what could have caused that :/
I fixed the bug where pasting an object tree from another file would break alias references. Is that the one you mean?
I've been away from scripting with lua for a while. The only comment I have is to make a simple base object class for new people. It can be done with lua pretty handily but the implementation isn't great for beginners. Even though it's a great tool for things like custom UI and the like. I look forward to digging back into this editor.
[Please log in to post a comment]