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

Multiple engines, good or bad?

Started by
5 comments, last by WitchLord 19 years, 12 months ago
I am trying to make a scriptable building declaration. For example, lets say I have 3 building types. Small, Medium, Large stored in 3 different scripts in one directory. Each one would have something like a cost function, and a build function. I want to load all the scripts in that directory, and iterate through them so that I can build the best building for a given polygon based on the cost function returned by each building. The problem is, I want all the building descriptions to have the same function declarations. So at runtime, I can load all the scripts in a directory. When it comes time to build a building, I call the cost function on each script to find out the best choice and then call the build function on that one to actually build the structure. Should I use a separate script engine for each script? Seems wasteful, and I don't know what kind of overhead is involved with each new engine. Could be hundreds of scripts. Is there any way of isolating all scripts added, so that I can query by function name within a certain script filename? I guess this is kind of like namespaces, but not really. Is there any way outside of having to append the filename to the script cost and build functions to load them into one engine and have them run? Like "int small_cost()", and "int medium_cost()". I would really not like to use this method, but if its the only way then I guess I must.
Advertisement
What you are asking for will be implemented in 1.8.0, the version I'm working on right now. With 1.8.0 you will be able to compile scripts into different modules, each with their own namespace.

For version 1.7.1, the two alternatives are to either prefix or suffix each function name to separate them into namespaces, or create multiple engines.

Most of the overhead with multiple engines comes from the engine configuration. If you have lots of system functions or objects registered the overhead will be larger. A rough guess is about 30-50 bytes per called registration function.

I'm hoping to be able to finish version 1.8.0 by mid July. Note: this is not a promise as I'm very short on time.

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

We are already using Multiple engines in our game to get around that problem, everything seems fine but one issue i have had with these is the inability to use 'extern' style of variables. i would love to have different scripts running in the same engine with some variables which i can share throught these scripts.

Can we make a small compiler like interface within VS for each script to make sure each script is precompiled(during app compilation) to know if the script is syntax error free before starting the host app?
Jayanth.KRaptor Entertainment Pvt. Ltd.http://www.raptorentertainment.com---------------------------------------------------------Why Mr. Anderson? Why? ...Why keep fighting? Do you think you're fighting for something - for more than your survival? Can you tell me what it is? Do you even know? Is it freedom, or truth, perhaps peace, could it be for love? Illusions Mr. Anderson, vagaries of perception. Temporary constructs of a feeble human intellect trying desperately to justify an existence without meaning or purpose.
Thanks WitchLord. I guess I will just play around with my other scripting ideas till then. Just for the record, I love AngelScript. I don't understand why everyone isn't pushing for this yet. Good work, especially for a freetime project.

Oh ye, I started learning it about a week ago, and there really is only 1 example to work with (2 if you count the bstr program). I think a group of simple examples rather than that one large one is probably the way to not turn beginners away from this. If I ever get time, i'll try wrapping some OpenGL functionality into a script, so that users can try their hand at GL programming through scripts.

EddHead, thats a pretty good idea.

Thanks for your help guys, later.
EddHead:

Version 1.8.0 will also allow interaction with script declared global variables, which would allow you to connect them between engines. The script functions would be more difficult to export to another engine though. I will think about it, maybe it will be possible in a future version.

The way to make a test compilation of the scripts is to write a dummy application that registers all the functions and object types, and then compiles the scripts. An application like this could even be made completely generic if the function and object types were put in for example a xml file. It would be a completely separate project though.

lxnyce:

People are probably not pushing for AngelScript because it is relatively new. The first public version was made available just about 1 year ago. And people also tend to look at what other professional developers are using, which would be Lua or Python. But, I'm seeing more and more interest in AngelScript as time passes. Someday, perhaps some really famous game developer will pick it up and tell the world that he'll be using it for his next game ;)

I know the lack of examples and tutorials is a real blocker when it comes to newcomers, but I'm doing my best to improve that along with the new features. I think the new overview that I recently put up on the site will help alot to show what can be done.

I will welcome any tutorials or sample programs with source code written by others. I can even host them on AngelCode.com if the author wants.

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

i dont think there would be any need to extern script functions(just variables would do) from one engine to another as of now, we could just send variables across. we could think about using a single engine instead with all the possibilities of multiple engines(to reuse functions), one thing i noticed was putting everything in the same engine would give line number changes during errors which would be hard to track, if that is fixed we can stick to one engine. but about multiple processes, i guess the load on one engine would be too much. one more workaround now is declare the global variables globally in the host application (kinda cumbersome).

your thoughts?
Jayanth.KRaptor Entertainment Pvt. Ltd.http://www.raptorentertainment.com---------------------------------------------------------Why Mr. Anderson? Why? ...Why keep fighting? Do you think you're fighting for something - for more than your survival? Can you tell me what it is? Do you even know? Is it freedom, or truth, perhaps peace, could it be for love? Illusions Mr. Anderson, vagaries of perception. Temporary constructs of a feeble human intellect trying desperately to justify an existence without meaning or purpose.
Currently I highly recommend having separate engines for tasks of different types, ex. one engine for GUI rendering and another for AI managing. This is mostly for safety, and simplicity.

Having one engine that handles different tasks of the same type will be much easier with version 1.8.0, because of the modules.

I'll verify the problem with wrong line numbers.

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