Jump to content
  • Advertisement
Sign in to follow this  

Multiple script with similar functions inside them

This topic is 1745 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement

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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!