Wednesday, June 27, 2007

XeO3: Scripting Engine.

Okay, after a request for more info on the scripting engine/system I use, I've written up a small description of how it all works. It's not hugely in-depth, but it should give you the jist on how it all works...

So have a look HERE to read through, but feel free to ask questions afterwards. I do intend to write up an API for the script system, and do several examples and tutorials for when I release the code. I've some some small samples and doc's so that Luca and play with it, but I really need to do far more.


Anonymous said...

Thanks. How deep is the mini stack? Just one entry? Subroutines (just one level) could be useful for cramming more data into the game, but that depends a lot on the attack patterns.

I would like to see the inner working of CIRCLE command. I remember you writing about it last year, but that entry didn't go too deep into the details.

ldy #0 ; reset index into command
lda (PathAddress),y ; get command
asl a ; *2 to index table

How about using commands which are *2 already :)

; Move absolute

lda (PathAddress),y ; get move-to "X"
bpl DoAddX

adc SpxLo,x
bcs SkipAddX
dec SpxHi,x
bcc SkipAddX

adc SpxLo,x
bcc SkipAddX
inc SpxHi,x

sta SpxLo,x

lda Spy,x
adc (PathAddress),y
sta Spy,x

jmp DoNextPathAddY

; ...

adc PathAddress
sta PathAddress
bcc DoNextPath
inc PathAddress+1

Saves some cycles/bytes. If DoNextPath() works like I think, you can add Y+1 to PathAddress and store it directly to PAlo/PAhi table.


S said...

Thank you Mike =D

Keep up the good work, looking forward for the playable demo.


Mike said...

I don't actually have a DoNextPath() call in the 6502 source, but I probably would in a higher level langauge.

Optimisation is a skill of picking your fights, and aside from the circle command, I dont think the rest of the script system takes up that much - sprite drawing is by far the largest system, followed by scrolling.

Thats not to say I wont look at it.... just not yet :)

Mike said...

I dont use CALL's in XeO3, and only allow 1 deep FOR statements. This is a limitation due to memory and speed. I have done these on faster systems though.

So basically, the mini-stack is only 1 entry deep.