I currently write a small game engine for 2D games in java.
As part of the engine I want to support scripts as the main way to implement in-game events.
- the scripts may run a long time
- several scripts can run parallel
- calls to java code are limited
As I want to implement a save-game function I will have to get the current state of the scripts in a format I can store in a file and load again at a later point.
- Are there any script engines for java which support this? (javascript or other)
How do they deal with multithreading and calls to java code?
Are there any good resources for this problem online?
Thanks
Edit: For clarity of what I want to do
- Game starts One or more scripts start to run in parallel
- Player calls save function
- The scripts pause
- The state of the scripts is stored continue or end
- Player calls load function
- the state of the scripts is loaded
- the scripts resume
I would like to know if there are any scripting engines for java which support pausing and storing their internal state in such a way.
(Support for the official java scripting api is not required)