• entries
    205
  • comments
    228
  • views
    112668

Script to my loo!

Sign in to follow this  
Mike Bossy

85 views

So as I stated in my last journal entry one of the new features I wanted to add to my engine was scripting. Up to now all of my game objects have a method call DoWork() that gets called once an update. This makes it easy to add behaviours to individual objects and have it encasulated with the object. Where this becomes a pain is in the fact that it is done with native code. That means any change means a re-compile of the game. Adding support for scripting would mean I could make gameplay changes totally outside of the code base leading to faster iterations which is the holy grail of all game designers.

Lately here on Gamedev it's become all the rage to create your own scripting language of some sort. I had the distinct pleasure of doing that back in the early Xbox 1 days before Lua and the like were as prevelant. My system was just used to expose in-game hooks for testing purposes. It worked well and actually shipped in a handful of titles. The problem is that it was super simple with hardly any functionality. I'm sure I could accomplish something similar now but why when there are so many solid fully functional alternatives. I can see wanting to do it as an educational exercise but I've been there done that. Give me the pre-packaged tech please! :)

The library that I chose was Lua. I could've gone for any number of options but I played with using Lua in C# a couple of years ago so I just stuck with it. I was again amazed at how easy it was to get Lua and Luabind built. Open source has really come along way over the years. Source drops that just compile perfectly right out of the box kick ass.

After getting the libraries built I created a quick little test to make sure I knew how to properly use the library. I had my C++ code calling Lua scripts and then my Lua scripts calling back into my C++ classes. LuaBind makes the binding very simple. I still need to figure out passing a pointer to a class to a Lua script but I'm sure it won't be too tough.

The next step is integration into my engine. There really are any number of places where I can use scripting. I'm going to start out by using it for game objects and then maybe expand it into my input manager, etc.
Sign in to follow this  


2 Comments


Recommended Comments

Man, all of the scripting systems are all of the rage these days like you said lol. EasilyConfused just implemented one as well into "Udo" if you've been paying attention to that journal. :)

Also, I was curious about the change I suggested for your particle engine about adding the previous particle's velocities to the new particles. Did it improve it at all by chance, or am I out of my mind? :P

Share this comment


Link to comment
The particle change made the explosion look a little more natural and flowing so yeah it was good :). Nothing too drastic but just enough to notice.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now