Spectre Editor – First pass Scripting

As with most games, it helps to be able to set up complex levels using various scripts.  Most editors have something like this.  So this week I’ve been working on getting the Scripting layer added.  I decided to go with game code as the scripting engine.  Which seems a little strange, but I feel that it gives a pretty flexible approach.  So in my game I would define a series of script actions that I want my objects to perform.  In the video below, I use a generic Wiggle script.  The script is applied to a given object by dragging and dropping it on the object.  Currently the scripts don’t save, and they can’t be removed once added, but its a first pass… its supposed to be pretty ugly.

The editor searches all the loaded DLLs and finds any and all classes that extend the IScript interface.  That means all you have to do to create a script, is create a class in your game.  The engine will find it, and make add it to the project.  Eventually scripts will need to be triggered by an event.  Various events could include, being clicked, updating a frame, colliding with something, being shot, etc.  Again events will be dynamic and you will be able to create events just by creating classes that extend IEvent. I still have a lot of polishing to do on this system, and I’m sure I’ll refactor it a few times still.

 

Related Posts