Underwater distortion effect possible?

Started by Zeror, August 27, 2015, 03:06:47 PM

Previous topic - Next topic
I developed the idea of creating an underwater dungeon for my game.

So i wondered if it would be possible to create an underwater distortion effect, like for example Jabu Jabu's Belly in Oracle of Ages.

Would be very cool if it can. :)


Should be easy enough to do as an overlay - basically using an animated sprite. I haven't tried an animated overlay before though.

August 28, 2015, 02:00:24 AM #2 Last Edit: August 28, 2015, 02:03:08 AM by Diarandor
Unfortunately, I think this is not possible yet, but maybe possible in next releases. In that effect, some pixels are shifted before drawn (not only for the ground, but also for entities on the map). We would need to be able to modify the pixels of the map and entities with some getters and setters functions on their sprites/tiles/surfaces, or something like that.

Solarus developers are still working on this, see:
https://github.com/christopho/solarus/issues/452
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

Yes, for that particular effect I guess you're right. I need the get/set_pixel functions as well (hopefully) for some lighting effects, so let's home this is implemented soon!

Just for reference purpose, here's a really old doc that explain how to implement a lot of special effects in a 2D RPG game.

The code relies on DirectDraw so it's not really usefull as is but it may give a good starting point for the math calculation involved.

The text is in french.

http://www.google.fr/url?sa=t&rct=j&q=&esrc=s&source=web&cd=8&cad=rja&ved=0CG0QFjAH&url=http%3A%2F%2Fwww.alrj.org%2Fdocs%2F2D%2FEffetsSpeciaux2D.doc&ei=qzXeUoT0IovY7AapxYGQDA&usg=AFQjCNFrxpfYrmlDwTp5i5y2M2mSXBh8yw

Quote from: fosamax on August 28, 2015, 11:54:40 AM
Just for reference purpose, here's a really old doc that explain how to implement a lot of special effects in a 2D RPG game.

The code relies on DirectDraw so it's not really usefull as is but it may give a good starting point for the math calculation involved.

The text is in french.

http://www.google.fr/url?sa=t&rct=j&q=&esrc=s&source=web&cd=8&cad=rja&ved=0CG0QFjAH&url=http%3A%2F%2Fwww.alrj.org%2Fdocs%2F2D%2FEffetsSpeciaux2D.doc&ei=qzXeUoT0IovY7AapxYGQDA&usg=AFQjCNFrxpfYrmlDwTp5i5y2M2mSXBh8yw
Looks like an interesting doc. Unfortunately I can not read it, because i don't know french.

I was able to track down the related game on archive.org

https://web.archive.org/web/20050208070757/http://jpeglauden.free.fr/html/projets/magicia.htm

You can download and test the game. It's still working on Windows 7. Didn't play enough to see the underwater effect in use anyway.

It's very possible to do.

Use the transparent water tile over the entire area on the highest layer. That way it will appear that you're underwater.

Quote from: DementedKirby on August 30, 2015, 07:27:46 PM
It's very possible to do.

Use the transparent water tile over the entire area on the highest layer. That way it will appear that you're underwater.
Then you have just a water overlay without a distortion. ;)

True, but at least you get an underwater effect in the mean time ;)

That's right. It is my back-up solution if the distortion is not possible.

I still think it will look pretty decent. Now, correct me if I'm wrong, but didn't most SNES games simply simulate the "underwater effect" with sprites? Super Mario World, Donkey Kong Country, Mega Man X, etc. just had the hero enter the water but it didn't distort any of the images yet you could still tell they were underwater. At least, with having the transparent water tiles as a high layer over the entire map you want submerged, you get a better illusion of being underwater than those previously mentioned games because 1) Zelda is viewed from a bird's eye view camera angle and 2) you actually see the water moving over the level. So I think it's a good thing for the moment and just as aesthetically pleasing.

Quote from: DementedKirby on September 04, 2015, 01:45:23 PM
I still think it will look pretty decent. Now, correct me if I'm wrong, but didn't most SNES games simply simulate the "underwater effect" with sprites? Super Mario World, Donkey Kong Country, Mega Man X, etc. just had the hero enter the water but it didn't distort any of the images yet you could still tell they were underwater. At least, with having the transparent water tiles as a high layer over the entire map you want submerged, you get a better illusion of being underwater than those previously mentioned games because 1) Zelda is viewed from a bird's eye view camera angle and 2) you actually see the water moving over the level. So I think it's a good thing for the moment and just as aesthetically pleasing.
Sometimes they used an overlay, and sometimes they used distortion.

For example Donkey Kong Country
https://www.youtube.com/watch?v=GH-UGtfGH8I

I see what you mean. But if you look closely, only the map tiles are distorted. Maybe you could do the same with animated tiles?

Quote from: DementedKirby on September 06, 2015, 07:50:09 PM
I see what you mean. But if you look closely, only the map tiles are distorted. Maybe you could do the same with animated tiles?
Could be an idea to try. That together with an animated overlay to would be a nice thing i guess.