Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 06 Dec 2011
Offline Last Active Yesterday, 11:50 AM

Topics I've Started

Implementing pathfinding... server or client?

16 December 2014 - 11:46 AM

There's a server/client RTS engine called ORTS. In one of their documents, "On the Development of a Free RTS Engine", they mention basic gameplay tasks, like pathfinding, are implemented client-side ("Low Level AI Components" section of the document linked below).


This sounds like a good idea because it offloads pathfinding (a potentially expensive task) to the client, leaving the server free to take care of other tasks. However, wouldn't this give an unfair advantage to clients with a faster CPU?


One option is to force pathfinding to take a max number of frames on all clients. But wouldn't this take away part of the advantage of using a server/client architecture (not waiting on the slowest client)?


ORTS doc: https://webdocs.cs.ualberta.ca/~furtak/pub/ORTS-GAMEON_NA_05.pdf

Planetary Annihilation networking

09 December 2014 - 11:01 AM

I recently came across Forrest Smith's excellent blog post:
It definitely goes into some of the networking concepts/algorithms/formats they used for the game. But some aspects weren't immediately clear to me. I was wondering if someone could provide some additional insight.
1. They mention the server ticks at 10fps. Do they mean that network updates are sent 10 times per second, or do they mean the server simulation loop runs at 10fps (and the network update is coupled with it)?
2. I think the concept of "curves" is pretty cool... when applied to positions for example, they only send *new* keyframes and avoid sending redundant data. However, after reading I wasn't sure if they generate new keyframes at 10fps too, or if they have a different rate for generating those. I know special events like collisions can also generate keyframes, but I didn't understand if keyframe creation was generally done on each iteration of the game loop.
3. How does a client smoothly go from one position to the next? The server generates keyframes, but by the time the client receives them, they're old. Let's say the last packet on the client was generated by the server at t = 0.5 and received at t = 0.6. When the client's game loop runs, t = 0.67. How does the client compute the position at 0.67? Is it just extrapolating using the line equation (where the "true" line segment is from t = 0.4 to t = 0.5)?
4. What if a unit stops? Based on the client's keyframes, the unit would continue to move. I'm thinking they can send at most one redundant keyframe (so the curve is now a line with two identical y-values), or they could send a "stop" pulse curve (one of those immediate events they talk about). Thoughts?
5. Speaking of pulse curves (instantaneous events), it seems like the client would just receive N of these during a server update, and process all of them on the next tick (because they're instantaneous on the server, but they're already old when they're received on the client). Or, is the server somehow generating these in advance? For example, when a unit will fire, the server knows that the unit fires two shots, so it can send both shot events right away. But the first shot would still be old, wouldn't it? And, depending on lag & the time between shots, the second one might be old too.
6. Based on the previous "shooting" example, how would health be in sync with the attack? If health is a separate curve, the health packets and the shot packets might reach the client at different times (or, if the client plays the shot animation but has already received the health keyframe)... this means health number and visual attack won't be in sync. Would they wait and send the health keyframe along with the attack keyframe? Or, would they send both in advance, and the client is responsible for "playing" them at the same time?
The original post is great, I'm just fairly new to networking (but fascinated by it) and would appreciate any help in making more sense out of this.

Game server frame rate

29 October 2014 - 09:03 AM

I've read on this forum that generally, you want to send network updates about 10 or 20 times per second to clients (for an action game?). But what about the frame rate on the server itself? Should the simulation run at 60 Hz, 30 Hz, or something else?

Dealing with latency in Farmville-type game

05 February 2014 - 12:27 PM

How would you deal with latency in a Farmville-type game? Specifically -> if you have farm land that produces items like grapes (every 60 seconds), and you have a visual timer on the client that starts at 60 seconds and counts down to 0 seconds... how do you make it so the client and server match up? I'm thinking the client can probably get to -1 or -2 seconds or so before the server tells the client the grapes are ready. Even if you keep displaying "0 seconds" on the client, people will know that it took an extra 1 or 2 seconds for the grapes to be ready.


My thoughts:
1. Trust the client (if the client is collecting grapes, they are ready even if the server doesn't think they are). I don't think this is a good idea. A hacked client could collect grapes whenever they wanted to.
2. The server sends the "grapes are available" message a few seconds ahead, but the client still waits for the full countdown to allow grape collection. This is better than #1, but a hacked client could still collect faster than a normal client.
3. Focus on reducing latency
I'm thinking a combination of #2 and #3 is the way to go, but please provide your insights.

Difference between bandwidth measurements

10 December 2013 - 12:17 PM

I created a simple test in HTML/JS, that loads a URL via AJAX. The server's reply is a hardcoded JSON string that is 10MB in size. The test loads the same URL in sequence, 100 times, for a total of 1000MB. On my phone, the test takes about 150 seconds, which means I can download at a rate of 6.67MB/sec. The round-trip time for each AJAX request is about 1000-1500 ms. However, when I use the Ookla internet speed test app, it reports 0.3mbps, or 0.0374MB/sec.


Am I thinking about this in the wrong way? The client is accessing a server-side script, so AFAIK it can't be cached (and the round-trip time makes me think it *is* transferring the entire JSON response every single time).