MantisBT - Zandronum
View Issue Details
0000366Zandronum[All Projects] Suggestionpublic2011-04-04 03:052013-06-30 20:48
kgsws 
 
normalfeatureN/A
closedfixed 
 
1.0 
0000366: new CLIENTSIDE ACS type
Similar to CLIENTSIDE, but it will trigger only on activator side, other players are not notified about activation of this script.
I don't know how should it be called. ("ONECLIENT", "CLIENTSIDEACTIVATOR", "ACTIVATORSIDE", "CLIENTACTIVATOR")

There is way to run script like this, but it is hacky and ... well, it does not look good.
Well, check example down here.
There are 3 scripts to do this now.
Script 100 will log text into activator's (only) console.
#include "zcommon.acs"

int ConsolePlayer;

script 1 ENTER
{
    ACS_ExecuteAlways(2, 0, 0, 0, 0);
}

script 2 (void) CLIENTSIDE
{
    ConsoleCommand("puke 3");
}

script 3 (void) CLIENTSIDE NET
{
    ConsolePlayer = PlayerNumber();
}

script 100 (void) CLIENTSIDE
{
    if(ConsolePlayer != PlayerNumber()) terminate;
    log(s:"log visible only on activator side");
    // there could be any effect only for one client
}
No tags attached.
child of 0000927closed Dusk ZDaemon ACSF Functions 
Issue History
2011-04-04 03:05kgswsNew Issue
2011-04-04 12:05Torr SamahoNote Added: 0001286
2011-04-04 12:15kgswsNote Added: 0001287
2011-09-14 12:20kgswsNote Edited: 0001287bug_revision_view_page.php?bugnote_id=1287#r1120
2012-04-23 19:06MediumTankNote Added: 0003407
2012-04-24 00:39Torr SamahoNote Added: 0003409
2012-04-24 00:40Torr SamahoNote Edited: 0003409bug_revision_view_page.php?bugnote_id=3409#r1824
2012-04-24 00:40Torr SamahoNote Revision Dropped: 3409: 0001823
2012-04-26 15:38MediumTankNote Added: 0003445
2012-04-26 15:58MediumTankNote Added: 0003446
2012-04-26 16:04MediumTankNote Edited: 0003446bug_revision_view_page.php?bugnote_id=3446#r1864
2013-06-30 20:46DuskRelationship addedchild of 0000927
2013-06-30 20:47DuskNote Added: 0006534
2013-06-30 20:47DuskStatusnew => closed
2013-06-30 20:47DuskAssigned To => Dusk
2013-06-30 20:47DuskResolutionopen => fixed
2013-06-30 20:47DuskAssigned ToDusk =>
2013-06-30 20:47DuskStatusclosed => feedback
2013-06-30 20:47DuskResolutionfixed => reopened
2013-06-30 20:48DuskNote Edited: 0006534bug_revision_view_page.php?bugnote_id=6534#r3605
2013-06-30 20:48DuskStatusfeedback => closed
2013-06-30 20:48DuskResolutionreopened => fixed
2013-06-30 20:48DuskFixed in Version => 1.0

Notes
(0001286)
Torr Samaho   
2011-04-04 12:05   
I think that you don't need a new script type for this, a ACS function GetConsolePlayerNum would do, wouldn't it?
(0001287)
kgsws   
2011-04-04 12:15   
(edited on: 2011-09-14 12:20)
sure, anything is better than that hacky example
EDIT: but new ACS type will cause less traffic, if only one client should know about script activation, why we need to notify everyone?

(0003407)
MediumTank   
2012-04-23 19:06   
How much data in bytes is sent when a script like this is run to all clients?

script 2 (void) CLIENTSIDE
{
    // Send command to everyone
}


x bytes/player * n players = bandwidth, I'm wondering how many bytes it sends to each client. Is there a way to find out?
(0003409)
Torr Samaho   
2012-04-24 00:39   
(edited on: 2012-04-24 00:40)
You can see this in the implementation of SERVERCOMMANDS_ACSScriptExecute: It will need 21 bytes + length of the map string per client to let the server tell the clients to start one CLIENTSIDE scripts. Note that a CLIENTSIDE script started by another CLIENTSIDE script doesn't need any bandwidth at all.

(0003445)
MediumTank   
2012-04-26 15:38   
Is there any way to make it so that we can have a CLIENTSIDE specific script with this method?

1. Create a new CompatFlag
Compat_ClientsidePlayerSpecific true/false [value=32]

If true, will only send data from the server to the player number indicated by the first argument

2. Script example
Script 123 (int playerNumberToSendTo, int arg2, int arg3) CLIENTSIDE
{
}



I ask because I'm creating a cutting edge mod that uses a lot of CLIENTSIDE scripts, and there's a point where clients could potentially send (32 players / 2) * 27 bytes per request * 32 players * 35 tics = 472.5 kb/s.

While very unlikely, it is possible if all players do one command at once to flood the server, and I've optimized the game to the point where it does 99% of everything CLIENTSIDE except updating the server when need be. If we divide that by 32 (since it'll be sending it to one player), that drops us down to sending at most 14.76 kb/s. If the 64 players are introduced, the absolute maximum that would be sent is 59.04 kb/s from a very cutting edge doom game.




I figure if the Compat flag is added, it would help scripters save bandwidth on the servers by up to 32 times, or even up to 64 if the MAXPLAYERS is committed. People who know what they are doing with the flag would just use

for (int i = 0; i < MAXPLAYERS; i++)
    ACS_ExecuteAlways(123, i, arg2, arg3);

And it'd have the same functionality as current clientside scripts.


~~~~~~~~~~~~~~~~~~~~~~~~~

Currently Jump Maze and my project have to do the following since we want only a specific client to respond

1. When a player joins the game, set a new CVAR to their playerNumber for that game

2. Do a clientside script, make the first argument the playerNumber so you only target the player you want

Ex:
script 999 (int playerNum, int data1, int data2)
{
    if (GetCvar("YourPlayerNumber") != playerNum)
        terminate;
    // Rest of code here
}


So far that is actually what we have to do, which means in this case were using 32x more bandwidth than we'd want to.
Jump maze though doesn't need to send this command as frequently as I do (sadly for me at this point)
(0003446)
MediumTank   
2012-04-26 15:58   
(edited on: 2012-04-26 16:04)
I just thought of this:

1)
When the server does a CLIENTSIDE script, does it send the data only to the specific player?

If it executes a script, thats 27 bytes, times 32 players = 864 bytes of data server side for one puke

Though, are the clients themselves only receiving 27 packets? Or are the clients receiving the full 864 bytes?


2)
How much bandwidth on the player side, and the server side, does the client doing 'puke -123 0 0 0' cost?
I haven't been able to find out how to to enable the client to print to me how much data is going in and out

(0006534)
Dusk   
2013-06-30 20:47   
(edited on: 2013-06-30 20:48)
Fixed in 0000927; ConsolePlayerNumber is now a thing.