VgaGames 3 - Network man-pages

[.. upper level ..]

VG3_nw_random_getnext()

[added in version 1.2]

Return random integer number suitable for network games and individual code-blocks.
SYNTAX
unsigned int VG3_nw_random_getnext(unsigned int value_from, unsigned int value_to, unsigned int *seed)

FUNCTION PARAMETERS
value_from Lowest number to return
value_to Highest number to return
seed Address for seed-number, will be updated

RETURN VALUE
Returns random integer number between including value_from and value_to.

DESCRIPTION
As for network games only key-strokes are sent and received, all computing has to be done by each client for all objects. To keep them in sync, random numbers must not be really random, but replicable by each client. This function returns such replicable numbers and must be used since at least after calling VG3_nw_connect(). It may be used also in non-networking games. As the seed-number is always passed, this function can be used for individual code-blocks, e.g. objects, independed of others to prevent possible inconsistencies. An initial seed-number must be retrieved via VG3_nw_random_initseed().

SEE ALSO
VG3_nw_random_initseed() VG3_nw_get_random() VG3_ofunc_reset_seeds()