Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

806 Good

About gfxgangsta

  • Rank
  1. The reason you're getting out of bounds is because "num" is 1. And you're creating an array of size 1. But then you're trying to access the array at index 1 (and arrays are zero-based).
  2. Looking at the inner loop, you have   for(j = 1; i < col; j++)   I think you want "j < col" instead.   Also, you don't seem to recompute "num" inside the loop... it'll always have the same value. But you are recreating your array every time inside the loop which is incorrect....
  3. 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:
  4. gfxgangsta

    Planetary Annihilation networking

      Thanks for shedding some light into this. I guess that makes sense... if the client gets too far ahead of the server values, that's when you could start seeing strange behavior or harsh corrections.   For question 4, then I guess stopping could happen naturally when you've reached the endpoint of your curve (or the "not too far ahead" point).
  5. 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.
  6. gfxgangsta

    Game server frame rate

    hplus0603, thanks for that first detailed reply. It helps me a ton.   At some point, I won't be able to bring down my "upper limit" anymore. So, assuming a frame rate value that works without tunneling (i.e. 30Hz)... there will come a time when my server won't be able to handle more clients because I won't be able to guarantee each frame takes 1/30s. That's when I would need to add servers, correct?
  7. gfxgangsta

    Game server frame rate

    The game is very simple at this stage (and will probably remain simple). The player clicks to go somewhere, so it's given a velocity, and the simulation step on the server computes their position at the current time. Then, 10 or 20 times per second, the server sends the client its new position, and the position of other clients. The client can do prediction by checking the last few positions to compute a velocity estimate, or by using the last received velocity value(s) (if sent).   So, assuming that the server ticks as fast as it can (with an upper limit)... I can make that upper limit as low as possible (as long as I'm not "seeing" tunneling or other artifacts on the server, it should be fine), right?   Because clients will tick as fast as they can (and therefore, process packets at different times), they will see different things. But if the difference in latency between the different clients is not too far off, then it shouldn't be a big deal (depending on the game), right?
  8. 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?
  9. 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.   Thanks!
  10. gfxgangsta

    Difference between bandwidth measurements

      Agreed, so that's what I think I'm seeing... 1 to 1.5 seconds of round-trip latency on every request. If the browser is using a cached copy, I would expect to see much lower latency (0ms pretty much).
  11. gfxgangsta

    Difference between bandwidth measurements

    Thanks for your reply. I had turned off the phone's wifi when doing the tests (unless the iPhone overrides this when a known connection is available). I'll try the datetime variable in the URL, however, I would think the round-trip time (as measured in javascript) would be much lower if the browser cached the requests.
  12. 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).
  13. gfxgangsta

    Render queue design decision

    Why did you have the RenderTokens as a vector in the RenderableComponent? Maybe I misunderstood, but wouldn't one instance of a RenderableComponent just contain one RenderToken, since it won't have multiple materials at the same time?
  14. Thank you for this opportunity sandyp!   I am interested in reviewing this book for a number of reasons. I am mainly a gameplay programmer, but I have a strong interest in graphics programming. I've implemented a few shaders before, like the Phong model and very basic shadow mapping. I'm looking to use a book to hone my skills and be able to understand topics such as global illumination and post-processing.
  15. gfxgangsta

    Light doesn't work without bump map

    3 suggestions:   1. Even though you know the mesh has normals, check that the normals are passed all the way from your Direct3D code (C/C++?) to the shader where you're doing the lighting (HLSL). Does your vertex declaration include a normal? If you're doing per pixel lighting, perhaps the normal is available in the vertex shader, but it's not being passed to the pixel shader? 2. You can use PIX to debug graphics issues (just google "pix debug tutorial") 3. Post the full shader code here
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!