ID:1810807
 
(See the best response by Ter13.)
Problem description:
Hi-
I was wondering if anyone could help me out with a problem I'm facing. I've added many weather effects into my project, it all seems to work well, except I was hoping for a bit more of simulated realism when it comes to affecting turfs and objects with weather like snow.

Other than looping through every single turf in game (and effectively crashing the server in the process) what are some creative ideas for simulating weather changes?

Ideally I'd like at-least the ground, and maybe some structures to be covered in snow while it's snowing or during the winter months.

This is currently the look, but as you can see it's a bit odd.



My ideas so far are:
As the player walks around to stimulate the tiles to slowly produce an overlay of snow. Even then that would require overhead I'm not entirely sure I want.

The second idea is a "scrubber", (what I call it anyway)- an object that moves from map to map and stimulates the tiles to show a snowy overlay. This would of course take time.

The third idea is changing blocks at a time via code, but I don't really have an idea how to do that. I'm open to other suggestions though.
Best response
Break the world up into cells via a quadtree-like structure.

Every time a player moves, you need to check the bounding-box of their viewport plus the size of the extra buffer distance against the cells at the edge of this boundary. Loop through each cell on the edge of the boundary. Add the player to that cell's observer list. If the player has gone out of range of a cell that they are currently keeping loaded, remove the player from that cell's observer list.

That way, you will only have to update every visible cell instantly, and you can avoid updating the rest of the map over time.

My advice would be to make your cells no bigger than 32x32 in size. That's 1024 turfs per cell.



Then again, I'd also probably advise you to not even bother. Dynamic weather is one of those pipe dreams that's just a really bad idea. It doesn't really add much to gameplay, requires a lot of programming skill to do it efficiently, and increases the burden on your graphic art pipeline for almost no gain.
Haha what ter said. I was going to do one... Or actually I did do one for previous game. But their are multiple problems with efficiency and players can live without. Though I do think the weather looks nice in your images.

But if your really determined I'm sure you'll find a way. The question you'll have to ask yourself is this worth the player loss in your server in order to have it.
Does your map have open buildings or are they closed? In other words, do you step on their door and that teleports you into the room (like pokemon) or do you just walk directly into buildings?

If you step on the door of a building to enter it then what you can do to simulate weather is very simple. When a user exits a building then add a giant overlay onto their screen that covers it all with rain or snow or whatever you want. Then when they enter a building remove the overlay.

Obviously you might not be able to do this depending on how your buildings work but if you can do this it's extremely effecient in comparison with it's counterparts.
@Zec, double check the OP. It looks like he's already got the screen cookie approach down. Which yeah, you can get some pretty nice weather effects just by adding an animated sprite to the screen. One trick with the buildings you can step into would be to set it up so that interior structures actually show up above the weather layer, and also increase the layer of any objects inside of them, but that's a bit wonky.

What he's asking for is an approach that would give him on-the-ground accumulation of snow over time.
In response to Ter13
Yeah my bad. I think you're right with not doing it until other more important things are done... Or using sectors of some kind.
Hmm I think you guys are most likely right on track. Winter is really the only time of the year I could use this(probably also fall with leaves) , since the game logs days in minutes (anywhere from 5mins to 2 hrs over the course of a day) I don't think it would be a huge deal if there just wasn't snow on the ground for duration of winter(potentially 2 1/2 days of uptime). Someone mentioned it to me for "realism" but - meh, I may just give it up.

To answer a question up above, I do have interiors, the weather snaps off when you enter a house or something of that nature.

Some good suggestions, I like the area to apply weather, although that only narrows down the # of turfs I need to apply to. (In general i was thinking all turfs.)

I'm not really "having trouble" with this persay, I just have a different focus for this game other than realism.

I thought of all the concepts you listed - snow on buildings, footsteps in the sand, snow and even implemented it in another game as well (the footsteps) it's cool but at the end of the day it just adds to atmosphere of the game and doesn't benefit gameplay very much.

For this project that's my main focus, trying to make the game as fun to play as possible for many people while still holding onto my vision for the game.

Aside from that I have alot of systems in place that already give the game a unique atmosphere that you wouldn't see in most other games. At the end of the day it was one of those game dev. decisions. I think we'd all like to have feature X or the perfect game, but realistically it's not always feasible for project X. Those are the thoughts running through my head when I decided not to worry about it too much.