Game Development

AngelScript integrated in half a day

I wrote about AngelScript a while back yet never had a reason to put it in the code up until today. This morning I was thinking about how to go about a general effects system for my game and concluded that the only thing flexible enough was either code or script. I specify effect files in XML settings, and those can’t refer to code (easily) so that left me with script. Plus this is really one of those rare times when scripting makes good sense:

1. Used in a limited fashion that won’t require much debugging
2. Extensible by modders in a situation where I don’t want to give out the source code
3. No better solution. I could make a full-fledged editor if I had the time and money, but I don’t.

I started on this about noon, went out for a good chunk of the day, and finished integrating it into the game now. I also created a sort of script instance system, where a script module (one or more related script files) is treated as a mini-program, with a per-tick update function, and a query function to indicate when the program was done. The script manager automatically handles tracking the pointers, and I did a pretty good job with the architecture the first time through for once, partly because my wife made me get the laundry and that 5 minutes away from the computer helped me solve problems in my head before I spent a lot of time coding. So this instance system will be perfect for effects as they update every tick doing stuff, and end after some amount of time.

I think it’s pretty good work that in one day I went from the vague problem of how to implement effects, to a working script framework for it.

Leave a Reply

Your email address will not be published. Required fields are marked *