In the simplest terms, what is the common architecture that developers use to manage and persist script states in their games? Below is a better description of my issue.
I've doing a lot of research lately regarding exposing my c++ classes to either LUA or Python. I'm still not sure on what language I want to go with, but that isn't the real question. Exposing a class in either language is no problem, but what I don't understand is where to go from here.
What I don't understand is how people manage to get seemingly separate script states for every script instance in their game. For example, Every enemy in the game has a script, that defines a health variable for that enemy. So, if an enemy loses health, the next time I run his script, his health variable in the script should still show the health value it was previously.
I can see two obvious solutions to this problem.
#1. Have a different Lua interpreter for ever single instance. (This just seems needlessly expensive)
#2. Save the state of your entire interpreter and load that up for each script run.
The 2nd option seems like the best solution, but I have seen that this is a bad idea. Regardless, I did look into this, and it seems like using the Pickle library with Python would be a good solution. I have also seen that I could serialize parts of my Lua instance and store those.
What do you guys recommend as the best solution?
Kurasu1415Member Since 14 Jan 2005
Offline Last Active Aug 21 2013 02:47 AM
- Group Members
- Active Posts 44
- Profile Views 1,913
- Submitted Links 0
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown
Kurasu1415 hasn't added any contacts yet.