- Home /
How do i control An Object between Server and Client
Hello. First of all, I'm foreigner so my English skills bad... please understand my situation.
actually I'm here first time. i have a question, i think Commnunity- Forums - Network ~~ , that is a Q&A .
you know what i mean... if not, i'm sorry my bad english writing...
i wanna make a game which is like Heroes of Might and Magic, Chess. turn based game. but it has tactics.
but my problem is that i'm using unity built-in network.
and i searched some of views that say Server has to control object to security.
that is understandable. yes, yes, if not user hack client object and adjust some property.
so, in my game if you press space bar, object is created. not in server(i blocked) but in client but! object is created in server use RPC.
i mean, in Server Window, if you press space bar it's not working. but if you press space bar in client window. object is created
and there's one other Client window exist.
so, there are 1 Server( MasterServer and Server is stored in MasterServer) , 2 Client
i want to make a game between these 2 client. but,
in client1, I make an object, named A in client2, i make an object, named B
and now position is that.
Server,Client(both window) have 2 object and i can see that. but, actually Object is stored in Server, not client. so if i wanna move this object. i must use RPC. but i think RPC is expensive cost.
so i think,
if i make an object to move, let's do like this!
in Server, Object is teleport move X , Y -> W , Z at once like this transform.position = W,Z
but in client, Object is moving smoothly! if move X,Y -> W,Z ,
move like x+0.1 ,y+0.1 , go and on and on , and x+ X = W y+Y = Z
if(Vector3.Distance( (X,Y) , (W,Z) ) >= 0.5)) transform.position += ( (W,Z) - transform.position ).normalized speed Time.deltaTime; if(Vector3.Distance( (X,Y) , (W,Z) ) < 0.5) transform.position = (W,Z)
you know what i mean? i 'm sure you do.
but i think it's impossible... but i tried couple of days... (State Synchronization in Network View is off.. but i think it's useless trial)
but now, i changed my goal.
just make a game, don't care security...
so, i make Server and Client again.
2 client.
each client has List of Object. ( yes this is different between now and before) and Synchronization is Reliable.
during my goal is changed, i think that, now i'm using capsule. but later i will use 3d char model which has animation... and i read API Doc, Synchronization Reliable is automatically doing this information. so i do Reliable again...)
but, if i do that i think RPC call is very often.and Server and Client moving like lag? isn't this english, i mean frequency is high so your character isn't moving smoothly...
but interpolation or i just ignore some problem... because if not, i can't go a step...
anyway...
now i have 2 client which has each List of an object
i mean
Client1 has a List,(character List farmer, archer,swordman... etc...) Client2 has a List,(same)
but server doesn't have list...
when first my trial, i wanna fix that problem, and i tried something... one of that is
Server has list,(at first i said server has only list) and client has list. so if, client1 makes object. client1 list has this, and server has this, but. in windoew Scean 2 object exist. i want 1 object... and i don't now how to fix this... so i give up this...
anyway client has list.(and other is same)
client1 has list, client2 has list.
and its synchronized, so if i move, in client1 window, in server and in client2 window move! in client2 window i order move, server and client1 object is move!
yeah! finally i'm happy because it has some problem.. anyway it's working(actually if i wanna do like this, i can do this at first... so actually i 'm not happy...
anyway. i have problem now ...
if in Client1! object A is trying to hit obejct B!(this is created in Client2) HOW DO I DO? because client1 has only object a, client2 has only object b,
server has nothing...(because if i make a list and stored, object is exist double...)
this is all i wanna ask..
My grammer is bad.. writing is bad.. word is bad.. but i can't find in my country language.. korean... i asked so many times but people doesn't answer to me...
so i write this... if you answer me i really thanks to you
thank you for reading this! bye! have a good day!