About Store Forum Documentation Contact



Post Reply 
Make char turn while moving.
Author Message
Salival Offline
Member

Post: #1
Make char turn while moving.
This is how moving in our game works:

Client -> Server Go to pos x;x;x (request to move)
Server -- Starts moving to pos
Client <- Server go to pos x;x;x (confirms that movement is valid and instructs client to move
Client -- Starts turning the character, after character is turned to the right side - it starts moving

Problem:
Character is turning on client while on server it is already moving.

Would it be possible to make character turn while moving, so it would not waste time while turning. Now we have to make turning speed very fast to keep coordinates of client and server synchronyzed. We would like to have smooth turning while moving.
04-12-2011 03:57 PM
Find all posts by this user Quote this message in a reply
llynx Offline
Member

Post: #2
RE: Make char turn while moving.
(04-12-2011 03:57 PM)Salival Wrote:  We would like to have smooth turning while moving.

Running 2 clients and turning on one and watching from the other this is pretty smooth and responsive.

Old old old code but I think it still works
Code:
if (Kb.b(KB_W)) Players[0].actionMoveDir(Cam.matrix.y);
if (Kb.br(KB_W)) Players[0].actionMoveTo(Players[0].pos());
if(Ms.b(1))
{
            Cam.yaw  -=Ms.d().x;
            Clamp(Cam.pitch+=Ms.d().y,-PI_2,-0.1f);
}
(This post was last modified: 04-12-2011 04:16 PM by llynx.)
04-12-2011 04:15 PM
Find all posts by this user Quote this message in a reply
Jben Offline
Member

Post: #3
RE: Make char turn while moving.
alors ?
04-12-2011 04:22 PM
Visit this user's website Find all posts by this user Quote this message in a reply
rndbit Offline
Member

Post: #4
RE: Make char turn while moving.
what he had in mind is that turning instead of starting to move immediately after instruction to move is received creates a situation where character on server has moved significantly further than character on the client. also implementation is that character on client moves only when server instructs to do so (not like in mmo sample where we have wasd movement).
04-12-2011 04:24 PM
Find all posts by this user Quote this message in a reply
llynx Offline
Member

Post: #5
RE: Make char turn while moving.
(04-12-2011 04:24 PM)rndbit Wrote:  what he had in mind is that turning instead of starting to move immediately after instruction to move is received creates a situation where character on server has moved significantly further than character on the client. also implementation is that character on client moves only when server instructs to do so (not like in mmo sample where we have wasd movement).

Ah, so make it so that while the the client side only instructs the server to move after the character has turned in the right direction while syncing character rotation with the server.

If you want the server to have a movement control over the client, the server should instruct the client to start moving first but not move on SS until CS player rotation == SS player rotation and CS triggers SS pos change.

Hmmm but this is only the from 0 velocity case where a player is facing one direction and is instructed to go in the opposite direction, but something similar can be applied while the character is in motion.
(This post was last modified: 04-12-2011 04:34 PM by llynx.)
04-12-2011 04:31 PM
Find all posts by this user Quote this message in a reply
rndbit Offline
Member

Post: #6
RE: Make char turn while moving.
that is one or two more packets sent in between.. and server has to keep track of rotation of client. would be much simpler if client character just turned while moving. but yes, this is one way too solve this.

EDIT:
also is there even a way to check if character is turning? or a method to just turn character? I can see only something along these lines in Input struct. Lack of docs sometimes is killing me
(This post was last modified: 04-12-2011 05:18 PM by rndbit.)
04-12-2011 05:07 PM
Find all posts by this user Quote this message in a reply
llynx Offline
Member

Post: #7
RE: Make char turn while moving.
Wouldn't turning the client while moving make the character on the client side "slide"?

Say there is a hypothetical situation where you have a character and there are two options, the client clicks on an unreachable area or clicks on a reachable area that is in the opposite direction.

Regardless of if the area is unreachable shouldn't implementation be that the character immediately starts turning toward the directed object, meanwhile sends a query to the server to see if its valid/etc (if valid server waits for CS to signal changing position), once the character is facing the right direction both cs/ss start changing position if the query was valid.

But again this makes it so that other clients don't see the rotation of that particular player unless the server tracks rotation of characters. But this can be worked around by the server making "micro movements" that would turn the character in the right direction at the correct rate that would approximately mimic the angular velocity on the CS without actually moving the character by a noticeable amount on SS. (But if you want to do this and have a turning animation visible on all clients you'd have to do something like signaling to the clients that that particular character is turning, or have on the CS recognize the micromovements and animate appropriately.)

But I guess it depends on the level of realism/smoothness you want. If you just want it smooth with emphasis on position you can just have the character turn while moving. But if you want a higher level of accuracy other workarounds need to be made.




...

Doesn't this problem only exist if there is movement by clicking on areas instead of direct input?
(This post was last modified: 04-12-2011 05:45 PM by llynx.)
04-12-2011 05:39 PM
Find all posts by this user Quote this message in a reply
rndbit Offline
Member

Post: #8
RE: Make char turn while moving.
yes, it would make character look like sliding. i personally do not find it much of the issue at least in current development stage.

what is direct input? wasd type of movement? We did not implement that. yes, this problem would exist only with click-move style input, but then again wasd style movement introduces whole new array of problems to solve which are more problematic..
04-12-2011 06:28 PM
Find all posts by this user Quote this message in a reply
llynx Offline
Member

Post: #9
RE: Make char turn while moving.
(04-12-2011 06:28 PM)rndbit Wrote:  what is direct input? wasd type of movement? We did not implement that. yes, this problem would exist only with click-move style input, but then again wasd style movement introduces whole new array of problems to solve which are more problematic..

What kind of problems? Cant think of any ATM. (I didn't get to implementing strafing but KB_W works fine with turning and everything. If you make the server handle character rotation info, strafing should be a sinch.)
04-12-2011 06:35 PM
Find all posts by this user Quote this message in a reply
Dandruff Offline
Member

Post: #10
RE: Make char turn while moving.
This is what i got for turning while moving:

http://www.paste.to/MzAxOQ==

When the player presses a movement key he will turn to the direction of the screen. In this case you can modify it so that it will turn to the direction of whatever, relative to the character.
(This post was last modified: 04-14-2011 02:37 AM by Dandruff.)
04-13-2011 12:42 AM
Find all posts by this user Quote this message in a reply
Post Reply