Page 1 of 1

How does randomnesss work in KaM Remake

PostPosted: 12 Sep 2013, 01:14
by Lewin
A few people have asked about this so I thought I'd make a topic about it.

We use a pseudo random number generator, which means it starts at a certain seed and then gives out a sequence of "random" numbers (the sequence is about 2 billion numbers long). The seed tells it where to start in the sequence, so with the same seed you'll get the same sequence.

Currently the random seed is always set to the same value at the start of the game, so under the same conditions you will always get exactly the same result. But a small change like adding an extra animal will cause the random numbers to be used differently (even though it's the same sequence) so you will get different results. In KaM there are a LOT of things using random numbers (animals use them every step, fighting/shooting uses them with every strike/shot, etc.) so even a simple change will make the results unpredictable.

In the next release we are going to change this so it starts randomised (which usually means you set it to something unpredictable like the current number of milliseconds on the clock), we originally didn't do this for debugging purposes (it's good to be able to reproduce the same events when debugging) but it's not so good for gameplay or balance testing.

Let me know if you have any questions :)

Re: How does randomnesss work in KaM Remake

PostPosted: 12 Sep 2013, 05:17
by Krom
I have a request: how about converting this into a new mini-article for our devblog? ;-)

Re: How does randomnesss work in KaM Remake

PostPosted: 12 Sep 2013, 06:35
by Skypper
thx, i would really appreciate a working random :)
when do you think we can use it ?

Re: How does randomnesss work in KaM Remake

PostPosted: 12 Sep 2013, 08:05
by dicsoupcan
this explains when i tested some SP missions and did not order any troops at the first fight the outcome was always the same :p thank you

Re: How does randomnesss work in KaM Remake

PostPosted: 12 Sep 2013, 09:21
by Skypper
i had the same probem with my random spawn script, but do you know when we can use it