XNA - Simulated Snow

It is rather a question of how to request some advice, which templates / approaches I should use. I have done some research on this issue - with poor results.

Essentially, I have an idea for a game in which the key gameplay mechanic is based on falling snow - or, in the case of this idea of โ€‹โ€‹the game, falling particles.

Snow / particles should fall across the screen - but accumulate in piles. The problem is that I need the snow to "drain" on the sides of the piles when they are at a certain angle, and continue to accumulate. Perhaps the holes are open under piles of snow, and the snow should fall - think about how the sand falls through the hourglass.

I tried this Box2d - it is clear that Box2d is not the right choice for 10,000 small particles that persist over long periods of time. Box 2D bit off pretty quickly.

I tried drawing 1px bitmaps on the screen, but handling 10,000 collisions with each update also turned out to be bad.

Any ideas would be appreciated.

Greetings

+8
c # xna game-physics
source share
3 answers

Well, as you discovered, no existing library will help you unless it is specifically targeted to your scenario. Unfortunately, there are not many choices with XNA, and it seems that not one of the existing particle system libraries supports particle physics.

Thus, you will need to do a great job yourself. First of all, you need to think about all the possibilities you can do. As the comment says, you should not run checks between all particles in each frame. You should use spot collision checking instead of the usual things commonly used by physical engines. You have to make sure that the particles always have the same size (in this case (relative to the coordinate system, which does not mean you cannot enlarge). And, of course, you need to skip as many collision checks as possible - particles that like you you know, they are at rest, they should never be checked, like those that have adjacent particles on all sides, which makes me think about grids. Perhaps you could imagine the whole "world" as a grid and simplify the logic from this point of view - almost just like Minecraft, don't you agree?

In any case, I understand that I'm a little confused, but this is such an open subject ... :)

+1
source share

Take a lot in this Cool Effects (for XNA and MonoGame) http://www.int6.org/development/cool-effects-for-xna-monogame/

There is no snow effect, but there is some interest effect that you can use for modification.

+1
source share

Is it possible to control which particles are actually processed by the physical engine? If so, is there a way in which you can stop processing your physics or strictly limit what you are processing if their speed is less than 0.01 or something like that?

If you process only particles that need processing, then you can have as many as you want, considering that they do not all move at once!

If this is still a problem, it seems that a solution for fluid dynamics may be more appropriate, since fluid dynamics are basically a mass of small moving particles.

Here is some interesting information about the two-dimensional fluid dynamics:

http://www.ibiblio.org/e-notes/webgl/gpu/fluid.htm

Your physics engine may already contain what you need.

+1
source share

All Articles