Outgrowing rand()

Started by
12 comments, last by Dark_Oppressor 14 years ago
What I've done for now is use the Mersenne twister, but I should have specified that I'm not using Boost. I decided to go the fun learning route :-P

Anyway, it's working well enough for me now, I'm pretty happy with it. My particles are acting much more randomly than they did before.

Now, I'm off to build mountains of stone particles and then blow them up :-D
Advertisement
here's the thing - you may be overengineering this. If the particles dont affect gameplay then there is no need to have identically appearing particle systems on all player machines. rand() is probably all you need.

Don't thank me, thank the moon's gravitation pull! Post in My Journal and help me to not procrastinate!
Quote:Original post by speciesUnknown
here's the thing - you may be overengineering this. If the particles dont affect gameplay then there is no need to have identically appearing particle systems on all player machines. rand() is probably all you need.


Yes, except that:

Quote:Original post by Dark_Oppressor
I'm making a networked game in c++ that has a lot of particles (not just for looks, they are a gameplay thing). [...]
Quote:Original post by summaky
Quote:Original post by speciesUnknown
here's the thing - you may be overengineering this. If the particles dont affect gameplay then there is no need to have identically appearing particle systems on all player machines. rand() is probably all you need.


Yes, except that:

Quote:Original post by Dark_Oppressor
I'm making a networked game in c++ that has a lot of particles (not just for looks, they are a gameplay thing). [...]


Haha, what he said. The whole thing is mostly particles, that's the game! :-P And it's multiplayer, and since there can be 500,000ish particles in the game at once, I am using a lock-step system, meaning that I need determinism for the particles.

Trust me, this little PRNG thing took like 30 minutes, it is the least of my worries. Now, learning all about networking, multiplayer programming, and the MILLION difficult things when using a lock-step system, that is a pain! Ok... and it's also a little fun. Heh.

And even if I didn't need determinism and such, I would still want this better PRNG. My particles look more natural now, and water flows much more naturally, instead of dancing around or trying to prefer one side or the other.

This topic is closed to new replies.

Advertisement