Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
0 registered members (), 938 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Jumping Bug #184653
02/19/08 18:41
02/19/08 18:41
Joined: Nov 2006
Posts: 193
England
RyuShinji Offline OP
Member
RyuShinji  Offline OP
Member

Joined: Nov 2006
Posts: 193
England
Hello In my multiplayer game you can jump, but i have a problem.

only the host or "-cl -sv" player is jumping. the clients won't
and whenever the host jumps the clients do too.

what could be the problem?

Re: Jumping Bug [Re: RyuShinji] #184654
02/19/08 18:45
02/19/08 18:45
Joined: Feb 2008
Posts: 337
V
Vadim647 Offline
Senior Member
Vadim647  Offline
Senior Member
V

Joined: Feb 2008
Posts: 337
1. Every client's player must be created on local machine.
2. Using (key_*) or (on_* = *) ?


I switched to other account since marth 2010. Guess which.
Re: Jumping Bug [Re: RyuShinji] #184655
02/19/08 18:47
02/19/08 18:47
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline
Expert
Excessus  Offline
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
The problem is that the function/action that checks if the jump key is pressed, and then jumps is running on the server. If you use ent_create, the function you pass is executed on the server, even if you used ent_create on the client.

What you want to do is something like this:
Code:

client:
player = ent_create(..)
playerAction();

action playerAction()
{
while(1)
{
if(key_space) {player.z += ..} // jump when space is pressed
wait(1);
}
}



Re: Jumping Bug [Re: Vadim647] #184656
02/19/08 18:54
02/19/08 18:54
Joined: Nov 2006
Posts: 193
England
RyuShinji Offline OP
Member
RyuShinji  Offline OP
Member

Joined: Nov 2006
Posts: 193
England
thank you, i thought i did that.

The Walking & running works, its just when i try to add a new movement the client seems to not be able to do it and copy the host,

this is my handle gravity function that is called in a while loop in the player.mdl's action.

FUNCTION handle_gravity()
{
trace_mode = ignore_me+ignore_passable+use_box;
result = trace(vector(my.x,my.y,my.z - my.z_offset),vector(my.x,my.y,my.z - 4000));
IF (result < 3) //Result is the distance from the player's feet to the ground, if it is below 0 then it means the trace was inside a
{ //block and result returns a negative value,
IF (my.jumping_mode == 0) {
my.force2_z = -1 * result;
IF (key_space == 0 && space_press == 1) { space_press = 0; }
IF (key_space == 1 && space_press == 0 && my.movement_mode == 0 && my.animblend >= stand && my.animblend != jump &&
my.animblend != fall) {
space_press = 1;
my.jumping_mode = 1;
my.force2_z = 25;
my.blendframe = jump;
my.animate2 = 0;
my.animblend = blend;
}
}
IF (my.jumping_mode == 2 || my.jumping_mode == 3) { my.jumping_mode = 0; }
} ELSE {
IF (my.jumping_mode == 2) {
IF (result > 120) {
my.animate = 60;
my.jumping_mode = 3;
} ELSE {
my.jumping_mode = 0;
}
}
IF (my.jumping_mode == 3 && result <= 120) { my.jumping_mode = 0; }
IF (my.jumping_mode == 0 && my.movement_mode == 0) {
IF (result > 120 && my.animblend >= stand && my.animblend != jump && my.animblend != fall) {
my.jumping_mode = 3;
my.blendframe = fall;
my.animate2 = 0;
my.animblend = blend;
}
}
my.force2_z -= 6 * time;
my.force2_z = max(-30,my.force2_z);
}
my.velocity_z += (time * my.force2_z) - (min(time*0.7,1) * my.velocity_z);
my.force_z = my.velocity_z * time;
}


does this help?

Last edited by RyuShinji; 02/19/08 18:58.
Re: Jumping Bug [Re: RyuShinji] #184657
02/19/08 20:03
02/19/08 20:03
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline
Expert
Excessus  Offline
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
No, you should look at the structure of the code I posted. The actuall contents don't really matter.

The problem is not in the function itself, but in the fact that it is running on the server, when you want to run it on the client. So create your player on the client, store its pointer in the predefined player pointer, and use that pointer in a function you call from the client.

Re: Jumping Bug [Re: Excessus] #184658
02/19/08 20:27
02/19/08 20:27
Joined: Nov 2006
Posts: 193
England
RyuShinji Offline OP
Member
RyuShinji  Offline OP
Member

Joined: Nov 2006
Posts: 193
England
I think I understand, i've changed all of the my.somethings into player.somethings
but the client still can't jump i'm sorry there must be something i'm missing,

i cant figure out why somethings work and somethings don't

how do i call from the client do you mean use the player pointer ?

Last edited by RyuShinji; 02/19/08 20:40.
Re: Jumping Bug [Re: RyuShinji] #184659
02/19/08 20:56
02/19/08 20:56
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline
Expert
Excessus  Offline
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
How are you creating your player entity?

It is important that:
-It is created on the client (will automatically be created on all other connected systems, but you must call ent_create from the client).
-You understand that the action you pass as parameter to ent_create will run on the server. This means you shouldn't put your jumping code in there.
-Store the player pointer on the client: player = ent_create(..);
-Right after that, do a normal function call: playerAction(); (subsitute with you player action name) In this function, you should use the player pointer and not me/my. I think this is the thing you're still missing.


Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1