Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Using clientr, client, serverr, server vars wisely. (https://forums.graalonline.com/forums/showthread.php?t=66767)

jake13jake 06-20-2006 01:58 AM

Using clientr, client, serverr, server vars wisely.
 
All of these vars need to be sent to the player on update serverside. This can create lag. Also, client and server vars being updated constantly clientside can create a lot of output to the server.

Alt+4 shows input/output bytes for the player.

A few of the old reused damage functions on Classic have been updating constantly clientside, and there were a lot of variables being sent to the player from the serverside of the damage system. Variables that the player didn't need to have immediate access to. If the player doesn't need immediate access to a variable clientside, just set the variable as a player.var serverside. The variable will save in the flags when you set a player.var as a non-prefixed var.

Hope people take some wisdom from this.

Still need to work it out of the drunk movement system, but need to approach how.

ApothiX 06-20-2006 03:51 AM

Non-prefixed variables in the flags are not able to be read clientside, are they?

jake13jake 06-20-2006 03:57 AM

Quote:

Originally Posted by ApothiX
Non-prefixed variables in the flags are not able to be read clientside, are they?

No, but clients can still access them with triggeractions. If you don't need immediate access to a flag, it's usually better to use non-prefixed flags (though not really necessary). You'd definitely want to do this in the case that you're setting a lot of variable at once so you don't overload the player with data with things that you don't really need to.

ApothiX 06-20-2006 04:13 AM

Quote:

Originally Posted by jake13jake
No, but clients can still access them with triggeractions. If you don't need immediate access to a flag, it's usually better to use non-prefixed flags (though not really necessary). You'd definitely want to do this in the case that you're setting a lot of variable at once so you don't overload the player with data with things that you don't really need to.

Ah, triggeractions for the win.

jake13jake 06-20-2006 04:39 AM

Also, if you need data to be visible from one player's clientside to the rest, attr vars are the only way to do that. However, you can minimize the number of attr vars you have to modify by using bitflags (unless you need to send a string)

...Yea, now my damage system is doing a lot better.

Python523 06-20-2006 12:01 PM

Quote:

Originally Posted by jake13jake
No, but clients can still access them with triggeractions. If you don't need immediate access to a flag, it's usually better to use non-prefixed flags (though not really necessary). You'd definitely want to do this in the case that you're setting a lot of variable at once so you don't overload the player with data with things that you don't really need to.

That and for storing variables that will only be read/wrote to only serverside ;o

ApothiX 06-20-2006 04:18 PM

Quote:

Originally Posted by jake13jake
Also, if you need data to be visible from one player's clientside to the rest, attr vars are the only way to do that.

If you want to access the data all the time, yes. But if you only need it during certain situations (ie: a custom profile) then using a triggeraction is far better than updating player.attr[] flags.

Python523 06-20-2006 11:44 PM

Quote:

Originally Posted by jake13jake
All of these vars need to be sent to the player on update serverside. This can create lag. Also, client and server vars being updated constantly clientside can create a lot of output to the server.

Not sure if you were just being careless, but there are some things wrong with that.

You implied that server. varsare sent to the client, which is just wrong; they are only seen serverside. serverr. strings are sent to the clients, but as read-only. Your post also implied that server vars can be written to clientside, which is just plain wrong.

jake13jake 06-21-2006 12:46 AM

Quote:

Originally Posted by Python523
You implied that server. varsare sent to the client, which is just wrong; they are only seen serverside. serverr. strings are sent to the clients, but as read-only. Your post also implied that server vars can be written to clientside, which is just plain wrong.

Yea, I am careless because I never use server or serverr.vars. I always use DB NPCs for that kind of stuff because it's just a lot more organized.

ZeLpH_MyStiK 06-21-2006 03:44 AM

Quote:

Originally Posted by jake13jake
Yea, I am careless because I never use server or serverr.vars. I always use DB NPCs for that kind of stuff because it's just a lot more organized.

I am pretty sure serverr. variables are sent to the client when the player logs on and when the variables are updated. Server. variables are just read/written to serverside.

xXziroXx 06-21-2006 04:03 PM

Quote:

Originally Posted by ZeLpH_MyStiK
I am pretty sure serverr. variables are sent to the client when the player logs on and when the variables are updated. Server. variables are just read/written to serverside.

Im pretty sure about that one too.

Warcaptain 06-23-2006 06:47 AM

Hey give me some credit here for helping you figure all this out ;)

jake13jake 06-23-2006 08:32 PM

Quote:

Originally Posted by Warcaptain
Hey give me some credit here for helping you figure all this out ;)

You told me what Alt+4 meant, thank you.

You can also use client.vars to reduce lag instead of having to use triggeractions.

ApothiX 06-24-2006 07:39 AM

Quote:

Originally Posted by jake13jake
You can also use client.vars to reduce lag instead of having to use triggeractions.

If you don't want it to be secure, yeah.

jake13jake 06-24-2006 04:39 PM

Quote:

Originally Posted by ApothiX
If you don't want it to be secure, yeah.

Well, as for attr vars, if they are changing constantly, then you'd want to use them. Also, being secure doesn't always matter enough to not be using client.vars.

calani 06-24-2006 05:33 PM

Script security is rather important.
I'd hold that as a higher priority than a bit less lag.

jake13jake 06-24-2006 07:06 PM

Quote:

Originally Posted by calani
Script security is rather important.
I'd hold that as a higher priority than a bit less lag.

So you're saying your the type of person that would script movement serverside?

calani 06-26-2006 04:59 AM

I'd make movement clientside with checks done serverside every few ticks.
If I was making a physics engine that kept track of several thousand items and was very important to the server, i'd have all the players do it locally, then do a spot-check every few seconds to make sure everyone's list is accurate.
The server would check each player's list against every other and take the most common one, then send that to everyone as an update. Thus, everyone has the same list every few seconds and the server wouldn't have to do any work actually calculating any of the physics. Also, a majority of the server would have to be hacking in order for it to affect the rest of the server.

jake13jake 06-26-2006 11:11 PM

Quote:

Originally Posted by calani
I'd make movement clientside with checks done serverside every few ticks.
If I was making a physics engine that kept track of several thousand items and was very important to the server, i'd have all the players do it locally, then do a spot-check every few seconds to make sure everyone's list is accurate.
The server would check each player's list against every other and take the most common one, then send that to everyone as an update. Thus, everyone has the same list every few seconds and the server wouldn't have to do any work actually calculating any of the physics. Also, a majority of the server would have to be hacking in order for it to affect the rest of the server.

Well, the client has to send data to the server if the stuff is being done clientside. I'd think of Classic's movement as more secure than other systems just because it's a lot more unique than any other systems.

ApothiX 06-27-2006 07:00 AM

Quote:

Originally Posted by jake13jake
Well, the client has to send data to the server if the stuff is being done clientside. I'd think of Classic's movement as more secure than other systems just because it's a lot more unique than any other systems.

Being unique is not always a good thing.

jake13jake 06-28-2006 12:03 AM

Quote:

Originally Posted by ApothiX
Being unique is not always a good thing.

Yea, I know :P. But the movement system works and it works well.


All times are GMT +2. The time now is 12:11 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.