Questions about clientside and serverside

Discuss all aspects related to modding Zandronum here.
Post Reply
RaveYard
 
Posts: 52
Joined: Wed Jun 27, 2012 1:44 pm

Questions about clientside and serverside

#1

Post by RaveYard » Fri May 10, 2013 5:32 pm

I am currently wondering what does the
+CLIENTSIDEONLY
and
+SERVERSIDEONLY

and clientside script?

I thought the clientside meant that each client is deciding what is the actor "doing". But since I tried to make clientside monster which appeared on the same place on both clients, I was proven wroong.

Serverside makes stuff not visible when you run a server.. So that means that they exists only in the server.. not being send for the clients?..

Clientside script is running from the client so you can get client's Cvars instead of the server ones?


I am just being confused :sad: and the Zdoom wiki is not helpfull alot..
My Projects:
[Horror] Ghosted 2 - version 2 - v2.1.0 : Here!

User avatar
ibm5155
Addicted to Zandronum
Posts: 1641
Joined: Tue Jun 05, 2012 9:32 pm
Location: Somewhere, over the rainbow

RE: Questions about clientside and serverside

#2

Post by ibm5155 » Fri May 10, 2013 5:49 pm

clientside is a script that is like an offline script, you run the script but you don´t send the server and others ´ll not know that you´re running it (ex:murder selector on who dun it is a clientside, only the murder´ll see the murder mensage)

Server side would be something like a script that only the server run and no players run.

You had te monster working on clientside because everyone got the same thing, and if the server process the monster ai, it´ll work normaly, unless you do only one person to run the spawn script (this guy ´ll see the monster, but it´ll not get dammage or active, it would be ex: like a ghost...
Last edited by ibm5155 on Fri May 10, 2013 6:07 pm, edited 1 time in total.
Projects
Cursed Maze: DONE, V2.0
Zombie Horde - ZM09 map update: [3/15/13]
Need help with English? Then you've come to the right place!

<this post is proof of "Decline">

Zupoman
Forum Regular
Posts: 110
Joined: Tue Jun 26, 2012 6:30 pm

RE: Questions about clientside and serverside

#3

Post by Zupoman » Fri May 10, 2013 7:27 pm

ibm5155 wrote: clientside is a script that is like an offline script, you run the script but you don´t send the server and others ´ll not know that you´re running it (ex:murder selector on who dun it is a clientside, only the murder´ll see the murder mensage)

Server side would be something like a script that only the server run and no players run.

You had te monster working on clientside because everyone got the same thing, and if the server process the monster ai, it´ll work normaly, unless you do only one person to run the spawn script (this guy ´ll see the monster, but it´ll not get dammage or active, it would be ex: like a ghost...
You are wrong.




If an actor is clientside, then it will exist only for client, the server won't care about it. Usually you do not need to mess with that, however: If your wad spawns many actors that are purely decoration, you may want server to not care about them, to prevent lag.

If your actor affects the game, then it MUST be serverside. But if your actor is purely decorational, you can make it clientside, for optimization purposes. Just note that if there is not many of those actors, that's not necessary.

NEVER make a thing that affects the game clientside. NEVER!
Last edited by Zupoman on Fri May 10, 2013 7:28 pm, edited 1 time in total.
This signature is empty and useless, I would write another useless idiotism here but people will call me a noob for that, so sorry, no more signatures for you. Go somewhere else.

RaveYard
 
Posts: 52
Joined: Wed Jun 27, 2012 1:44 pm

RE: Questions about clientside and serverside

#4

Post by RaveYard » Fri May 10, 2013 7:56 pm

That clears it up. But why can't I create clientside thing that sees monsters and reacts to them?

I have also tried to make clientside script about closing a door.
But both clients had the door shut even tho one pressed the button activating the script.
My Projects:
[Horror] Ghosted 2 - version 2 - v2.1.0 : Here!

Ijon Tichy
Frequent Poster Miles card holder
Posts: 901
Joined: Mon Jun 04, 2012 5:07 am

RE: Questions about clientside and serverside

#5

Post by Ijon Tichy » Fri May 10, 2013 9:39 pm

RaveYard wrote: That clears it up. But why can't I create clientside thing that sees monsters and reacts to them?
No one said you can't. But if it does anything to change the game at all, it's a Bad Thing and should be avoided.
I have also tried to make clientside script about closing a door.
WHYYYYYYYYYYYYYYYYY
That's just going to horribly desync the clients and server!
But both clients had the door shut even tho one pressed the button activating the script.
It still runs on both clients. You have to do a check against ConsolePlayerNumber to have it run on only one client.

Qent
Retired Staff / Community Team Member
Posts: 1424
Joined: Tue May 29, 2012 7:56 pm
Contact:

RE: Questions about clientside and serverside

#6

Post by Qent » Fri May 10, 2013 11:00 pm

Ijon Tichy wrote: WHYYYYYYYYYYYYYYYYY
It sounds to me like he's just trying to see how it works.

RaveYard
 
Posts: 52
Joined: Wed Jun 27, 2012 1:44 pm

RE: Questions about clientside and serverside

#7

Post by RaveYard » Sat May 11, 2013 12:59 pm

Qent wrote:
Ijon Tichy wrote: WHYYYYYYYYYYYYYYYYY
It sounds to me like he's just trying to see how it works.
Right, I was just trying that.

But I don't get the ConsolePlayerNumber
what does it do?

Anyway:
I have created a clientside light that flickers when it sees monster. But it only works in singleplayer.. And in multiplayer only if I use summon or summonfriend command :cry: ,not when it is placed in MapEditor..

Spoiler: very messy Decorate code if needed.. be warned (Open)

Code: Select all

actor CLight 32050
{
	+SHOOTABLE
	+NOGRAVITY
	+LOOKALLAROUND
	+NOTARGET
	+NOTIMEFREEZE
	+FRIENDLY
	
	+CLIENTSIDEONLY
		
	height 2
	radius 2
	mass 999999999999999999 //Dont be pushed by explosions
	painchance 255
	health 99999999
	states
	{
		InActive:
		PUFF A 1 bright Thing_ChangeTID(0,3500)
		PUFF A 0 bright// A_SpawnItem("Light",0,-64)
		loop
		Spawn:
		PUFF A 0 bright
		PUFF A 0 bright
		PUFF A 0 bright //ACS_ExecuteAlways(356,0,0)
		Spawn2:
		PUFF A 0 bright
		PUFF A 0 bright
		PUFF A 0 bright A_JumpIf(ACS_ExecuteWithResult(350,0,0) > 0,"TryBreak")
		SpawnSafe:
		PUFF AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 bright  A_Look
		//TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_Jump(20,"Spawn") //Disorts!
		//TNT1 A 0 A_Jump(1,"Die")
		goto Spawn2
		TryBreak:
		PUFF A 0 bright
		PUFF A 0 bright A_Jump(32,"Break2")
		goto SpawnSafe
		Break2:
		PUFF A 0 bright
		PUFF A 0 bright ACS_ExecuteAlways(351,0,0)
		Break:
		PUFF A 0 bright
		PUFF IJKLMNOPQRS 1 
		PUFF B -1
		stop
		See:
		PUFF A 0
		PUFF A 0 A_JumpIfInTargetInventory("FlashLight",1,"Clear")
		PUFF A 0 A_JumpIfInTargetInventory("StealthBlink",1,"BlinkStealth")
		PUFF A 0 A_JumpIfInTargetInventory("LightHater",1,"PowerOff")
		PUFF A 0 A_JumpIfInTargetInventory("EvilLurker",1,"EvilRed")
		PUFF A 0 A_JumpIfTargetInLOS("Do")
		PUFF A 5 bright
		goto Clear
		Do:
		PUFF AAAA 1 bright A_JumpIfCloser(600,"Blink")
		goto See
		Blink:
		PUFF BBBABBAB 1 A_JumpIfInTargetInventory("LightHater",1,"PowerOff")
		PUFF A 0 A_Jump(ACS_ExecuteWithResult(601,0,0) / 4,"Die")
		PUFF BABBBBBB 1 A_JumpIfInTargetInventory("LightHater",1,"PowerOff")
		PUFF BBBBBBBB 1 A_JumpIfInTargetInventory("LightHater",1,"PowerOff")
		PUFF A 0 A_Jump(ACS_ExecuteWithResult(601,0,0) / 4,"Die")
		PUFF BABBBBBA 1 A_JumpIfInTargetInventory("LightHater",1,"PowerOff")
		PUFF ABBBBBBB 1 A_JumpIfInTargetInventory("LightHater",1,"PowerOff")
		PUFF A 0 A_Jump(ACS_ExecuteWithResult(601,0,0) / 4,"Die")
		PUFF AABBBBBB 1 A_JumpIfInTargetInventory("LightHater",1,"PowerOff")
		PUFF BBBBBABA 1 A_JumpIfInTargetInventory("LightHater",1,"PowerOff")
		PUFF A 0 A_Jump(ACS_ExecuteWithResult(601,0,0) / 4,"Die")
		PUFF BABBBBBB 1 A_JumpIfInTargetInventory("LightHater",1,"PowerOff")
		goto Clear
		
		BlinkStealth:
		PUFF AAAAAAAAAAA 1 bright 
		PUFF D 1
		
		goto Clear
		PowerOff:
		PUFF A 0
		PUFF A 0 A_PlaySound("Lights/Off")
		
		PowerOffLoop:
		PUFF BBBB 350 
		PUFF B 0 A_JumpIfTargetInLos("PowerOffLoop")
		PUFF A 3 A_PlaySound("Lights/Flick")
		PUFF ABBBBABBBABBABABABABBBBABBBABBABABAB 1 
		goto See
		EvilRed:
		PUFF CCCCCCBBCCCCBCCBCCBBBBBBCCCCCCCCCC 1 //A_Jump(1,"Die")
		goto See
		Breaking:
		PUFF AAAAAA 1 A_Jump(32 - (ACS_ExecuteWithResult(601,0,0)),"Clear")
		PUFF AAAAAA 1 A_Jump(ACS_ExecuteWithResult(601,0,0) / 5,"Die")
		goto Clear
		Clear:
		PUFF A 0
		PUFF A 0 A_ClearTarget
		goto Spawn2
		Pain:
		PUFF C 140 A_Jump(1,"Die")
		goto See
		Die:
		PUFF B 0
		PUFF B 0 //A_Die
		Death:
		PUFF B 1 A_PlaySound("Lights/Break")
		
		DeathSilent:
		PUFF BABABABBAABBBBBBBBBBBBBBBBBBBBBBBBB 1 
		PUFF B 0 //Thing_ChangeTID(0,3500)
		PUFF B -1
		loop
	}
}
Does the fact that they don't blink have to do something about being clientside?
My Projects:
[Horror] Ghosted 2 - version 2 - v2.1.0 : Here!

Qent
Retired Staff / Community Team Member
Posts: 1424
Joined: Tue May 29, 2012 7:56 pm
Contact:

RE: Questions about clientside and serverside

#8

Post by Qent » Sat May 11, 2013 3:16 pm

ConsolePlayerNumber returns the PlayerNumber of the client who is executing it. Non-CLIENTSIDE scripts are executed on the server and only on the server, so only use it in CLIENTSIDE scripts. E.g. to execute only on the activator's client instead of all of them,

Code: Select all

if(PlayerNumber() != ConsolePlayerNumber())
  Terminate;
I don't know about that DECORATE, but normally clients never perform jumps; so maybe make a simpler +CLIENTSIDEONLY actor and see if you can successfully A_Jump(256, ...)?
Last edited by Qent on Sat May 11, 2013 3:20 pm, edited 1 time in total.

Ijon Tichy
Frequent Poster Miles card holder
Posts: 901
Joined: Mon Jun 04, 2012 5:07 am

RE: Questions about clientside and serverside

#9

Post by Ijon Tichy » Sat May 11, 2013 3:49 pm

no, clients do A_JumpIfInventory checks on their own, and client side actors always do jumps normally

not sure if clients do A_JumpIf checks on their own; sure seems like they do

its A_Jump that never happens on the client

RaveYard
 
Posts: 52
Joined: Wed Jun 27, 2012 1:44 pm

RE: Questions about clientside and serverside

#10

Post by RaveYard » Sat May 11, 2013 4:36 pm

I tried that CLIENTSIDEONLY actor with jump.. it worked just fine... (but using summon command)

I can't still fix the problem with the lights not flickering.. Those lights don't react in any way. (Not even explosives that turn them partialy darker in singleplayer) :cry:

Or maybe make the lights serverside.. and when they see monster they spawn lights.. But that second

I thought, the last possible solution would be enter clientside script spawning those lamps when player joins the game.. :cry:
But I don't want to try that until I have tried everything else..
Last edited by RaveYard on Sat May 11, 2013 4:37 pm, edited 1 time in total.
My Projects:
[Horror] Ghosted 2 - version 2 - v2.1.0 : Here!

User avatar
ibm5155
Addicted to Zandronum
Posts: 1641
Joined: Tue Jun 05, 2012 9:32 pm
Location: Somewhere, over the rainbow

RE: Questions about clientside and serverside

#11

Post by ibm5155 » Sat May 11, 2013 7:22 pm

But zupoman if I do like this
script 1 open clientside{
spawnspot("spidermastermind",1,0,0);
}

It´ll work online and everyone would see it and interact (it worked for me at least)
but if you do something to only one player spawn the monster, the monster´ll not work (Maybe because the server process the monster ai, so if the server doesn´t know he´s there it´ll be freeze [hmm and if only a clientside and the server spawn the monster? the other players ll see it?])
Projects
Cursed Maze: DONE, V2.0
Zombie Horde - ZM09 map update: [3/15/13]
Need help with English? Then you've come to the right place!

<this post is proof of "Decline">

ZzZombo
Forum Regular
Posts: 323
Joined: Mon Jun 11, 2012 12:11 pm
Location: Ravenholm

RE: Questions about clientside and serverside

#12

Post by ZzZombo » Mon May 20, 2013 2:19 am

No no no you all are wrong in what the flags do:
* +SERVERSIDEONLY: makes an actor to be handled ONLY by the server, so client won't ever know about it. That's said, it should be used only for invisible and nonsolid things like a spawner that just spawns random things since, first, clients can't use jump functions in such case, it saves bandwidth and performance for clients.
* +CLIENTSIDEONLY: after spawning, the clients are responsible for the actor. The server won't care about it, and each client will be the server for its own copy of the thing. Therefore, any complex things like monsters almost always won't work as intended (even if you make a monster with +CLIENTSIDEONLY in mind) in multiplayer because clients doesn't know some important stuff for the thing to function properly to avoid cheating and save bandwidth. Thus, the thing must be (again) nonsolid to avoid jittering when a player crosses teh thing. The best candidates for such flag are props like junk, gibs, etc i. e. anything small in size and that doesn't affect gameplay in any case. A note should be taken that if you spawn ANY things from a +CLIENTSIDEONLY thing such thing will exist only on clientside regardless of what type they are. That's no true for any serverside things (+SERVERSIDEONLY things are a subset of serverside things), since the server will tell clients to spawn the new actor unless it's +SERVERSIDEONLY.

Watermelon
Zandrone
Posts: 1244
Joined: Thu Jun 28, 2012 9:07 pm
Location: Rwanda

RE: Questions about clientside and serverside

#13

Post by Watermelon » Tue May 21, 2013 10:28 pm

ibm5155 wrote: But zupoman if I do like this
script 1 open clientside{
spawnspot("spidermastermind",1,0,0);
}

It´ll work online and everyone would see it and interact (it worked for me at least)
but if you do something to only one player spawn the monster, the monster´ll not work (Maybe because the server process the monster ai, so if the server doesn´t know he´s there it´ll be freeze [hmm and if only a clientside and the server spawn the monster? the other players ll see it?])
Does that actually work? Sounds like the ultimate way to desync the client from the server.

User avatar
ibm5155
Addicted to Zandronum
Posts: 1641
Joined: Tue Jun 05, 2012 9:32 pm
Location: Somewhere, over the rainbow

RE: Questions about clientside and serverside

#14

Post by ibm5155 » Tue May 21, 2013 11:08 pm

I tried again but no result =/, I may had used some thing active like funcion (at least everyone could see the spider :B)
Projects
Cursed Maze: DONE, V2.0
Zombie Horde - ZM09 map update: [3/15/13]
Need help with English? Then you've come to the right place!

<this post is proof of "Decline">

Post Reply