Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
Tormentor667

Snow in ZDoom?

Recommended Posts

How could I create realistic snow in ZDoom?

Is there a way to create snow via the particle system? Or is it possible to create snow via the "projectile_spawn" command?!

Via projectile_spawn, it looks like the snow is rain because it falls straight vertically. Is there any chance to make the projectiles move "left and right" when they fall (like a vertikal sinus curve :))?!

Share this post


Link to post

I think someone (Nightfang?) once modified ZDoom's source to have snow. IMO it'd be cool to have effects like snow and rain in ZDoom.

Share this post


Link to post

The site I linked to in one of the threads quoted above had the Zdoom particle snow mod, but I keep getting a "forbidden" message when trying it ATM. Could be my system. Access has been a bit screwy all week. The project site is at http://www.stud.ntnu.no/~jonasf/xmasdoom

There were 2 downloads IIRC, one was just the wad, another was with the modified Zdoom engine. Quite an old version of Zdoom I think (1.18?) and the snow wasn't a storm. just some nice Christmassy fluttering stuff.

Share this post


Link to post

I know, I have played this. But can't you reproduce it via a 1 pixel big sprite and a gravity spawned projectile WITH this nice floating left and right movement?!

If its just the one pixel and gravity, it looks like rain and ugly. I need the special snow movement!

Share this post


Link to post

With thing_projectile, you can alter the vertical speed from a slow fall to a very rapid smash into the ground so that should be OK.


Thing_Projectile (tid, type, angle, horiz speed, vert speed)

Make vert speed a small -ve number.

There is also a low gravity bit that you can set in Zdoom via a BEX patch that will make the thing fall slower than regular gravity affected items, so you could try that instead with Thing_ProjectileGravity.

To get the side to side motion, you could make your snowflake item have a few frames (via dehacked) and offset the position of the pixels differently in each frame to give a fluttering motion. It would take trial and error to get right, but I think it could be workable.

Edit: Oh yeah, the lo gravity bit is set by putting trhe word LOGRAV onto the bits line in a dehacked patch. Because this is an MF2 bit, it resets the other bits too, so if you want the item to still behave as a projectile, you would have to restore the other bits such as PCROSS, IMPACT and so on.

Edit2: Well, the above sounds like a foreign language to me, and I wrote it. What I mean is the bits line for your projectile would look something like this:

Bits = LOGRAV +PCROSS +IMPACT +anything-else-you-want

Share this post


Link to post

OK, I tried a few little experiments. I got some quite nice effects. Giving the snow flakes a lot of frames and offsetting them worked reasonably well as they fluttered down, but so did spawning the flakes as projectiles in random directions. They are slightly less "fluttery" that way, but it takes up far less frames. Maybe a couple of frames would be OK. Just enough to allow the flakes to "get jiggy" as Will Smith might say.

I also tried making it so that the flakes lay around for a while before disappearing, but because they are behaving as projectiles, if the flakes hit a wall, they would stay at the height they landed at, even if that was half way up a wall.

In the end, I decided simplest was best, at least for an example, then you can modify what you like.

I have done an example that spawns the brains/blood pool as a projectile from random map spots, at random angles at random intervals (at least I think that's what my script does) :-).

I used dehacked to give the flakes a single death frame, just so they look a bit different when they hit the ground and disappear. I pinched one frame from the unused Pain Elemental respawn frames to do this. I also set the brain/blood to behave like a projectile and zeroed the Pain Elemental respawn frame field.

Then I included a replacement graphic for the brain/blood object and a new graphic for the death frame.

I used the blood/brains as a projectile because this means I have not used up an enemies attack (as I would if I had used an imp fireball or something), I did not need to remove the sounds from the object (as I would with a fireball), or remove the missile damage, or remove its decal causing ability (again - as would be needed with a fireball). In addition, the brains/blood can easily be removed from the game without any major impact on gameplay.

If you want to pop along to my tripod site and scroll down to the bottom, you'll find a file called snowy.zip. Feel free to copy anything you want. The dehacked lump and script are in the wad. It's nothing fancy, but maybe it'll get you going.

Share this post


Link to post

Wow, the snow even splats on your face if you walk into it. ZDoom can do anything! Awesome trick Enjay.

What would you change to make the snow be a lot thicker, with maybe ten times more snowflakes on the screen at once?

Share this post


Link to post
Nanami said:

What would you change to make the snow be a lot thicker, with maybe ten times more snowflakes on the screen at once?

That is a neat trick - and easy to do too.

To increase the snow, just add more MAPSPOTS. So if you double them, you get 2X the snow and so forth. 3X for this amount of space is enough (imo).

You can also change the delay on the script to just delay(1). Don't remember if ZDOOM has a MAPSPOT limit - seems HEXEN did? I'll play some more.

Performance depends on your machine specs.

Share this post


Link to post

I think the limit for mapsots in Hexen was 200.

I wonder if I can remove it, or at maybe change it at least...

Share this post


Link to post

That sounds about right for HEXEN.

Ok. Ran ZDOOM with 305 mapspots. For delay(1) runs a bit doggie on a PIII1000. If you use

delay(random(const: 1,5 ));

not too bad. I'll make a 1000 mapspots and see if it works:)

EDIT: 1007 mapspots and it runs a wee slow:)

I have an idea to make the snow denser and not have to increase the #of mapspots so much. Just make the snow particles so there's more than one "snow flake" per graphic.

Share this post


Link to post

I wasn't even aware that I had used anything that was specific to the later versions, but it doesn't work with beta 33 right enough. Randy has just posted an update. We're now on to Zdoom 2.0 pre release 29

http://zdoom.notgod.com/lars/29.cab

As far as making the snow thicker goes, each snowflake is simply spawned fom a map spot, so you could add more map spots. To get good coverage of the outside areas, you'd need a lot of map spots though, and you'd have a lot of "things" on screen at any one time. This would probably cause a noticable slowdown on slower machines.

Instead of a single pixel snowflake, you could perhaps draw multiple snowflakes on the sprite graphic. Therefore every spawned snowflake would look like 3,4,5 or however many you drew. You'd probably want to use a few frames to animate the flake's positions relative to each other if you did that otherwise it might look like the flakes were members of the Santa Clause formation falling snowflake team or something.

And finally I guess you could simply reduce the time delay between the flake spawning to increase the number of flakes being produced per second.

Share this post


Link to post

I must have been typing slowly for all those replies to get in before me. :-)

I have certainly been warned a number of times by DeePsea when checking a map that I have exceded the 200 items with tids Hexen limit in my maps, but none of these maps have caused any problems in ZdoomHexen format doom maps.

I'm not sure what the highest number of tid-ed items I have is, but I must have 8 or 9 maps where the 200 is exceded (because I am using scripts to spawn monsters from Heretic and Hexen into doom games). As I said, all these maps work as I want them to. I have no idea if Zdoom has a limit or not, but clearly it must be above 200.

Share this post


Link to post

Just ran 2014 mapspots. Don't think there's a limit (probably dynamic expansion) - other than the speed of one's machine.

Share this post


Link to post
deep said:

Just ran 2014 mapspots. Don't think there's a limit (probably dynamic expansion) - other than the speed of one's machine.


Nice to know. I've never tried with anything close to that number so I have plenty of room before going into "uncharted territory".

Share this post


Link to post

Instead of an image of a snow flake you could make a rotating image of some snowflake moving in a semi random fashion in a way that the first image of sequence could come after the last one, i.e. it can be animated continually, for instance in 8 frames, so you would add to snow flake count without actually adding to the sprite nubers. and they would move a bit around. just like normal snowflakes.

Share this post


Link to post

Yeah, that's one of the things I tried. Looked quite good too. The example is just a "minimalist" approach, using only 1 extra frame from the dehacked frame table.

Share this post


Link to post
Enjay said:

I pinched one frame from the unused Pain Elemental respawn frames to do this. I also set the brain/blood to behave like a projectile and zeroed the Pain Elemental respawn frame field.


Which frames are the unused ones? (as I need some frames to create some new things). Also, what is the respawn frame field, and would if affect anything if I used the frames to create a scenery-type thing?

Share this post


Link to post
Ultimate DooMer said:

Which frames are the unused ones? (as I need some frames to create some new things). Also, what is the respawn frame field, and would if affect anything if I used the frames to create a scenery-type thing?


The unused ones are the pain elemental's respawn frames 720, 721, 722, 723, 724, 725. Pretty sure you can also use 887 as that has the picture of the unused grey floor spike/stalagmite allocated to it.

The respawn frame field tells doom which frames to use when the archvile resurrects a monster. Set it to 0, and the archvile will no longer resurrect that monster type. If you are playing Nightmare mode or with -respawn, the respawn frames are not used (the monster's body simply disappears and the monster reappears on its start spot with a teleport flash). The respawn frames identified in the dehacked thing editor are nothing to do with monster respawning and would be better named resurrection frames.

The reason the pain elemental's respawn frames should be unused is it doesn't leave a body. Apparently it is possible for a Pain Elemental to get squished by a door or something right on the point of death and leave a blood pool which can be resurrected into an almost invulnerable ghost (a bug that some ports fix/optionally fix).

There are plenty of other places to get frames too. Obviously if you don't want to use an archvile, than his frames become available, as do the the frames for his attack (but watch if you are using the spawned temporary fire thing in a Zdoom script) and of course every enemy with a respawn series of frames will no longer need them if you are not using the archie.

That obviously affects gameplay though. Another way to get a few frames with minimum disturbance to gameplay is to use the same frames for the teleport flash and the item respawn flash (maybe use the green teleport flash and colour shifting on the sprites to make the respawn look different). Other items like pickups and so on can have the number of frames they use reduced. They no longer animate, but still work, and you get a few frames.

If you're using Zdoom 2, you can use the DECORATE lump to define all the original doom decoration items (pillars, hanging bodies etc). In the decorate lump, give these items exactly the same mapedit number as they had in the original game, and then use dehacked to change the map edit numbers of these things to something that will not clash with the original numbers now in the DECORATE lump. That will free up around 50 or more frames with no impact on the game (I did it recently and got enough frames to create a complex enemy, a simple enemy and a very simple enemy to add to one of my Aspects levels).

Of course, if you just want to add decorations, and are using Zdoom 2, then you can use the DECORATE lump to define them and leave dehacked alone completely.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×