Author Topic: Underwater distortion effect possible?  (Read 4088 times)

Zeror

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
Underwater distortion effect possible?
« 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.

Would be very cool if it can. :)


wrightmat

  • Full Member
  • ***
  • Posts: 241
    • View Profile
Re: Underwater distortion effect possible?
« Reply #1 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.

Diarandor

  • Hero Member
  • *****
  • Posts: 806
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: Underwater distortion effect possible?
« Reply #2 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
« Last Edit: August 28, 2015, 02:03:08 am by Diarandor »

wrightmat

  • Full Member
  • ***
  • Posts: 241
    • View Profile
Re: Underwater distortion effect possible?
« Reply #3 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!

fosamax

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Underwater distortion effect possible?
« Reply #4 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

Zeror

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
Re: Underwater distortion effect possible?
« Reply #5 on: August 28, 2015, 12:20:11 pm »
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.

fosamax

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Underwater distortion effect possible?
« Reply #6 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.

DementedKirby

  • Jr. Member
  • **
  • Posts: 75
    • View Profile
Re: Underwater distortion effect possible?
« Reply #7 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.

Zeror

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
Re: Underwater distortion effect possible?
« Reply #8 on: August 31, 2015, 10:17:26 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. ;)

DementedKirby

  • Jr. Member
  • **
  • Posts: 75
    • View Profile
Re: Underwater distortion effect possible?
« Reply #9 on: September 01, 2015, 04:29:17 am »
True, but at least you get an underwater effect in the mean time ;)

Zeror

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
Re: Underwater distortion effect possible?
« Reply #10 on: September 02, 2015, 03:22:33 pm »
That's right. It is my back-up solution if the distortion is not possible.

DementedKirby

  • Jr. Member
  • **
  • Posts: 75
    • View Profile
Re: Underwater distortion effect possible?
« Reply #11 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.

Zeror

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
Re: Underwater distortion effect possible?
« Reply #12 on: September 06, 2015, 10:25:49 am »
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

DementedKirby

  • Jr. Member
  • **
  • Posts: 75
    • View Profile
Re: Underwater distortion effect possible?
« Reply #13 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?

Zeror

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
Re: Underwater distortion effect possible?
« Reply #14 on: September 07, 2015, 09:18:08 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.