Tag Info

New answers tagged

0

Based on user55565's answer, I did some reading on rotation matrices and took his main idea and did some paper sketching. In the end I came up with the class below, which works. The basic idea is to reference the position of the square by its center coordinates. When you want to rotate it, you follow these steps: Calculate the current(before the ...


1

Im not sure this works 100% but here is an idea to get you started. Let your square have x,y as center and r as its current rotation value. Let dx and dy be the displacement from center to one corner of the square when r is 0; On rotate-moving the square on the said corner: First get the corner's position: cx = x + rotated(dx, r); cy = y + rotated(dy, ...


3

You need to set to NPC a new target once in a while (e.g. each 5sec) and move it towards the target each tick little by little. Then it will be smooth. To avoid sharp turns upon setting a new target, you can mix target positions between old and new target for a second or two. Additionally, you might want to Google for "Steering behavior"


1

You don't constrain the vertical or lateral movement. The path line is only for controlling the depth and direction of the player character. You can see from the video the little white line that's attached to the green path. That white line shows where the character is "attached". The white line is just the closest point on the line to the player. Imagine ...


1

Change your red square collision box to a circle collision (or a sphere in 3D, the same issue can happen in 3D).


0

From what I understand your question can be boiled down to one simple problem: the input from each player is applied to the shared game state in different order. In the image above I am illustrating this problem with the coloured dots (which represent the players' input). Assuming 3 players, their shared game state should be the one labeled "real order". ...


2

I was going to type up an answer, but then I found this article, which seems to be exactly what you need: http://www.iforce2d.net/b2dtut/constant-speed I'll copy a few of the relevant bits. This assumes C++, but it's certainly applicable to any language. [...] in other situations you might want it to start and stop instantaneously. It is very tempting ...


0

Even in a fixed time-step environment(yes, you should use some sort of "turn based system" instead of timer, as you can easily slow down/up your turn duration), you will see math diverge. This is a really trick problem called "determinism". Modern different hardware is non deterministic, especially when it comes to float math, due to specific acceleration ...


2

Skew happens. This is a clock synchronization problem. Two nodes on a network can't know for sure what each other's clocks are. You can send the current time, but the receiver can't know for sure how old that value is. A good guess, though, is that it's stale by half the ping time. See http://en.wikipedia.org/wiki/Round-trip_delay_time. One approach then, ...



Top 50 recent answers are included