Jump to content

  • Log In with Google      Sign In   
  • Create Account

- - - - -

Multiple script with similar functions inside them


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Bow_vernon   Members   -  Reputation: 137

Like
0Likes
Like

Posted 11 August 2013 - 06:21 AM

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?



Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3334

Like
0Likes
Like

Posted 11 August 2013 - 10:57 AM

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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS