Hi,
at the moment I am thinking about how I would breath live into my game objects. I am at an early stage of my project
but try to take these issues into account as early as possible.
I chose Java as a development language primarily because of the great benefits I hope the language holds in account
for content creation/level scripting. I plan to achieve that by loading classes at runtime.
Lately i ran into a problem, while thinking about AI scripting. I want to do NPC animation and interaction as well as
the GUI cutscenes etc. with the scripting.
I found that, what I really would like is to assign scripts to objects and let them do their work concurrently.
roughly something like this:
headTo(treasureChest);
walkTo(treasureChest);
bendDown();
say("I have no key - I can't open it");
standUp();
headTo(Door);
walkTo(Door);
Well this is really simple, an actual implementation would look different - but I have never done that before - so
excuse my lacking experience =)
What I realized is:
- the execution is delayed, after the invocation of headTo an animation is started which will take some time. The
script should be freezed till then. After the animation has finished, the game engine or player object will execute
the next statement of the script.
The only way I can think of to do this in java is: threads.
Would it be a good idea to have lets say 1000 threads running ? Is there a way to have 1000 JavaVM threads, if
there is such a thing ? Threads on operating system level may be too costly.
Then the second thing is: How do the freezing ? Something like “stepping the vm”.
I am not sure if this is a showstopper and I would have to implement my own scripting system cough
I know that I could do the animation with a Finite State Machine, but I would prefer to use them not, because
they are not comfortable. The most pleasing would be to program each object with concurrently running scripts.
I apologize for the long post,
I would really appreciate if someone could give me some input on this,
thank’s
Frederick