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

    That guy

  • Global Moderators
  • 2440 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

    media multimixer

  • Global Moderators
  • 4651 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
  • 16820 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

    That guy

  • Global Moderators
  • 2440 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

    That guy

  • Global Moderators
  • 2440 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
  • 3833 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

    media multimixer

  • Global Moderators
  • 4651 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
  • 1455 posts

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

    media multimixer

  • Global Moderators
  • 4651 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
  • 840 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

  • GMC Member
  • 1845 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

    That guy

  • Global Moderators
  • 2440 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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users