Local variables with scripts
I was just curious what methods people are using to store per-instance data for scripts. The way I did it in the past was that each script component for an object would have a map of string->floats and string->string and I just queried them from lua. It seems like it wouldn't scale very well though. Although if you used variants in your code for object properties, then I could see this working so well that the performance hit would be worth it, and there wouldn't be separation between script / code object data. Just curious how other people are doing it.
I was just curious what methods people are using to store per-instance data for scripts. The way I did it in the past was that each script component for an object would have a map of string->floats and string->string and I just queried them from lua. It seems like it wouldn't scale very well though. Although if you used variants in your code for object properties, then I could see this working so well that the performance hit would be worth it, and there wouldn't be separation between script / code object data. Just curious how other people are doing it.
I do it this way:
All engine depedent properties (render model, sounds, effects etc.) are part of the engine(C++), all game relevant parts (hitpoints, ai data etc.) are part of the script component. Eventually I have a 1:1 association between engine object and script data, whereas the script data consists of one or more (lua) tables.
Thought there's a grey zone (should I put in into the engine or script part ?). In this case I start out with putting it into the script part and if the performance hit is too high, I would try to move parts of it into the engine.
Eventually it seems to look like your approach
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement