So I got quite questions about how to Effects, Cinematics and Introductions in JME3 games. Some from my corporated partners and some from students who saw my examples online.
There are many ways to do it. I have my in-house CinematicEditor… We going to have an official CinematicEditor … We have Tonego Emittor Editor. For generic case, there is Animation4J, Java Animation framework. So i will not stop you to write up your own or use thoose. What I want to do it’s to help you with some concepts & classes that may help you to write one:
Concepts
- Effect … What is it? An activities that not affect the gameplay but visually attractive Yes. And we may talking about “Real-time effect”. Which involve time, and a timescale. Effect may be played by someone at the righttime. A bunch of effect may create various of beautiful things for your games. We will go for detail of Effect later.
- Effector … It’s a thing that affect other thing. Change it, but not create or destroy it. The operation of Effector does can be seen as a Function from A->A, which still keep a Person is a Person.
- Timing … It’s the way to schedule something ehead as a series of time and duration.
Implementation
- JME3’s Cinematic, CinematicEvent are concepts will be use the help Timing. As You see, it’s pretty obviously designed for the task but not abstract enough. Beside of that, you can also use other scheduler, Guava’s ScheduledExecutor for example.
- Effect can be parametezied as much as you can, you can also save or load it as a config, a JME object, as ParticleEmitter … The EffectPreset is the original of Effect before it’s staged. EffectPreset can be load and use to create other Effect base on one existed.
- Effector should be pretty dynamic. Common implementations use Interpolator and Reflection and the alike to make dynamic procedural value.
tween = vector1.intepolate(vector2,amount)
Reflection.setProperty(“position”,tween);
amount usually controlled by a curve call Easing ; Easing can be LINEAR, EASE_IN, EASE_OUT for example
You can see the same concepts in Animation4J which are generic to use in different framework. Also remember that not every value can be interpolated. Spatial.CullHint is one example. So aware of making options for not interpolatable value.
Futher more,
- You can have a collections of known (Default) interpolator for specific Class, you can have a Map of this known types.
- You can add dynamic constraints (one more layer of abstractions). For example: Positions can be composed by some vectors called forces. (This forces are actually live Vector3f references). So even if you loaded a effect of a ball moving around a point, but if the point move, the ball will still folow and move around them. This kind of things look a lot like ParticleEffect, which also are the concepts of Influencers based Particle effects which Tonegod write up.
Some applications
<span style=“text-decoration:underline;”>ParticleEffect and beyonds:</span>
Once you’ve learnt how to make Cinematic based ParticleEffect you will want to explore more possibilities as I did. So what i do is to write a EffectBuilder class which make it easy to write effect from Java code, also make it more paramaterized to be saved, also integrate with my codegen and editor to procedure code-generated version of the effects.
<span style=“text-decoration:underline;”>Cinematic</span>
You may want to extends the EffectEvent to which can be intepolated by its self and can be a timing target. Later, it can corporate and trigger Animation, Camera and what is already work in your Cinematic system. Also remember what the Forces static methods give you (something like simple accumulations of vectors like steering behaviors). You now can make better and smooth camera moves. The complete Camera system which driven by HFSM (or other reactive AI) are already in Atom framework that i wrote… But talk about that later.
<span style=“text-decoration:underline;”>Introduction</span>
You may see a lot of game has introductions and help system, tutorials or campaign level. Some of them has introductions which point you to object A, let you do one Action and greeting if you success. Such system can also be create with just JME3 Cinematic system and something like Guava’s Predicate (you can actually write one if you like).
cinematic.add(textEvent(“Pick the apple”));
cinematic.add(sequence(“InToTheGarden”));
cinematic.add(highlight(TheApple));
cinematic.add(waitEvent(tillPick(TheApple),“Greet, you are a quick learner”));
So the event will pause the cinematic system until the predicate is sastified.
Just above things can pretty much let you do kind a bunch of jobs that may be other pros don’t tell you and you have to figure out by your self. Or not? :)) Anyway, hope this actually helps. If you have more question, I hope me and other guys can spend some time to answer.
BUT Make the question short and precise, may be try to do your research time first!