
One environmental effect I see many people have trouble with in Game Maker’s 3D is rain – how to create it and how to make it look like real rain (not just a bunch of textured walls).
I’ve seen some impressive rain in recent game releases, particularly Gears of War / Gears of War 2, and I wanted to try to create something like that in order to see if the effect is possible in Game Maker. And of course, I also wanted to supply myself and others with a nice example.
After some fiddling around, I’ve come up with what I think is a good replication of the other rain effects I’ve seen in games like Gears, which runs reasonably fast, and isn’t too complicated under the hood. My example uses large, moving 3D walls textured with rain, scrolling down repeatedly and rocking back and forth and side to side using sine wave-based movement. The rain is composed of many objects placed around the level at the start of the game, and the camera disables objects dynamically as it moves around. I’ve also thrown in a simple animated ground (could be better), and fake terrain backdrop (the same as the one in my night sky example), and a skybox (courtesy of Yourself).
The example also uses a rudimentary FPS-style of controls / mouselook as well, but I just threw this in there to help show off the scene, so if you find a problem with that, please disregard it.
You can download the example here (2.5 mb).
Note: This example, for whatever reason, if only working with GM7 at the moment. As soon as I have a chance to figure out why GM6 hates it, I’ll update the link with a fixed GM6 file.
Please use this example for learning purposes only, and don’t pull anything directly out of it to use for your own work (including textures) without first asking me about it. Anyway, thanks for reading and enjoy!
Out of the box GM7 version:
ERROR in
action number 1
of Create Event
for object obj_camera:
Error in code at line 16:
global.ground1_tex = background_get_texture(bg_ground1);
at position 46: Unknown variable bg_ground1
Cool effect. I was getting around 45 FPS looking forward, about 15 looking up. It’s really good looking, too bad it sucks up so much CPU (like all cool effects in GM).
Ouch, I was pulling around 10 FPS…
I got the same error, but just pulled one of my own ground textures and put it in to get past that.
It was pretty good, but I couldn’t see much (probably shoulda kicked up screen brightness), good base to work off at the least.
Thanks guys, I got that error taken care of.
Very nice looking.
But, alas, i got a whoppin 4 fps
Wow, that was epic.
Too bad I lagged myself to death. Think this would work with a cylinder?
*tries anyway*
Love it! Best effect I’ve seen for rain in 3D. Shame the framerate is so low!
I get a ‘failed to run the game’ error message.
NVM.
Ehhh…
I clicked the download button and new i’m hearing millions of popup errors. (e.g. one every millisecond)
Uh… what?
I like it. No low fps or what, just smooth and nice. Just a little too dark for me, though.