gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > scripting in GBA games

#5865 - maximAL - Sun May 11, 2003 4:54 am

hi,
i'm working on a little GBA game and wanted to implement some kind of scripting language to realize some quests and "cut-scenes".
my first approach was to use a simple system based on opcodes/parameters, which could be passed to a function list. but it turned out, that this is just to limited for realising some complex quests. and extending the whole thing to a real language with variables, loops etc. would be much to slow for the little machine, i guess.
has anyone here ever implemented an scipting system on the GBA (or similar system) and would give me some hints?

#5869 - tepples - Sun May 11, 2003 8:27 am

maximAL wrote:
extending the whole thing to a real language with variables, loops etc. would be much to slow for the little machine

Not necessarily. The Apple IIe (1 MHz 6502) was at least 50 times slower than the GBA (16 MHz ARM7) is, and the IIe ran Applesoft BASIC just fine. Heck, The Oregon Trail by MECC was written in BASIC with an assembly language graphics library. The slowest thing about Applesoft BASIC was the fact that it supported only float arithmetic and not integers.

Likewise, the Java platform is not slow; the half-baked GUI implementations that come with common PC versions of the Java platform are slow.

The slowest part about interpreting a script compiled to bytecode is not interpreting the bytecode but rather executing the more complicated operations. Use those sparingly and everything will probably be fast enough if you have actor density typical of RPGs (as opposed to scrolling shooters with 120 simultaneous sprites). If you can compile your script to bytecode that matches the Thumb instruction format and then call it as native code, everything will be even faster.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.