Jump to content

  • Log In with Google      Sign In   
  • Create Account


object orientation & scripting language integration


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Dog_Food   Members   -  Reputation: 122

Like
Likes
Like

Posted 01 May 2002 - 02:05 PM

For quite a while I have pursued the dream of complete scriptability of all parts of my "game engine". I have come up with viable solutions, but they seem slightly inelegant. I was wondering if anyone has a more elegant interface solution. I developed a scripting language with an interface as explained in the FuBi article which allows direct calling of functions, both native and script. I have a problem however with deriving from objects where it is not known beforehand what elements will be scripted. The native code used to be heavily object oriented, but I experimented with dissalowing virtuals. This allows me to create custom vtables and be able to derive anything from any class, (allow native or script code anywhere). This however makes everything quite ugly on the native side, even though it fulfills the goal of pure scriptability. Now I am considering a more removed interface which allows me to preserve my object oriented internal structure (like the interface in java or lua). But this means I must explicitely differentiate script hooks from native code hooks, and I don''t like this. I am considering making an interface style which allows explicit exporting of groups of hooks to the scripting language, but this means an interface will be either all script or all native, or an ineficient hybrid. Does anyone have an elegant solution where all the code can be more unified?

Sponsor:

#2 Shannon Barber   Moderators   -  Reputation: 1355

Like
Likes
Like

Posted 01 May 2002 - 06:16 PM

Well, the first person that came to mind to glint information from is Scott Bilas - but I see you've already read his FuBi article.

The Right Thing To Do is add additional support to FuBi to support virtual calls. A generalized functor (grep Loki) could help with that, as it turns every type of C++ invocation into a executable entity with first-class value semantics. It's hard to convey what that really means, if you don't grok the naunces of language 'citizenship'. The lack of first-class functions has long been a deficiency of C++, that interpretted OO & functional languages possessed (e.g. smalltalk & ML).
Alternatively, a virtual call is just a vtbl dereference and then a normal function call. It shouldn't be too hard to pack that into FuBi (I know, always easier said than done). You would need an additional FuBi table of virtual function names (use the mangled names) to virtual function offsets, which you would use on the vtbl of the passed object, then invoke the method in the vtbl by the normal Fubi means. Use the already in-place FuBi cookies to remote the object.

Almost undoubtly Scott has added this functionality to DS, though he may have run out of time. Odds are good a new article for Gems3 will cover this

P.S. The game Scott's been working on was released a few weeks ago, Dungeon Siege - cool game, I'm still learning how skrit'ing (DS scripting language) works (which is where he put FuBi to work).

[edited by - Magmai Kai Holmlor on May 2, 2002 1:20:04 AM]

#3 Shannon Barber   Moderators   -  Reputation: 1355

Like
Likes
Like

Posted 01 May 2002 - 06:22 PM

It''s actually a run-time linking process... dynamic binding may never be the same.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS