Going to bump this thread with a tiny piece on what I'm doing right now.
So I'm right now hooking up more of the scripting engine to the map objects.
http://www.youtube.com/watch?v=nW225v3rfww
I am using angelscript, however I've decided to hold off from using some of the advanced features (Mostly the object types) to make something similar to QuakeC code.
This is my script for the scout.
<div class="c" id="{CB}" style="font-family: monospace;"><ol>uint64 Scout_Create() {
<span style="color: #993333;">const uint64 self = AddMeshSceneNode( "models/scout.obj" );
SetMaterialTexture( self, <span style="color: #cc66cc;">0, "textures/scout_flat.tga" );
SetMaterialTexture( self, <span style="color: #cc66cc;">1, "textures/scout_bloom.tga" );
SetMaterialType( self, "solid" );
SetScale( self, vec3( <span style="color: #cc66cc;">0.25f, <span style="color: #cc66cc;">0.25f, <span style="color: #cc66cc;">0.25f ) );
<span style="color: #b1b100;">return self;
}
<span style="color: #993333;">void Scout_Update() {
RotateByDegree( self, vec3( <span style="color: #cc66cc;">45.0f, <span style="color: #cc66cc;">45.0f, <span style="color: #cc66cc;">45.0f ) );
}
<span style="color: #993333;">void Scout_Drop() {
}
Simply put, when you add an object to the map you can give it a script, in the scout's case I gave them all the script "Scout".
You can tell that the _Create() function is what actually defines the graphics, this is a step away from my resource structure I used before. Having the _Create() function do the graphical setup eases how much data needs to be entered into the map editor to get an item onto the scene.
Each frame the object's _Update() function will be called, where self will always be set to the reference of the object on the scene (Read only, too), self in the future will contain some object properties that are exposed to the script side of things.
_Drop() is always called when the map unloads, the scripter does not need to worry about cleaning up resources, this is only here in case they want to do some custom stuff at the map end stage, perhaps save a chest into memory that hasn't been opened so it can be restored on _Create()?
The use of "self" here will look wrong to a lot of people, the correct usage would be to create an entire object for the "things" on the map where I can do self.RotateByDegree(), however I think that introducing the OOP approach to scripting might cause some people to go crazy with what they write, if anyone disagrees with me then speak up and I'll swap it over to the traditional OOP method.
Now I'm adding in input reading in the script side so I can move a "player" object around on the map.