35

Fake it Look at the video you linked, watch it in slow motion... eh, what is that? The camera jumps at the end, and the knife is already in the helmet of the target. Just fake it. Once the distance from the knife to the target is small, jump cut to the knife magically in the target. Edit: you can check if it will hit a target using the convoluted ...


14

You can use random seed. Select same 32-bit value in server and client (or server can send it to client at start). Use it as seed for random generator. You can send actual seed from server to client with game state update. If you don't want to send it you must be sure that client and server generates same number of random numbers by this random generator. ...


14

If you know ahead of time where the knife will land - like in those kill cam footage, which is most definitely produced after-the-fact - just calculate the right rotation speed based on flight distance and number of rotations desired. Throwing knives leave the thrower hilt-first, so it needs to rotate N+0.5 full rotations1, where N is usually at least 1 but ...


14

Calculate the straight line distance to target. Each Frame set the angle of the knife to be 2PI*(remainingStraightLineDistance)/(originalStraightLineDistance)*DesiredNumRotations. The spin ratio will vary slightly if you don't move the knife in a straight line but no-one will ever notice. If you don't pre-determine the target (i.e. you're just throwing and ...


8

You should send redundant data, which here means send the position and the velocity. Even if you are out of sync, the fact that you have the position and the velocity allows you to correct the trajectory using an interpolation function. Then using some tricks like delayed animations, accelerations, etc. allows to hide the latency. Edit: I assume that the ...


7

As simple solution , as already I said in a comment, you can try this aproach: consider a phase where you point the ship in the target direction, in that phase you apply a rotation to the sip but also a forward movement. When the ship is already facing target you can apply a full forward speed. I arranged a test in love2d , here follow the ship update method ...


7

See this page Adding Realistic Turns The next step is to add realistic curved turns for our units, so that they don't appear to change direction abruptly every time they need to turn. A simple solution involves using a spline to smooth the abrupt corners into turns. While this solves some of the aesthetic concerns, it still results in physically very ...


7

From what I see, the game loops you are trying to use are somewhat specialized. I don't know why you chose those ones, but in my opinion you are trying to solve problems that don't exist in the first place. Instead of copy-pasting a game loop from some site, I suggest you think about how your game is made and what your priorities are, and then create a game ...


6

Client-side prediction depends very heavily on a deterministic physics model that exactly replicates the way the game object behaves on both the client and the server. Even small floating point errors, differing random seeds, or slight differences in time if your time step is not fixed can cause very different results. These results can then rapidly diverge ...


5

During the 6 months since I asked this question, I ended up developing a complete open source game server to deal with this exact issue (and many others!): http://lance.gg The R&D involved now allows me to answer my own questions: Can you make Gambetta's algorithm work with constant step movement? Or is it conceptually incompatible with my game? ...


4

All clients are initialized to the server time when they log in or the game starts, they get updated on this occasionally. The server uses the "keep alive" ping of the authentication service and lets the clients know what kind of delay they're working with, this delay will change over time and so needs updating occasionally. If you're not using a proper ...


4

Your client never moves you. The server moves you. Think about it this way: A client sends a movement request packet to the server to start moving. The server says sure you can start moving, there's nothing in the way. The server begins moving the player in x direction. The same client ask the server to start moving again. The server says, you're ...


4

Real throwing-knifes are designed to have a very high chance of hitting blade-first. Design your knives accordingly. Collection of throwing knives from Wikipedia: You want the center of mass, and thus the center of rotation, as far away from the tip of the blade as possible. This will increase the odds that the blade will spin around into hitting position ...


3

One way would indeed be to try out the four possible moves for every tile (or rather the ones that have recently moved) and check for matches, then store them as hints. You wouldn't need to do this as often as you might think (especially if you only do it for tiles that have moved); you would only need to swap every tile twice since the one next to it would ...


3

If both the server and client agree on the seed, most randomizing algorithm will output the same values.


3

Reduce the send rate of packages. I would suggest you to set a fixed rate (say, 3 times a second - actually this is a great rate of sync if you do client-side predictions correctly), rather than a rate that depends on input change rate. But of course, this will reduce the precision of sync. So you will need to send velocity info with position too, and make ...


3

A better, and more direct, answer would be: They don't ever sync. When placed side-by-side, Client A will always move first, before client B sees him move. "Tricks" are then used to resolve this difference. E.g. If one player shoots at another, resolve the shots based on what the shooting player saw, by checking for past positions on the server (...


3

I think we can actually plan a complete curve that meets your needs, using some techniques similar to my earlier answer about spaceship waypoints. I'm going to assume that we can model your ships' movements using Newtonian physics (ie. masses moving inertially and accelerating quadratically under constant force). Depending on how much simulation of real ...


2

Actually there is an open-source implementation in github which shows how this is done. Check out Lance.gg github repo: https://github.com/lance-gg/lance The client prediction code is implemented in the module called src/syncStrategies/ExtrapolateStrategy.js Besides extrapolation, there are two concepts which I didn't see mentioned above: Incremental ...


2

Why calculate the trajectory for the sounds/slow down effects? If you split the act of slowing down the camera and playing effects into sections upon approach to your squishy victim then you can essentially play them on condition of their proximity. This is a great example that comes to mind. The proximity slow down effects employed in Peggle The ball ...


2

Important commands need to be reliable. If you have some input, you need to do get it to the server. If the packet is dropped and not ACKed, you must resent it. This is one reason that less twitchy games often just use TCP (with NAGLE off). Games that need UDP often end up having to reimplement much of TCP for some types of messages. For instance, you can ...


2

SyncRigidBody2D will also update velocity and angular velocity (if syncSpin is set to true). It will not however, also sync the entire state of the physics simulation, just of the synced body. One way to reduce pulsing would be to use curved interpolation to match the start and end velocities, however it seems Unity's NetworkTransform script does a linear ...


2

If I understand your problem correctly, you wish to determine, for a given initial location, initial velocity, desired target, and constant magnitude acceleration, what constant point the acceleration must be aimed at in order to pass through the desired target point at some future time. This is the definition of circular motion around the aiming point, ...


2

Intro One smooth way to do this is to interpolate for a short period of time if the postions are "near enough" just for a "viewing" perspective, but still have the "proper position" in sync with the server for collisions and so. Definition of "near enough" Near enough is "what typically will happen in normal operation" of your servers, and to calculate ...


2

The clock speed matters less, as long as you make sure the server and the client game steps are kept in sync. This article by Gary Weiss discusses this issue. Essentially either the game loop on the client or the server be late/early and you need to take care of these discrepancies. Here's a proposed piece of code he wrote to implement these syncs (in JS): ...


2

For a "smoke and mirrors" way, you can have the center of rotation of the knife (i.e. the center of mass) near to the handle (i.e. non-pointy part). This way, if the rotation speed is high enough compared to the knife's velocity, it can be guaranteed that the tip of blade will collide with the target and not any other part. There's some calculation to get ...


2

Approach the player ship With the major problem being for the AI to calculate perfectly the curve required to come up along side the player, or to better yet, make a pass along their bow / stern before coming along side without needing to let them quickly speed up / slow down to achieve this. You'll need to solve these problems iteratively, as there's no &...


1

Your game seems to be too "real-time" to think in terms of time steps. I'd only think in terms of "turns" if the game can be considered "turn-based". Otherwise, just abandon the idea of turns or steps. Everything becomes easier then :) Note that you predict locally for your player, and interpolate only for other entities (as explained in the 3rd article in ...


1

Explain multiplayer game. In fps games, 100 milliseconds can change the outcome of your shots. In civizilation-type games, you can have up to 1000 milliseconds without even noticing it, and up to 2000, without being seriously frustrated. In games, where everyone does his thing, like in simcity 5 (let's assume simcity 5 is one of them, and it doesn't kicks ...


1

I spent weeks on a very similar problem. With the help of DMGregory, I finally solved it! First you find the spawn position for the bullet (wherever you want). Then you find the destination for the bullet (calculate where the player will be...let me know if you need help with this part). Then you cheer DMGregory's name for his insanely awesome awesomeness. ...


Only top voted, non community-wiki answers of a minimum length are eligible