2 registered members (dr_panther, 7th_zorro),
1,203
guests, and 2
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: [Anet] physics movement setup
[Re: darkinferno]
#285439
08/18/09 14:39
08/18/09 14:39
|
Joined: Jul 2005
Posts: 1,930 Austria
Dark_samurai
Serious User
|
Serious User
Joined: Jul 2005
Posts: 1,930
Austria
|
Cheaters normaly manipulate the client application for their cheats. And if they are able to get access to the enet_send_skill() function for example and the health of a player is stored in a skill, they can easily cheat Because of this, such important values should be stored on the server. The client only gets a "copy" of those values. But the value that is used for checking if the client is dead or not must be on the server and the client shouldn't be able to change it directly. I currently have a lot of work, let's see if I have some time do do something like that in the future. But I really can't promise that. The best would be to try it like I explained above. Shouldn't be too hard to code
ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)! get free version
|
|
|
Re: [Anet] physics movement setup
[Re: darkinferno]
#285450
08/18/09 15:27
08/18/09 15:27
|
Joined: Oct 2005
Posts: 4,771 Bay City, MI
lostclimate
Expert
|
Expert
Joined: Oct 2005
Posts: 4,771
Bay City, MI
|
i'm hearing about cheating on client side, bit am wondering, if i'm doing movement clientside, what can a cheater do to get an advantage? also.. i dont know if dark_samuri would like to do this but it would be cool to see a server-side template or demo similar to the 3d chat program on your website... its easier for me and am sure for everyone else when they have a base to study on put it this way, the only things that should be defined on the client (for absolute security, of course not always needed) the only thing that should be made on the client is calls to the server, and possible actions like setting rotation, that dont matter to anyone elses gameplay. for example, lets say you have it so that 60/second your character moves on your machine, one in 6 times your position is updated to everyone else, if it is done on the client, the client could hack your program so that you move 600 times a second so now your character can move 10x as fast as everyone and when it updates to the server, the server doesnt know the difference. of course you could make checks on the server on distances moved, but thats like putting bandage on a gash, better to just be more careful instead.
|
|
|
Re: [Anet] physics movement setup
[Re: lostclimate]
#285545
08/18/09 23:56
08/18/09 23:56
|
Joined: May 2009
Posts: 1,816 at my pc (duh)
darkinferno
OP
Serious User
|
OP
Serious User
Joined: May 2009
Posts: 1,816
at my pc (duh)
|
ok, pretty lame question but somehow am not seeing it, how do i create an entity oh the server? creating them on clients is ok how do i say, create 2 entities on the server, am getting a little mixed up as to how anet handles server, server+client
[edit] or maybe am just not thinking this through.. maybe been infront of tha pc for too long ^^
Last edited by darkinferno; 08/19/09 00:15.
|
|
|
Re: [Anet] physics movement setup
[Re: lostclimate]
#285596
08/19/09 09:22
08/19/09 09:22
|
Joined: Jul 2005
Posts: 1,930 Austria
Dark_samurai
Serious User
|
Serious User
Joined: Jul 2005
Posts: 1,930
Austria
|
If you call enet_ent_create() it creates the entity everywhere never mind on which host the function is called. EDIT: Btw. I would advice you to read the Simple 3D chat tutorial and the HowTos. You will have a much smarter start
Last edited by Dark_samurai; 08/19/09 09:34.
ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)! get free version
|
|
|
Re: [Anet] physics movement setup
[Re: darkinferno]
#285642
08/19/09 12:38
08/19/09 12:38
|
Joined: Jul 2005
Posts: 1,930 Austria
Dark_samurai
Serious User
|
Serious User
Joined: Jul 2005
Posts: 1,930
Austria
|
Why a unique pointer? The glob. pointer is a unique pointer and can be used to identify the entity. With enet_ent_creator you get the clientid of the creator of the entity. if CreatorID equals myClientID allow controls. On the server you set up the physicparameters and on the client that controls the entity you fill a skill with the input. Everytime the skill has changed, send it to the server with enet_send_skill(). The server always updates the positions and angles with enet_send_pos/ang. This would be the entity function:
function player_function()
{
if(enet_ent_creator(enet_ent_globpointer(my)) == enet_get_clientid())
{ //Every client controls his own player
while(1)
{
//store the keys as bits in a skill1
if(my.skill1 != oldskill1) enet_send_skill(enet_ent_globpointer(my),1,1,SERVER);
}
}
if(enet_get_connection() == SERVER_MODE)
{
//set up the physic stuff
while(1)
{
//use skill1 for the controls of the entity
enet_send_pos(enet_ent_globpointer(my),BROADCAST);
enet_send_ang(enet_ent_globpointer(my),BROADCAST);
}
}
}
That's all Simple? Yes it is All you have to notice is that every client must create his player using enet_ent_create().
ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)! get free version
|
|
|
Re: [Anet] physics movement setup
[Re: Dark_samurai]
#285646
08/19/09 13:31
08/19/09 13:31
|
Joined: May 2009
Posts: 1,816 at my pc (duh)
darkinferno
OP
Serious User
|
OP
Serious User
Joined: May 2009
Posts: 1,816
at my pc (duh)
|
i tried the above, well.. i tried this to be exact:
function move_player()
{
while(enet_ent_globpointer(my) == -1) {wait(1);} //wait until the entity gets a global pointer
if(enet_ent_creator(enet_ent_globpointer(my)) == enet_get_clientid())
{ //Every client controls his own player
while(1)
{
//store the keys as bits in a skill1
// if(my.skill1 != oldskill1) enet_send_skill(enet_ent_globpointer(my),1,1,SERVER);
wait(1);
}
}
if(enet_get_connection() == 2)
{
//set up the physic stuff
phent_settype(my, PH_RIGID, PH_BOX);//physik entity definieren & kollision = sphere
phent_setmass(my, 75, PH_SPHERE);//masse definieren & rotation = sphere
while(1)
{
//use skill1 for the controls of the entity
//enet_send_pos(enet_ent_globpointer(my),BROADCAST);
//enet_send_ang(enet_ent_globpointer(my),BROADCAST);
wait(1);
}
}
}
i'm working with the way you set up the chat program, so the entities are created when the client joins via:
function create_player()
{
VECTOR creating_pos; //position were the entity will be created
//generates the starting position:
if(enet_get_clientid() == 0) {creating_pos.x = 0;creating_pos.y = 0;}
if(enet_get_clientid() == 1) {creating_pos.x = -200;creating_pos.y = 0;}
if(enet_get_clientid() == 2) {creating_pos.x = 200;creating_pos.y = -200;}
if(enet_get_clientid() == 3) {creating_pos.x = 200;creating_pos.y = 200;}
creating_pos.z = 0;
//creates the coresponding character:
if(character == 1) {player =enet_ent_create(_str("char1.mdl"),creating_pos,_str("move_player"));}
if(character == 2) {player =enet_ent_create(_str("char1.mdl"),creating_pos,_str("move_player"));}
if(character == 3) {player =enet_ent_create(_str("char1.mdl"),creating_pos,_str("move_player"));}
}
what this does however is, when i run as server/client, it creates the entity but physics isnt applied, when i join as a client, the character i created has physics applied, now if am correct, somethings wrong here? i shouldnt be seeing any movement on the client unless i sent positions? [edit] i think i may be overlooking something simple however, am looking into it, i made this post maybe a little early
Last edited by darkinferno; 08/19/09 13:47.
|
|
|
Re: [Anet] physics movement setup
[Re: darkinferno]
#285656
08/19/09 14:35
08/19/09 14:35
|
Joined: Jul 2005
Posts: 1,930 Austria
Dark_samurai
Serious User
|
Serious User
Joined: Jul 2005
Posts: 1,930
Austria
|
if(enet_get_connection() == 2) means on every client, but you want the movement on the server correct?
=> correct would be if(enet_get_connection() == SERVER_MODE || enet_get_connection() == CLIENT_SERVER_MODE)
ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)! get free version
|
|
|
|