Author Topic: Simple Water Waves  (Read 1118 times)

titi_son

  • Draco Rider
  • *****
  • Posts: 283
  • titi_son
    • View Profile
Simple Water Waves
« on: 23 March 2017, 15:15:06 »
I just tried if it's possible to add some simple (sinus) waves to MegaGlest to make the water a little less "static".
This is what i came up with until now:

https://www.youtube.com/watch?v=t6vFBpFE35Y

Of course sinus waves arent very realistic but they wont have a great effect on performance like this (also i am lazy ;) )
It would be great though if a big water area has bigger waves than a river has, but i am not sure how to differ a river from an ocean. And maybe some splash effect on hills or something.
But for now i think this would be a nice addition to make mg look greater without great effort. (Really. its a change of ~10 simple lines in the code :D )
One thing i could add would be to have waves from other directions. At the moment the waves always come from east.

What do you guys think about it?
Do we want to have options for that in the tileset? or in the map editor? or just activate it on all maps?
Does anyone have ideas how to improve them without great performance loss?
My first Tilseset: SPRING :) (included in Megaglest )

Secret Hint: To play online join the IRC #megaglest-lobby on freenode which is the lobby chat ingame. So you can chat with or wait for people in the lobby without running megaglest all the time.

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: Simple Water Waves
« Reply #1 on: 23 March 2017, 20:36:25 »
i think this is a great addition, and that it comes at a small cost is even better!, Good job!, Can we get this in SVN asap please people? ! XD.
WiP Game developer.
I do danish translations.
"i break stuff"

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Simple Water Waves
« Reply #2 on: 26 March 2017, 04:25:55 »
Can we get this in SVN asap please people? ! XD.
SVN? What year is it?  :P
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

titi_son

  • Draco Rider
  • *****
  • Posts: 283
  • titi_son
    • View Profile
Re: Simple Water Waves
« Reply #3 on: 27 March 2017, 22:26:29 »
Before i can make a pull request for this, i need to know how to implement this the best way.
Should there be options in the tileset? or should a mapmaker decide whether to have waves or not? or do i just activate it on all maps?
Or make a default setup which can be overridden by the tileset or map?
My first Tilseset: SPRING :) (included in Megaglest )

Secret Hint: To play online join the IRC #megaglest-lobby on freenode which is the lobby chat ingame. So you can chat with or wait for people in the lobby without running megaglest all the time.

wciow

  • Behemoth
  • *******
  • Posts: 968
    • View Profile
Re: Simple Water Waves
« Reply #4 on: 27 March 2017, 23:06:05 »
It makes sense to have it turned on/off by a switch in the tileset. Some tilesets want big choppy waves while others want calm smooth water.

It would be awesome if there was also a value to control the height of the waves for bigger/smaller waves.

Glad to see someone finally did something to improve the water in MG  :)
Check out my new Goblin faction - https://forum.megaglest.org/index.php?topic=9658.0

jammyjamjamman

  • Horseman
  • ****
  • Posts: 189
    • View Profile
Re: Simple Water Waves
« Reply #5 on: 30 December 2017, 00:37:26 »
This is awesome  :thumbup:

I actually think they look subtle enough that they would work in any tileset. I wouldn't worry too much about adding a switch, but an on/ off switch could be added to video settings.

As wciow was suggesting, it would also be nice to be able to modify the waves in the tileset e.g. by adding extra attributes to the <water> tag:

Code: [Select]
<parameters>
    <water effects="true" height="1.4" wavelength="5.3" speed="0.5">
    ....
    </water>
</parameters>
Where height is the amplitude of the waves, wavelength is how big/ small the waves are and speed is how fast they propagate.
"All right, I've been thinking. When life gives you lemons? Don't make lemonade. Make life take the lemons back! Get mad! 'I don't want your damn lemons! What am I supposed to do with these?'" ~Cave Johnson, Portal 2

titi_son

  • Draco Rider
  • *****
  • Posts: 283
  • titi_son
    • View Profile
Re: Simple Water Waves
« Reply #6 on: 3 May 2019, 16:06:46 »
Pull request is open https://github.com/MegaGlest/megaglest-source/pull/187

Syntax is the following
Code: [Select]
<tileset>
<parameters>
<water effects="true" waves="true" waveAmplitude="0.14" waveSpeed="0.013" waveFrequency="0.4">
</water>
</parameters>
</tileset>
I did not limit those values, but frequencies over 1.0 do not look good (they even look buggy sometimes).
This is because i do not adapt the vertices of the water (which would obviously also slow down performance and cause other issues)
I decided to not implement any options in the option menu.
My first Tilseset: SPRING :) (included in Megaglest )

Secret Hint: To play online join the IRC #megaglest-lobby on freenode which is the lobby chat ingame. So you can chat with or wait for people in the lobby without running megaglest all the time.

Pizza90

  • Draco Rider
  • *****
  • Posts: 281
    • View Profile
Re: Simple Water Waves
« Reply #7 on: 3 May 2019, 18:38:15 »
Very cool Indeed!
I hope it will be merged soon,
bit off-topic: are you going to get into coding MG as well? ;)
I translated Megaglest in italian and i keep the translation updated.

andy_5995

  • Moderator
  • Ornithopter
  • ********
  • Posts: 454
  • Debian Linux user
    • View Profile
    • Andy Alt's home page
Re: Simple Water Waves
« Reply #8 on: 4 May 2019, 07:16:51 »
I applied the patch locally and made a couple demo videos.

GunChleoc

  • Horseman
  • ****
  • Posts: 202
    • View Profile
    • Fòram na Gàidhlig
Re: Simple Water Waves
« Reply #9 on: 4 May 2019, 19:09:52 »
The videos look good :)

titi_son

  • Draco Rider
  • *****
  • Posts: 283
  • titi_son
    • View Profile
Re: Simple Water Waves
« Reply #10 on: 7 May 2019, 08:50:03 »
bit off-topic: are you going to get into coding MG as well? ;)
Well i think i wont start active development. Sorry to disappoint you :P
But i always made some additions to the code.
For example the health bars, blocking units in scenarios and the Uniformselection (this is why you can select multiple buildings)

I just sometimes have an idea or read a great feature request and if i am in the right mood i'll try to implement it.
My first Tilseset: SPRING :) (included in Megaglest )

Secret Hint: To play online join the IRC #megaglest-lobby on freenode which is the lobby chat ingame. So you can chat with or wait for people in the lobby without running megaglest all the time.