Slick Forums Forum Index Slick Forums
Discuss the Slick 2D Library
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

rain effect ??? (rainy environment)...

 
Post new topic   Reply to topic    Slick Forums Forum Index -> Help / Discussion
View previous topic :: View next topic  
Author Message
padam



Joined: 04 Feb 2009
Posts: 48
Location: Pokhra, Nepal

PostPosted: Wed Sep 02, 2009 5:54 am    Post subject: rain effect ??? (rainy environment)... Reply with quote

Hola everyone..
I want to use rain effect on one of my game level(it would be rainy environment). So i want to know has anybody used the rain effect on their game ?? How to do that efficiently ??? need just ideas and suggestion....
Gracias.
Back to top
View user's profile Send private message Send e-mail
rhino
Regular


Joined: 05 Oct 2008
Posts: 173

PostPosted: Wed Sep 02, 2009 6:26 am    Post subject: Reply with quote

A way to cheat would be an 'overlay' animation over the entire area.
Back to top
View user's profile Send private message
NateS
Game Developer


Joined: 25 May 2008
Posts: 577

PostPosted: Wed Sep 02, 2009 7:08 am    Post subject: Reply with quote

http://tinyurl.com/l47pke
Very Happy First result has link to a very good effect:
http://www.gamedev.net/community/forums/topic.asp?topic_id=193344
I doubt you need 3D rain though.

Write your own particle system. Each particle is a falling rain drop. Each frame, move the drops down at different speeds, possibly fading them out as they reach the ground, maybe making some of them twinkle occaisionally (just draw them in a brighter color for a frame or two). When a drop reaches the bottom, recycle it to the top.

There are many ways to optimize this, but only bother if you need the performance. You could manage the locations and colors in ByteBuffers and make the OpenGL calls yourself. This way one glDrawArrays call can draw them all. Or you could use point sprites. You could also possibly draw each drop multiple multiple times at different X locations on the screen.

It would be neat for a platform game to make the wind "blow" at an angle when moving the screen forward.
_________________
SingSong Karaoke - http://singthegame.com
Back to top
View user's profile Send private message Visit poster's website
padam



Joined: 04 Feb 2009
Posts: 48
Location: Pokhra, Nepal

PostPosted: Fri Sep 11, 2009 5:25 am    Post subject: Reply with quote

Gracias all.
I have created a decent rain effect for my 2d game. I have created a class called RainDrop which extends Polygon classs, and it has got properties like velocity,x,y,length. So i am initializing an array of say 100 rain drops(which are polygons) with their initilized properties and i am assigning their x and y positions randomly with random() function and i m making them fall with their given velocities. And when they reaches ground, i am reusing them.

Its looking pretty good with the nice background. Now i M goona put some wind factor also as nates suggested.

Gracias.
Back to top
View user's profile Send private message Send e-mail
Gilley55



Joined: 26 Sep 2009
Posts: 42

PostPosted: Tue Oct 27, 2009 1:53 pm    Post subject: Reply with quote

you don't mind sharing your wind and rain class do you?
i need something like that for my game and is it possible to get a preview of it in action?
Back to top
View user's profile Send private message
padam



Joined: 04 Feb 2009
Posts: 48
Location: Pokhra, Nepal

PostPosted: Fri Mar 05, 2010 5:40 am    Post subject: Reply with quote

I am sorry, I didnt checked this thread.
Yeah i have written a blog post on this. You can read it. But i haven't created a wind class, i am sure u can do it that. I am no experts on making fancy effects. This is very simple rain effect which does the job that i needed for my game. Alpha values can also be added to each drops for more good effect.

My code might not be efficient. You can download the demo here http://www.gaanza.com/demos/

http://www.gaanza.com/blog/2d-rain-effect/

Gracias.
_________________
http://www.gaanza.com/blog
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Slick Forums Forum Index -> Help / Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group