Reflection/Camera/ shaking/Ghost effect?

edited December 2013 in Help request
Hey guys... most of the basic mechanics of my game is done so I am working mostly on art and graphics effects now.

As I got to know the FX/Particle system I started thinking how to code most of the spells/effects and there are three I couldn't realise how to do in some easy way.

First is a reflection effect. Pretty much a mirrored image in some surface, such as water. Here is an example:

topshot04.png

What I can think of is have a child object of the character, flipped on both x and y and placed at a special Z position. All the surfaces that reflect should be place under that Z and the non reflective ones over it. Would that be a good idea? Every character would need to have a child, doubling the number of objects.
Also, this wouldn't work with objects that have water inside them, such as a fountain.

The second is a camera shacking, very common when something really big is walking or a heavy hit is landed. Here is an example:

Smash.gif

I can't really think a good way to implement it. Would it be possible to add an FX to the camera? I haven't found any function to do that in the API.

The final effect is a ghost effect, basically another sprite of your character, mostly a different color and alpha that follows you with a slight delay. Ragnarok Online had this effect on power thrust and two handed quicken. Here is an example:

Shadowclone.gif

I couldn't think a simple way to implement this one either. I guess this one would have to be absolutely code created right?

Thanks in advance.

PS:
The games of the pictures I used are Tales of Phantasia (Nanco's copyright) and Secrets of Grindia (not released yet, Pixel Ferrets' copyright).

Comments

  • edited December 2013
    Knolan wrote:
    What I can think of is have a child object of the character, flipped on both x and y and placed at a special Z position. All the surfaces that reflect should be place under that Z and the non reflective ones over it. Would that be a good idea? Every character would need to have a child, doubling the number of objects.
    Also, this wouldn't work with objects that have water inside them, such as a fountain.

    Yes, that's an option and probably the one used most of the time in 2D games. You can easily control the order of drawing using the object groups. Don't forget to update the animation on both objects, which can easily be done with a wrapper function or you could simply "duplicate" the parent visual when receiving the render event (similar to the extraction step I mention in the "shadow" effect below). Depending on how complex is your setup, you could also go with shaders which will give you more flexibility but are sometimes harder to get right. I started writing a setup all in config, but it's longer than I anticipated and will probably have edge cases. :)

    One other option would be to have a quad for the water, placed at the right Z position (or in a separate group rendered at the right time), and when it gets rendered (hooking up to the orxRENDER_EVENT_OBJECT_START), you can go through all the objects in the reflectable group (orxObject_GetNext() takes a GroupID as parameter) and simply extra their "current" bitmap and render it upside down with some color teinting.
    The second is a camera shacking, very common when something really big is walking or a heavy hit is landed.

    This one is the easiest one. :)
    If you look at how I did it in Mushroom Stew, I simply attached the camera to a dummy object and only interact with the camera through that object, allowing the application of FXs:
    orxOBJECT *pstCameraObject = orxObject_CreateFromConfig("CameraObject");
    
    // Attaches the camera to it
    orxCamera_SetParent(orxViewport_GetCamera(pstViewport), pstCameraObject);
    
    // In config
    [CameraObject]
    ; This section can be empty
    
    The final effect is a ghost effect, basically another sprite of your character, mostly a different color and alpha that follows you with a slight delay. Ragnarok Online had this effect on power thrust and two handed quicken.

    This one requires some code, or at least some tracks in config. I'd just go the code way as it's probably more straightforward that way. You have a few options, the two that immediately come to my mind are having real objects mimicking the character with some latency, probably more trouble than what it's worth, the second one being a simple visual trick.

    For the second, you'd need to track the positions/animations of your character over the time window you want with as many samples as you want shadows. Given those data, you can simply hook upon the rendering of your character (orxRENDER_EVENT_OBJECT_START event), and display the shadows yourself there, when they're active by calling orxDisplay_TransformBitmap with the bitmap matching the animation frame and the color you want. You can see how to extract all those data by looking at how orx does it's 2D rendering in the orxRender Home plugin (orxRender_Home_RenderObject).
    Thanks in advance.

    If you need any other details or have any other questions, don't hesitate. :)
  • edited December 2013
    Thanks for the inputs, the camera one was really neat. I will code it soon, next friday is the final presentation of the game.

    The other are for a long time project.
  • edited December 2013
    The advantage with the camera object is that you can take advantages of quite a few properties of a regular object, including collision detection if need be.
Sign In or Register to comment.