Solarus-Games English Forum

Solarus => Development => Topic started by: Zeror on August 27, 2015, 03:06:47 PM

Title: Underwater distortion effect possible?
Post by: Zeror on August 27, 2015, 03:06:47 PM
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 (https://www.youtube.com/watch?v=az2I343A5N4).

Would be very cool if it can. :)

Title: Re: Underwater distortion effect possible?
Post by: wizard_wizzle (aka ZeldaHistorian) on August 27, 2015, 11:54:44 PM
Should be easy enough to do as an overlay - basically using an animated sprite. I haven't tried an animated overlay before though.
Title: Re: Underwater distortion effect possible?
Post by: Diarandor on August 28, 2015, 02:00:24 AM
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
Title: Re: Underwater distortion effect possible?
Post by: wizard_wizzle (aka ZeldaHistorian) on August 28, 2015, 04:10:06 AM
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!
Title: Re: Underwater distortion effect possible?
Post by: 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
Title: Re: Underwater distortion effect possible?
Post by: Zeror on August 28, 2015, 12:20:11 PM
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.
Title: Re: Underwater distortion effect possible?
Post by: fosamax on August 28, 2015, 02:24:52 PM
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.
Title: Re: Underwater distortion effect possible?
Post by: 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.
Title: Re: Underwater distortion effect possible?
Post by: Zeror on August 31, 2015, 10:17:26 PM
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. ;)
Title: Re: Underwater distortion effect possible?
Post by: DementedKirby on September 01, 2015, 04:29:17 AM
True, but at least you get an underwater effect in the mean time ;)
Title: Re: Underwater distortion effect possible?
Post by: Zeror on September 02, 2015, 03:22:33 PM
That's right. It is my back-up solution if the distortion is not possible.
Title: Re: Underwater distortion effect possible?
Post by: 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.
Title: Re: Underwater distortion effect possible?
Post by: Zeror on September 06, 2015, 10:25:49 AM
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
Title: Re: Underwater distortion effect possible?
Post by: 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?
Title: Re: Underwater distortion effect possible?
Post by: Zeror on September 07, 2015, 09:18:08 PM
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.
Title: Re: Underwater distortion effect possible?
Post by: DementedKirby on September 14, 2015, 02:26:19 AM
I think that would be your best bet. Honestly, it should be pretty easy with animated tiles and the high layer transparent water overlay. Have you tried it out yet?
Title: Re: Underwater distortion effect possible?
Post by: Zeror on September 14, 2015, 11:51:32 PM
I'm experimenting.

(http://i57.tinypic.com/2lnefjs.jpg)

Lots needs to be done.
- Water overlay is not animating yet, but it does moves like the forest overlay.
- Tiles needs animation.
- Link is swimming, but can't interact with objects yet.
- And ofcourse Link's sprite needs to be changed to a custom made diving state.
Title: Re: Underwater distortion effect possible?
Post by: DementedKirby on September 17, 2015, 04:53:13 AM
Hmmmm... unless I actually see that in animation, I'd stick with having a high layer with transparent water tiles. So far, I feel that it looks better than that. Maybe when animated that would look better, but I've been experimenting with making Iron Boots and that's what been working for me.
Title: Re: Underwater distortion effect possible?
Post by: Zeror on September 17, 2015, 06:01:29 PM
I want to stick to the overlay, because i want to have the high layer for other stuff, like a school of fishes swimming around or airbubbles.
Title: Re: Underwater distortion effect possible?
Post by: DementedKirby on September 18, 2015, 01:44:06 PM
Well, I'm very interested in seeing the final product! Do let us know when you got it animated and how it looks!
Title: Re: Underwater distortion effect possible?
Post by: FacciaBianca on September 15, 2017, 02:26:41 PM
I apologize for replying in a 2-years-no-post topic (even though I've been searching for the forum rules but couldn't find anything), but if anyone's still interested by the French document about special effects, then I'd gladly translate it to English.