Server Help

ASSS Questions - [Suggestion] Frequency options

Siaon - Mon Mar 15, 2004 5:31 pm
Post subject: [Suggestion] Frequency options
In addition to freqkick and giveowner some kind of invite command would be great, example:

:Player1:?invite
>> You've been invited to join freq x, type ?accept to join them(You need (Conditions like be in a safezone, have full energy, don't have the powerball or flags)
Player1-> ?accept

Player1 gets moved to freq x
Dr Brain - Mon Mar 15, 2004 5:47 pm
Post subject:
Forum you wanted was "Server Suggestions". You may not be able to read this before it gets moved and deleted, but its the thought that counts icon_wink.gif
Doggeti - Tue Mar 16, 2004 4:59 am
Post subject:
Isn't

Player1>:Player2:Join freq#!! biggrin.gif

Player2>=#

easier?
Mine GO BOOM - Tue Mar 16, 2004 4:23 pm
Post subject:
I believe his idea is that no one can join the freq unless they are invited first. So if your freq number is leaked, no one could join unless the owner invited them first.

Maybe practical, because it is still unknown how to handle the chat-clients from leaking freq numbers.
Anonymous - Thu Mar 18, 2004 4:09 am
Post subject:
The chat clients are supposed to be sent a hash of the private freq.
Grelminar - Thu Mar 18, 2004 5:52 pm
Post subject:
Well, that's not currently true. A while ago I tried thinking of ways the hash thing could work, and then gave up because they got too complicated. For now I think the freqowners module is enough to get around this problem, although the best solution is probably password-protected freqs. Which isn't even very hard, I just need some time to work on it.
Anonymous - Sun Mar 21, 2004 3:48 pm
Post subject: chatclient freq woes
as far as clients are concerned, the freqs have these properties:

1) visible number,
2) associates players from the same team in playerlist.

freqs 0-99 are "public", which implies that (1) and (2) hold.
freqs 100-9999 are "private", which implies that only (2) holds.

for players who aren't on frequency X:
for public freqs, (1) and (2) can be implemented by just sending the freq number.
for private freqs, (2) can be implemented by sending a unique "grouping number", in place of the actual freq number

grouping numbers are:
unique,
16 bits,
greater than 99,
there must be 10000-100 (9900) of them to map from 100...9999.

normal freq numbers are only 14 bits (two MSB are 0).

these grouping numbers may be sent and received in place of freq numbers for players who are not on the team in question. this does not apply only to chat clients, but to Continuum and SubSpace as well. the distinction is that any messages from the game clients need to be "unmapped" from group numbers to the actual frequencies before they may be interpreted by the server.

implementation-wise, this rules out a 19,800-byte lookup-table generated when the server starts or when an arena is made. two such tables may be used, to map both ways. my recommendation, therefore, is to find a mapping function that can do this conversion in real-time.
Anonymous - Sun Mar 21, 2004 7:18 pm
Post subject:
here's something that might work for you:

Code: Show/Hide

#define MAPPING_ROUNDS 32

u16 map_freq_to_group(u16 n, u32 k)
{
   for (u16 i = 0; i < MAPPING_ROUNDS; ++i)
   {
      /* mixed congruential method (Knuth, AoCP, 3.2.1) */
      k = (65537 * 11 * k + 2099863) % 0xffffffff;

      n += k;
      n = (n << (k&15)) | (n >> (16 - (k&15)));
   }

   return n;
}

u16 _map_group_to_freq(u16 n, u32 k, u16 i)
{
   k = (65537 * 11 * k + 2099863) % 0xffffffff;

   if (i) n = _map_group_to_freq(n, k, i-1);
   n = (n >> (k&15)) | (n << (16 - (k&15)));
   n -= k;

   return n;
}

u16 map_group_to_freq(u16 n, u32 k)
{
   return _map_group_to_freq(n, k, MAPPING_ROUNDS-1);
}


k = key, n = freq/group number. key would be stored in the per-arena data, or you could pre-generate the key for each round and store it in per-arena data.
catid - Sun Mar 21, 2004 7:49 pm
Post subject:
oops. that code could generate numbers between 0-99. to fix this problem, i changed the calculations so that they'd be done in 15 bits, and set MSB to 1 for group numbers and 0 for freqs.

Code: Show/Hide

#define MAPPING_ROUNDS 32

u16 map_freq_to_group(u16 n, u32 k)
{
   for (u16 i = 0; i < MAPPING_ROUNDS; ++i)
   {
      /* mixed congruential method (Knuth, AoCP, 3.2.1) */
      k = (65537 * 11 * k + 2099863) % 0xffffffff;

      n += k;
      n = (n << (k%15)) | ((n&0x7fff) >> (15 - (k%15)));
   }

   return n | 0x8000; /* make it outside of range */
}

u16 _map_group_to_freq(u16 n, u32 k, u16 i)
{
   k = (65537 * 11 * k + 2099863) % 0xffffffff;

   if (i) n = _map_group_to_freq(n, k, i-1);
   n = ((n&0x7fff) >> (k%15)) | (n << (15 - (k%15)));
   n -= k;

   return n;
}

u16 map_group_to_freq(u16 n, u32 k)
{
   return _map_group_to_freq(n, k, MAPPING_ROUNDS-1) & 0x7fff;
}

All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group