Le Saturday 09 February 2008 13:13:00 Kurosu, vous avez écrit :
> Hi,
>
> in RandomSync::Init(), a first seed is set, then if the computer is a
> server, another one is generated and sent to the clients.
>
> Network works, so there's probably more to it than just this. Could some
> senior (or knowledgeable) wormux developper explain me why (and possibly
> add a comment in the code to make sense of this)?

As far as I know, gentildemon as work on this part but he tells me that we 
don't need to store an array of random values synced up with the server. You 
just need a initial seed, next value are provided using a very simple 
function (in network/randomsync.cpp) :

...
/* RAND_MAX assumed to be 32767 */
static inline uint wormux_rand(void)
{
  next = next * 1103515245 + 12345;
  return((uint)(next/65536) % 32768);
}
...

So, you just need to send the initial seed, next value are available using 
this function.

To keep everybody sync, you send the original seed and you don't have to send 
a complete array.

>
> Best regards,

Yannig

_______________________________________________
Wormux-dev mailing list
Wormux-dev@gna.org
https://mail.gna.org/listinfo/wormux-dev

Répondre à