Re: embedding scripting into a program:a few questions

  • From: "qubit" <lauraeaves@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sun, 7 Mar 2010 20:23:42 -0600

Hi Ty --
Did I read once that your base is implemented in C++?
Let me clarify what you are saying you want to do:
1. class A in your scripting language needs to interface with class World in 
your base, and use its methods, and also to add methods of its own, and to 
do this dynamically. Right?
2. These new methods need to access class World in some way.  Do they need 
to go so far as to touch private or protected data?  Since you want dynamic 
insertion/removal of methods in class A, these methods will need to be able 
to work with World without being members of World.
3. As an aside, you could of course dynamically create a new inherited class 
C for each method m(), which is derived from World and therefore can use 
World's protected and public data.    m() can be a virtual or nonvirtual 
method.  But this all has to be done in the interface to your scripting 
language.  This is an interesting problem, as it almost requires that the 
scripting language have the same inheritance structure as C++ to make the 
implementation fall out cleanly.  But who ever heard of a clean 
implementation in the "real world"...*smile*
Now, if your implementation goes so far as to create derived classes with 
their own virtual table for each function added to A, you will need some 
dynamic linking to pull it off.
I'll have to think on this one for a while.

Hey Ty, great job picking an interesting project.  That should go really 
well on a resumé.
Happy hacking.

----- Original Message ----- 
From: "Tyler Littlefield" <tyler@xxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Sunday, March 07, 2010 6:12 PM
Subject: embedding scripting into a program:a few questions

Hello all,
As some of you may know, I'm working on a custom mud base that I will be 
releasing to the public and probably using for my own mud in the near 
I've got most of the stuff I want handled, except scripting; I was told to 
use Angelscript and was taking a look at it, but it seems to not be to well 
documented, so maybe someone has another idea.

What I want, is to be able to make the world class (which stores a list of 
players, rooms, mobs, etc) accessible to the scripting language I use.
Secondly, I want to expose events so that the language can attach it's own 
functions to them.
Third and possibly more dificult, I want to expose my component system, 
which I will explain.

Rather than using a is-a setup (through inheritance), I decided to go with a 
has-a setup. This provides some really cool ideas for design, such as being 
able to let clothing use containers if you decide that your shorts need 
pockets, without either moving container functionality up the inheritance, 
or using a multiple-inheritance setup, which can become messy. So, the 
components get loaded with the object from a list. I can easily use an 
AddComponent function to add the component to the list, but I'd like to 
allow builders and coders that I don't want using shell or that have an idea 
for a component to be able to build one in the language of choice, then 
register it with the dictionary that is used for holding components and 
allowing other objects to use this setup. So, in short I need a sort of 
transparent way to communicate back and forth, and not for the scripting 
language of choice to just control the driver, etc.

Tyler Littlefield
Twitter: sorressean

View the list's information and change your settings at

View the list's information and change your settings at

Other related posts: