Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Help! How to implement accurate attack in client-server RPG?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 jxwnhj0717   Members   -  Reputation: 110

Like
0Likes
Like

Posted 02 November 2012 - 09:37 PM

I am planning to develop client-server RPG, but I get stuck in accurate attack. Think about under situation:
1. Player1 at position A in server.
2. After 100ms, Player2 see Player1 at position A, but Player1 moved to position B in server side.
3. Player2 attacks Palyer1 at position A.
4. After 100ms again. Server receives attack packet, But Player2 moved to position C, if Player2 attacks Player1 at current position C, the hit will always miss.

I need estimate attack time:
Command Execution Time = Current Server Time - Packet Latency - Client View Interpolation
This formula from:
https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking#Lag_compensation


But how can I get Packet Latency and Client View Interpolation?
I read the unity network demo of TPS-Auth. I think Client View Interpolation should be equal to fixed time + Client Latency.( GraduallyUpdateState.cs m_InterpolationBackTime property)

Sponsor:

#2 hplus0603   Moderators   -  Reputation: 5723

Like
0Likes
Like

Posted 03 November 2012 - 10:31 AM

When you have such small timespans, your game really works like an FPS or fighter game. You should look at the Valve/Source networking article to see one approach, which involves placing the attacked player "back in time" to the time of the attack to see whether the attacker hit or not. Another option, described in the "GGPO / Fight the Lag" article in a recent Game Developer magazine, is to hide the attack latency in the wind-up animation -- basically, you play the wind-up on the attacking player's machine, but not on the attacked player's machine (or at least you drop the part that started before the packet got there.) This works well when the attack animation is "fixed" and can't be controlled once started.

A third option is to realize that 100 milliseconds is really hard to tell for most players -- it's a very small amount of time! You can show the attack on the attacking player's machine, but you only need to show the "hit or miss" after you get the data back from the server on how it went. Many FPS-es do this by showing guns firing right away, but showing blood spurts or whatever from the target only after the server has sent a hit-detect message back.


enum Bool { True, False, FileNotFound };




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS