Advertisement

Multiple script with similar functions inside them

Started by August 11, 2013 12:21 PM
0 comments, last by WitchLord 11 years, 3 months ago

Hi, I'm still learning angelscript, it's a great scripting engine!! I write a tester application and I think I kinda get the hang of it. But know I want to get serious and merge it inside my game. I have a few things to ask , but first let me tell you a bit the mechanics of my game :

I have several game objects, and their behaviors must be put inside a script. The script will call some of the registered functions of course. Thing is those script must have on_spawn(), on_despawn(), on_udate(float), that will be called by the game engine. So different object could refer to different script. For example for dwarfs there could be a "dwarf.as" that will be shared by dwarf class enemies, and there could be "demon.as" for demon class ones. But in each script there has to be those pre-defined callback functions.

But in order to allow compilation of similar functions I have to compile each script in different module. Am I right? That's the question you see. I don't know how well it will perform, and maybe there are better approach to this design. Can you give me a hint on how to solve this problem?

With what you describe you should definitely use different script module for each type of entity.

I suggest you take a look at the 'game' sample in the SDK. It has been built with a similar design to what you describe.

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