#16056 - Krakken - Sat Feb 07, 2004 9:54 am
Hi,
I have recently been working on quite a complicated game and am not too happy with the way it's turning out because of the organisation I have used. I tried to pre-plan everything and it somewhat worked but still... there is a lot of room for improvement.
I know lots of windows based games use an in-built scripting system that does all the work of the game design while the engine takes care of the "nitty gritty" stuff such as sprite management. However, I don't really understand how this is done in GBA games?
How do you decide what each character says etc? There are many ways I can think of but none that would be easy to follow when your game gets bigger than a few levels.
Thanks.
#16059 - torne - Sat Feb 07, 2004 3:27 pm
You can use a scripting system. =)
#16061 - DekuTree64 - Sat Feb 07, 2004 4:32 pm
I never did see the point in scripting, aside from saving compile time. I just write functions like TextBox(), WarpToMap(), SetGameSwitch(), etc, and then give each map an event C file and 'script' using those. Then you get the ease of using single lines to do most things, but you're still in C, so there aren't any limits to the kinds of things you can do. You might be able to save space with scripts though, if they're just text files with short commands and parameters, because you could compress them with LZ77 or something and only decompress the one for the current map. Or for higher game creation speed, just leave them as raw text files that you can attach with GBFS and test immediately.
But personally I think it's more work than it's worth, and imposes pointless limits.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku
#16064 - torne - Sat Feb 07, 2004 4:55 pm
I'd make a scripting system by having a horribly complex struct/union combo (or classes and subclasses for OO types) which could represent all actions that my game engine supported in the minimum possible amount of space, then writing a compiler that translated nice readable text scripts into teeny data structures.
There aren't very many restrictions of such an approach; if you include branching and loops in your language along with all engine features you have, you're pretty much equivalent to writing C modules.
#16067 - DekuTree64 - Sat Feb 07, 2004 5:13 pm
Yeah, I suppose that would save some space in the long run. Maybe give each object a single byte type identifier, and let the scripting system decide how big it is and what the parameters are, so in your script files you can just have a continuous stream of event objects.
Might save a few bytes/event call, since you could use a single byte for the type id, instead of a bl instruction to the function, which would be 2 bytes in THUMB, and then the instructions to load the parameters into the registers would waste a little more space.
Ah well, either way it's not that much compared to like the map and sound data, so I won't worry about it unless it ever bites me in the behind.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku
#16068 - Miked0801 - Sat Feb 07, 2004 5:18 pm
Scripting comes in its own on larger teams. It allows non-programmer people to do programmer tasks. On an RPG style game, game scripting can be over 50% of the programming load. Make a nice easy to use scripting system and you can get almost anyone to do scripting for you. Nice. Also, each script command should only take a byte plus some extra bytes per entry for more complex commands therefore saving on space.
It's also real nice to look at scripts only w/o having to worry about debugging C code (once the script engine is happy that is.)
#16077 - sajiimori - Sat Feb 07, 2004 7:21 pm
Also, you can design a scripting language to fit the problem at hand, instead of bending your problem to fit C.
#16087 - torne - Sat Feb 07, 2004 9:08 pm
I like OO so I'd typically make the scripting entries instances of objects, which means there's no parser code required in the game whatsoever; you can just ask them to execute themselves. =)
The compilation to structures/objects can be done by nice fast compiler-generator tools on a PC host with cycles to spare for that kind of stuff. bison is your friend.