Jump to content
  • Advertisement

raz0r007

Member
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

0 Neutral

About raz0r007

  • Rank
    Newbie

Personal Information

  • Interests
    Programming

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. raz0r007

    Interpolation problem in racing game

    According to posts in internet, difference between interpolation and extrapolation is : Interpolation let's us approximate something that already happened (we know two points A and B. And we can interpolate from position A to position B). Extrapolation means that we try to predict something, knowing how it behaved in the past. My question is: why (according to you) extrapolation is better than interpolation in racing games? How can i predict the position of the opponent's car? It's impossible. I could generate a lot of errors. For example: i could move the car foward despite of my opponent has turned to left....
  2. raz0r007

    Interpolation problem in racing game

    @hplus0603 thanks for reply. I know that i can't avoid the latency. But i'm trying to "make seem" that i don't have latency. Methods like interpolation/extrapolation makes it, i think. I will read your example of extrapolation. But, summarizing, how can i solve "opponent is behind" problem? I mean, what's the problem in my code extraction? The problem is that i'm using interpolation instead of extrapolation? To be honest, i'm trying to understand the difference between interpolation and extrapolation. What i'm doing is: Opponent's car is in position A and my client received a new position for the opponent's car, called position B. Then, in the client, i'm moving opponent's car from point A to point B in small steps, for avoid the "lag", because if i jump from point A to point B it will not be fluid. I mean, it will have lag. That's what i'm doing. Why have I "opponent is behind" problem? Because due to i'm jump in small steps instead of jump in only 1 step, i'm delaying...
  3. raz0r007

    Interpolation problem in racing game

    Help? @hplus0603
  4. Hi, I'm developing a racing multiplayer realtime game in C++ with cocos2d-x and box2d. Also, i'm using Nakama for server-logic. The problem that i've is i'm seeing the opponent's car lagged despite of both clients and server are in localhost. I'm sure that the problem is mine, i mean, i'm not hiding correctly the lag in each client. This is what i'm doing: The game is working with 60 FPS (1/60 updates). ticks to the server are every 0.05 seg. I'm sending opponent's car updates every 1/10 (0.1) seconds to the server (x, y, angle). Also, i'm using interpolation method for predictions and for "hide" the lag: void Interpolator::update(float dt) { float difference = _remoteValue - _localValue; if (difference <= _threshold) _localValue = _remoteValue; else { float k = dt * _interpolation_constant; if (k > 1.f) k = 1.f; _localValue += difference * k; } } (In Game::update i'm calling Inteporlator::update and after that i'm setting setPosition(localValue) with the localValue updated). _localValue is the current position of the opponent's car in my client. And _remoteValue is the last position that i received of the opponent's car. _threshould is a constant (0.1f). And _interpolation_constant is a constant that could be [1....60]. It means how many time i will delay for interpolate from position A (localValue) to position B (remoteValue). So, what's my problem? Currently, i think i have two “extremes”: Test 1) If i use _interpolation_constant = 1.0f Opponent’s car works fluid, but with lag. For example, if both cars are accelerating at the same velocity (same position Y in both cars), in my iPhone i see opponent’s car behind of my car, despite of both cars are in the same Y position. That i mean with “lag”. But opponent’s car works fluid. It seems that it hasn’t lag, but it have lag. It’s fluid because i’m dividing difference in 60 parts (k = 1/60). So, because of i’ve a lot of “parts”, each setPosition is small. I mean, small jumps. Why i see the opponent’s car with lag? because each 1/10 updates i’m delaying 1 second until remoteValue = localValue. Is too much 1 second. So, my car is in the “present” and the opponent’s car is in the “past”. Test 2) If i use _interpolation_constant = 10.0f Opponent’s car works without lag, but not fluid. For example, if both cars are accelerating at the same velocity (same position Y in both cars), in my iPhone i see both cars in the same position Y, that’s good. But opponent’s car isn’t fluid. It’s NOT fluid because i’m dividing difference in 6 parts: k = 1/60 * 10 . So, i’ve few parts. Each setPosition is more big. I mean, big jumps. Why i see the opponent’s car without lag? because each 1/10 updates i’m delaying 0,1 seconds until remoteValue = localValue. Is the same time that i receives updates. The question is, how to solve this problem? I can't make it work properly. P.S.: Box2d / physics logic is in each client (i mean, in my car). And about the opponent's car: for move it i'm using only setPosition, without physics, trying to make it work with interpolation method.
  5. raz0r007

    Cocos2d-x work

    Hi, I'm a cocos2d-x c++ developer. I published some games on App Store and Google Play, so, i've portfolio. However, since some days i'm searching cocos2d-x developer jobs, but it's hard. I mean, most companies search Unity developers instead of cocos2d-x developers, however i'm in love with cocos2d-x and i'm sure that some company in the world are using this framework !. So, my question is, does anyone know some company that uses cocos2d-x c++ for develop 2d games nowadays (2019)? I would apply. Thanks :)
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!