🎉 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!

Namespaces... Again. :)

Started by
0 comments, last by WitchLord 19 years, 4 months ago
Hey I've been away from AngelScript for a while because I've been messing with other parts of my engine. (My AngelScript support works well enough for me to not have to mess with it that much.) I'm just wondering what your take on namespaces in the scriptlanguage is. I'm using AngelScript (like many others) for scripting entities in my game engine. Each entity has a "Controller" attached to it, which has a number of callback functions that are called when different things happen to the entity. To keep functions belonging to different controllers apart, I put them functions in different modules, one module per controller, and that works pretty well. Now I've been thinking about introducing built in state support to the controller, so that a controller can be in a specific state and then different callbacks are called depending on the state the controller is in. This would mean like another level of namepaces, and the modules isn't enough. I could start naming the functions in ways to separate them, like "state1_onUpdate" and "state2_onUpdate". That would work as a good workaround right now, so I'm not sitting here with my pants all the way down. I'm just wondering if there are any plans on namespaces, and what priority that has? A natural continuation on this is of course full blown class support, with inheritance etc, so I might just as well as what the plans on that are too? :) Oh well, I'm not going to stress you out here. I'm just curious. :) /Anders Stenberg
Advertisement
I've almost certain plans to add namespaces. Though the priority is quite low at the moment as it is quite easy to work around.

Full blown classes with inheritance etc, are a bit more difficult. I'm working in that direction but I have my doubts as to wether I will be able to get it to work or not. The changes made for AS 2.0.0 will make it easier for me to add this, and my next big step is to add support for script declared structures (no inheritance or class methods at first). It will be possible to move these structures outside the scripts so that they can be stored in the application, or even serialized.

The step after that is to add function pointers. Which will make it possible to add some sort of polymorphism (though still not as easy as through class inheritance).

The biggest problem I have right now is how garbage collection will work, for the script declared objects (simple reference counting isn't sufficient, as it won't be able to resolve circular references). This is something that I'm still analyzing.

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

This topic is closed to new replies.

Advertisement