most inefficient rain system ever?with video

M

mr_starfire

Guest
Ok guys so as stated in my last post i have a generic platformer and very early on you go from being outdoors into a cave . ok so in my level it is raining . now im not great at particle systems so i decided to go a different route with my rain system so here is how it works ..

it is object based hence the title of this thread

ok so i have 3 objects for the rain

obj_rain
obj_cloud
obj_splash

my cloud uses a dice to decide the likelihood of creating a raindrop for example in the step event i use with a chance of 1 in 12 create instance obj_rain.. the clouds also move from left to right and back so that the rain does not become to uniform in appearance

The rain object has a starting direction of 260 and a speed of 6
when this object collides with my floor object it is changed into a third object called splash_obj

this simply waits for the splash animation to end then deletes itself

i have not noticed much of a slowdown as it is only used in a small area ..


my questions are
1 have i mad it more difficult than it needs to be ?
2 am i likely to notice performance issues down the line?
3 is there a better way of doing this which includes splash animations etc

thanks in advance guys
 

Yal

šŸ§ *penguin noises*
GMC Elder
This is probably the simplest possible way of doing it, particles need a bit more setup and if you need the drops to splash ANYWHERE they hit the ground, it's pretty much impossible with particles since they can't have collision events or be checked after creation in general. So objects pretty much is your only option. To address performance issues... just don't spawn raindrops the player can't see (aka too far outside the view). The simplest way to solve this? Have raindrops destroy themselves in their Outside View 0 event (under the Other category). From my experiences, you need around 300-500 instances to start causing performance issues on a bad PC, but it depends a lot on how heavy the objects' code are... you can't get much lighter than your raindrops are now, so don't worry too much about that.
 
M

mr_starfire

Guest
Hey thanks i thought i was a dumbass lol . my raindrops are set to destroy themselves after there animation has ended should i add the out of view also?

I did anyway cant hurt thanks again :)
 

Fredrik

Member
@mr_starfire
If it seems stupid but it works, it's not stupid. And also if it's only used at a small area it shouldn't really be a problem, even tho I could guess the amount of instances could be a problem for someone else playing your game with a bad computer.
 
M

mr_starfire

Guest
@mr_starfire
If it seems stupid but it works, it's not stupid. And also if it's only used at a small area it shouldn't really be a problem, even tho I could guess the amount of instances could be a problem for someone else playing your game with a bad computer.
this probably will never be played by anyone other than myself lol its more of a learning project so i guess that does not really matter .can i ask a further question here or do i need to open a new thread?

also my pc specs are

intel i5 6500 3.2ghz
8 gb ddr4 ram
gtx 760
120 gb ssd
2x 500 gb hdd
windows 10 pro or ultimate cant remember lol <64 bit
 
M

mr_starfire

Guest
Hi again just thought i would add a little vid to get any recommendations . i was going to put this in the wip section but feel its a little too well little lol
sorry about that .

 
I

icuurd12b42

Guest
You will get a huge performance drop the more you add instances... maybe not so much now that they added a faster collision system. but such implementation has failed in the past.... There is a thread on the old forum...

the fastest method we found was to do a series of ray traces when the room starts with this
http://www.gmlscripts.com/script/range_finder

along the entire width of the room and set an array of x,y coords that matches where the rain would hit a tile.... the rain drop hitting the ground would simply be choosing a dozen points from the array, each step to make a particle there.
the falling rain would simply fall through without colliding with anything. if the tiles are in front of the rain, no one would notice....
 
Top