Jump to content


Photo
- - - - -

Thesnidr's Ripple Engine - Updated 18/4/10


  • Please log in to reply
42 replies to this topic

#1 TheSnidr

TheSnidr

    Heavy metal viking dentist

  • Global Moderators
  • 3062 posts
  • Version:GM:Studio

Posted 17 March 2009 - 10:18 PM

Additional Info
Someone asked how to make a flag flap in the wind without animating it in the Novice and Intermediate Users, and when I made this example, I thought it might also be useful to others.
There are two scripts, one for making flags (ripples are growing as they move to the right), and one for other effects, like a fullscreen ripple effect.
Here's the flag script:
Thanks to GamerXP for better color gradients

Here's an example:
Posted Image
Posted Image

Edited by TheSnidr, 16 November 2010 - 09:54 PM.

  • 0

#2 xot

xot

    GMC Dismember

  • GMC Elder
  • 4775 posts
  • Version:GM:Studio

Posted 18 March 2009 - 05:56 AM

There is a bug in the download version. In the script there is a variable called "ripple_intensity" which is set to argument8. It should be "ripple_quality".
  • 0

#3 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 22268 posts
  • Version:GM:Studio

Posted 18 March 2009 - 06:00 AM

Yeah, I noticed that too... And state that if it´s less than 2 it won´t draw right! I found 6-10 to be a good level... Oh and it´s a rather nice effect, by the way!!!
  • 0

#4 TheSnidr

TheSnidr

    Heavy metal viking dentist

  • Global Moderators
  • 3062 posts
  • Version:GM:Studio

Posted 18 March 2009 - 08:02 AM

Fixed the bug. I have a habit of renaming some of the variables, but not all, before I put it out :blink:

The intensity, speed and waveheight arguments can be changed to make different kinds of weather. With high intensity, high speed and low waveheight, it will look like a swift breeze.
Low intensity (should normally not be below 5 or 6), high waveheight and a medium speed gives a stormy look.
A low intensity, medium waveheight and high speed makes it look like a strong gust of wind is blowing.

Try to experiment with the values yourself!
  • 0

#5 Ruzzinator

Ruzzinator

    Xbox 360 Lover

  • New Member
  • 646 posts

Posted 18 March 2009 - 08:32 AM

That is a very very nice effect!
Well done indeed!

It was lots 'o fun playing around making the speed really high or low etc
Good work!!
  • 0

#6 wiiowner

wiiowner

    Absolute Zero Team

  • New Member
  • 685 posts

Posted 19 March 2009 - 12:25 AM

This looks very nice and the addition of self shadowing on the flag makes it that much better. 10/10! Also I didn't really mess around with the variables but it looks great and I don't think you would need to in any practical case. Just the amount of wind. Anyway great work.
  • 0

#7 Fede-lasse

Fede-lasse

    AI Programmer

  • GMC Member
  • 2009 posts
  • Version:Unknown

Posted 19 March 2009 - 02:32 PM

I may guess that sin() is somewhat the creator of the basic waves?

Edited by Fede-lasse, 19 March 2009 - 02:35 PM.

  • 0

#8 TheSnidr

TheSnidr

    Heavy metal viking dentist

  • Global Moderators
  • 3062 posts
  • Version:GM:Studio

Posted 19 March 2009 - 02:40 PM

I may guess that sin() is somewhat the creator of the basic waves?

By the way, the shadow effect on the flag doesn't look 100% realistic.


Correct. And when multiplied with i (as in the for loop), the left part of the flag stands still, while the waves get bigger and bigger the further they get to the right.

I know the shadows look a little bit strange, but the only way I can think of to make it look better, is making more vertexes to the primitive.
  • 0

#9 theweirdn8

theweirdn8

    Unrivaled Legend

  • GMC Member
  • 4098 posts
  • Version:GM8.1

Posted 24 March 2009 - 12:06 PM

Thank you sooo m uch!
Ample LEgacy needed this badly.
  • 0

#10 NickToony

NickToony

    GMC Member

  • New Member
  • 463 posts

Posted 02 April 2009 - 08:18 PM

If this had the ability to use image_angle, I would absolutely love you. :)
  • 0

#11 xot

xot

    GMC Dismember

  • GMC Elder
  • 4775 posts
  • Version:GM:Studio

Posted 02 April 2009 - 09:10 PM

If this had the ability to use image_angle, I would absolutely love you.

If you mean you want to draw it in a direction other than horizontal, use a d3d transform before calling it:

d3d_transform_stack_push();
d3d_transform_add_rotation_z(angle);
d3d_transform_add_translation(x,y,0);
scr_draw_flag(sprite_index,0,0,0,300,150,wind,5,20);
d3d_transform_stack_pop();

  • 0

#12 snowyowl

snowyowl

    GMC Member

  • New Member
  • 615 posts

Posted 02 April 2009 - 09:48 PM

That works? I thought you had to call d3d_start() first.
  • 0

#13 Schreib

Schreib

    Valen Shadowbreath

  • GMC Member
  • 1457 posts
  • Version:Unknown

Posted 02 April 2009 - 10:02 PM

My friendzzzz... xot shows his d3d_transform h4xx0rz. Oh, yeah, maybe it didn't originate from you, xot, but I still thank you for it. <_<
  • 0

#14 xot

xot

    GMC Dismember

  • GMC Elder
  • 4775 posts
  • Version:GM:Studio

Posted 02 April 2009 - 10:32 PM

That works? I thought you had to call d3d_start() first.


Most of the d3d functions work without having to call d3d_start() first. As far as I know, the d3d_start() function is really only needed to enable the perspective projection and the depth buffer.
  • 0

#15 Glen

Glen

    GMC Member

  • GMC Member
  • 841 posts
  • Version:GM:Studio

Posted 06 April 2009 - 01:08 AM

This is very useful. I appreciate you making this.
  • 0

#16 klear

klear

    GMC Member

  • New Member
  • 36 posts

Posted 06 April 2009 - 01:24 PM

Really great work.
  • 0

#17 dadio

dadio

    I miss my cupcake

  • YoYo Games Staff
  • 2061 posts
  • Version:GM:Studio

Posted 15 April 2009 - 07:36 PM

Another very slick effect!
Damn, you seem to be the Master of "sin" use! :D

This could come in very useful!
The ability to customise "the strength of the wind" is really really nice!
Thanks for sharing!
  • 0

#18 Fede-lasse

Fede-lasse

    AI Programmer

  • GMC Member
  • 2009 posts
  • Version:Unknown

Posted 17 April 2009 - 08:46 PM

Another very slick effect!
Damn, you seem to be the Master of "sin" use! ;)

This could come in very useful!
The ability to customise "the strength of the wind" is really really nice!
Thanks for sharing!

My best guess would be that he was either bored or has just learned it in school lately.

Edited by Fede-lasse, 17 April 2009 - 08:46 PM.

  • 0

#19 snabelost

snabelost

    GMC Member

  • GMC Member
  • 62 posts

Posted 20 April 2009 - 11:01 AM

This is VERY useful if your making a quality game and need a good goal flar or something and this code is awsome, if it just had a little blur into it it would be awsome
(I added the blur code to it and used it in my game, ill upload code later )
  • 0

#20 TheSnidr

TheSnidr

    Heavy metal viking dentist

  • Global Moderators
  • 3062 posts
  • Version:GM:Studio

Posted 20 April 2009 - 01:53 PM

Thansk for nice comments everyone!

As I just saw my topic on top again, I felt like updating it a little.

I have removed most of the "ripple_" variables, and I now use the arguments directly.
I made the variables so that other people could see what is what, and where it is used, but it seems it worked against its purpose: it only became harder to read.

And also, the script now requires a texture index, instead of a sprite index. That means you can now also use a background, if you get its texture index first (through background_get_texture)
  • 0

#21 -BanditGames-

-BanditGames-

    GMC Member

  • GMC Member
  • 86 posts

Posted 26 June 2009 - 03:47 AM

If this had the ability to use image_angle, I would absolutely love you.

If you mean you want to draw it in a direction other than horizontal, use a d3d transform before calling it:

d3d_transform_stack_push();
d3d_transform_add_rotation_z(angle);
d3d_transform_add_translation(x,y,0);
scr_draw_flag(sprite_index,0,0,0,300,150,wind,5,20);
d3d_transform_stack_pop();


i have a question related to this...

i want to use this, but i want it to work like a robe, if you ever played assassins creed, i want it like that, but its for a 2d platform game. i cant make it rotate like it is mentioned above, i would if i understood the code above lol.

and i just want it to like wrap around the player.

sorry for the questions, but if i could be guided through this, that would be amazingly helpful.

thanks you

and it is an awesome engine!

-BanditGames-
  • 0

#22 TheSnidr

TheSnidr

    Heavy metal viking dentist

  • Global Moderators
  • 3062 posts
  • Version:GM:Studio

Posted 27 June 2009 - 08:17 AM

The flag engine uses sine to make the wave. There's no physics involved.

If you want a cloak, you will unfortunately have to sprite it yourself. Unless you want it to look like this:
Posted Image
  • 0

#23 -BanditGames-

-BanditGames-

    GMC Member

  • GMC Member
  • 86 posts

Posted 27 June 2009 - 06:28 PM

The flag engine uses sine to make the wave. There's no physics involved.

If you want a cloak, you will unfortunately have to sprite it yourself. Unless you want it to look like this:
Posted Image


haha lol, ok then, i will try something and tell you if it works lol
  • 0

#24 dadio

dadio

    I miss my cupcake

  • YoYo Games Staff
  • 2061 posts
  • Version:GM:Studio

Posted 15 July 2009 - 04:55 PM

Hey hey.. just curious why did you change your name? makes it difficult to track things when people change their name & I'm interested in seeing other stuff by you.

Also, any chance of a full screen ripple effect (like underwater)...
or also I am very curious to see a non moving ripple or curve (ie: whole screen drawn to surface & some kind of sin distortion applied to it)... or even distortion applied to part of the screen?
could be cool for making underwater stuff...
or "heat" from lava...

The full screen non-moving distortion could be really interesting for making a normal flat level look "curved" or "wavy" ;)...
if the effect could be tuned on & off & /or the amount of distortion changed over time.. thne cool things like a Boss hitting the ground could cause a ripple effect through the ground :)

What do you think?

PS: Also, I just know you're working on that Animal Crossing example :D :P

Edited by dadio, 15 July 2009 - 04:56 PM.

  • 0

#25 TheSnidr

TheSnidr

    Heavy metal viking dentist

  • Global Moderators
  • 3062 posts
  • Version:GM:Studio

Posted 15 July 2009 - 07:51 PM

Thanks for the idea!
I edited the engine a little, and added a new script. Not a big difference, it allows you to draw a texture with ripples on it, but in a slightly different way than the flag (the wave height does not increase the further away from the left it is, and it's not slanted)
To make this a full screen effect, you can create a surface, draw everything on the surface, create a sprite from the surface, and get the texture index from the sprite, and use it in the script.

Added it to the engine:
Posted Image

Oh, and I changed my name because I wanted a more unique name. "Game & Watch" is so boring, and nowhere near unique. Especially sinze there's two members with almost the exact same name.
And I've been working on an Animal Crossing example, but it proved to be harder than I thought :D I managed to make a very good system, but I didn't manage to create a depth system for it. I gave up in the end.
But I just came to think of something: maybe it could work just editing my outside tower engine.
Hm....
  • 0

#26 dadio

dadio

    I miss my cupcake

  • YoYo Games Staff
  • 2061 posts
  • Version:GM:Studio

Posted 20 July 2009 - 11:01 AM

Groovy effects! Nice to see it full screen!

Too bad it's so slow in real time tho...
works pretty well at low res tho (smaller room size) :GM066:

Yeh, I was thinking a kinda Animal Crossing-esque effect could be made by rotating the Outside Tower example by 90degrees, & drawing only half the "cylinder" to fill up the bottom half of the screen...
unfortunately my brain is too small to implement that idea properly! :GM071:
  • 0

#27 MrOpposite

MrOpposite

    Yesterdays games

  • New Member
  • 744 posts

Posted 20 July 2009 - 12:06 PM

I have to say, the flags must be made out of rubber or something, they seem to stretch a bit much. Else it looks very nice ^^
  • 0

#28 TheSnidr

TheSnidr

    Heavy metal viking dentist

  • Global Moderators
  • 3062 posts
  • Version:GM:Studio

Posted 09 October 2009 - 08:00 PM

I've uploaded a new update.
The scripts are rewritten, faster and better. The fullscreen ripple effect is 13 times faster (from 20 to 260 fps)!

Edited by TheSnidr, 09 October 2009 - 08:00 PM.

  • 0

#29 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 22268 posts
  • Version:GM:Studio

Posted 09 October 2009 - 08:12 PM

Nice update TheSnidr! Good clean code that is nice and fast... What more can you ask for?
  • 0

#30 michael pw

michael pw

    GMC Member

  • GMC Member
  • 1488 posts
  • Version:GM8.1

Posted 09 October 2009 - 09:01 PM

this is insane! i might use it someday!
great work!
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users