35 votes
Accepted

How to make sure spinning objects hit a target with the right end?

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 ...
Theraot's user avatar
  • 26.6k
14 votes

How to make sure spinning objects hit a target with the right end?

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 ...
congusbongus's user avatar
  • 14.8k
14 votes

How to make sure spinning objects hit a target with the right end?

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 ...
Tim B's user avatar
  • 556
9 votes
Accepted

How to compensate for moving objects with client side prediction?

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!): https://lance-gg.github.io/ The R&D ...
OpherV's user avatar
  • 655
7 votes
Accepted

Client side prediction physics

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,...
RelicBloodvayne's user avatar
5 votes
Accepted

How can I maneuver an AI pirate ship for a sea battle?

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' ...
DMGregory's user avatar
  • 134k
4 votes
Accepted

Networking a fast-paced game (2D) - Forced Movement - Server / Client

For example, another player stuns or slows down you, on the server, you will be slowed down or stunned There is a delay there, from when the player initiates the stun until it reaches the server. For ...
Theraot's user avatar
  • 26.6k
4 votes

How to make sure spinning objects hit a target with the right end?

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 ...
dotancohen's user avatar
3 votes

Multiplayer game server sync

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 ...
OpherV's user avatar
  • 655
2 votes

Clientside interpolation - update rate fixed to client framerate

One approach is to give each server step a incrementing number. For example, a server may be currently executing step 500, and after one second, this server running at 60 FPS will have reached step ...
Gary Weiss's user avatar
2 votes

How does client-side prediction work?

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 ...
Gary Weiss's user avatar
2 votes

How can I maneuver an AI pirate ship for a sea battle?

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 ...
Engineer's user avatar
  • 29.5k
2 votes

How to make sure spinning objects hit a target with the right end?

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 ...
Guido's user avatar
  • 121
2 votes
Accepted

How to calculate trajectory on a planet with drag factor

Your approach has good grounds, but there are mistakes in your code. A little theory first: Your simulation needs to use the second law of Newton which gives you the acceleration of the projectile: \$\...
Sacha's user avatar
  • 466
1 vote

Rollback netcode: how to avoid teleportation?

As DMGregory said, Rollback is about blending the initial state and the new information coming from the player. You can also watch this video to learn more about how to blend animation.
MariaA's user avatar
  • 59
1 vote

Moving ship to new destination when already having a velocity?

You're fixing your time horizon as always taking 1 hour to get to your destination. ...
DMGregory's user avatar
  • 134k
1 vote

Sever-side physics simulation and client 'inputs' send rate in a fast multiplayer game

I had this exact same issue with my multiplayer game engine. As others have pointed out you could decouple the rendering and simulation on the client side to keep the client side simulation at a ...
Expliced's user avatar
1 vote

How to predict where the soccer ball should be intercepted by an AI player after being kicked?

I'm sure there is probably a really complicated proper solution to this problem but I think we can probably cheat and get a quick answer using cached data and some functions. Assuming the friction is ...
Benjamin Danger Johnson's user avatar
1 vote

most compact way to represent dice face translations rolling in cardinal directions

I think a lookup table indexing each of the 24 orientations is likely to be the most compact you can get. Then your current orientation is a byte and you can look up the values of the faces as quickly ...
DMGregory's user avatar
  • 134k
1 vote

How to move the object with same pace regardless their target distance?

What you want to do is calculate the distance between each waypoint, and then adjust the speed so the time it takes to reach the next waypoint is the same. First, decide how long you want it to take ...
Tim Holt's user avatar
  • 10.3k
1 vote

How to move the object with same pace regardless their target distance?

I assume that the code posted is in some update function? It appears as if you are continuously increasing the speed if you increase the y distance. Doesn't seem like that is necessary.
King-Xero's user avatar
1 vote
Accepted

How do I determine how far to move an object in the client when using client-prediction?

It looks like you're trying to separate the behaviour on the xy vs z axes, but you have not done so correctly. ...
DMGregory's user avatar
  • 134k
1 vote

How to make sure spinning objects hit a target with the right end?

Perfect knife thrower? At the moment, you say you are spinning the knife through animation. What parameter are you using to control the angle? Frame number? Game time? Scaled by an arbitrary spin ...
Neil_UK's user avatar
  • 119
1 vote

Movement-networking for a Worms-like game

I would also have the client send its absolute position to the server as well. The server can still simulate the movement if you desire, however this is useful to prevent the two positions getting out ...
MishMash95's user avatar
1 vote
Accepted

How Do You Handle Timed Events In Prediction/Reconciliation Client Model?

I think you're on the right track with your idea about sending time information back from the server. Sending action-specific times doesn't seem necessary, though. If each input sent to and from the ...
Victor T.'s user avatar
  • 1,381
1 vote

How to compensate for moving objects with client side prediction?

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....
ggambetta's user avatar
  • 3,101
1 vote

The tolareable lag range in a multiplayer game

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 ...
Bálint's user avatar
  • 14.9k
1 vote
Accepted

Efficiently detect shoot direction with gravity playing a role?

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 ...
Evorlor's user avatar
  • 5,793

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