🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

A feature I'd like to see (and could really use)

Started by
1 comment, last by Zoma 18 years, 5 months ago
I finished integrating Angelscript into my engine a few weeks ago (only took a week!), and while doing it I noticed a few features that I could have used and that would be helpful. One of them I also saw in a post a while back. It mentioned binding methods in a C++ class to Angelscript global functions. The initial response was that it could be done, but then it seemed like it was decided not to add it because there can always be multiple instances of that class. The exception to this was the main game engine class. It seemed like the workaround for this was to make a global pointer to the main engine, and have all functions that need to access the main engine's members use this pointer. I don't like this for three reasons. The first and most obvious is that you need to write a wrapper function for EVERY function you want to make global. Not a huge deal, but tedious nevertheless. The second reason is it prevents access to private functions, although one could argue that only public methods should be exposed. The third reason is that, in our case, we have to have multiple instances of our main engine class (don't ask). Each engine has it's own script engine, and therefore could be bound to global methods. My current work around is that I have an engine type in angelscript, but I really wish I could just make the functions global. For instance, if I wanted to make a bind function for my config files like the Quake engine has, every call to it would have to be prefixed with "engine." I'd like to keep it clean for people using the config files :)
Advertisement
It could certainly be done. I'm not too fond of that solution myself, but it seems that quite a few would preferred it, so I may actually reconsider this and implement it anyway.

Right now my priority is on implementing script declared classes with inheritance, so I cannot say when it would be possible to do so however.

BTW, do you have a site for your project? If you want I can link to it on the AngelScript page.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Heh, originally I started this post as "features I'd like to see," with inheritance being the second one. After not remembering the other features I'd thought of, I just made it the first :)

My project is has no web site, as it's really more of an internal tool (by tool think Office, not Notepad). But it IS a professional product for a company, so be happy :)

This topic is closed to new replies.

Advertisement