• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
maunovaha

How to avoid TCP bursting data over WebSocket ?

4 posts in this topic

Hi,
 
I am currently trying to simulate varying network connection conditions locally so that I could see how does interpolation works when developed, which sort of led me to this question.
 
As a background, I tried to use dummynet first but I got frustrated with installation process and got it working only partially (on windows 7). It froze my machine once and my normal internet connection stopped working after a while tongue.png  .. So I ended up using tool called "clumsy" (http://jagt.github.io/clumsy/) which seems to be ok-ish. I tested how does setting latency to 2000ms works and pinging google.. works as expected.
 
However, the actual problem I am facing is when using node.js servel locally and trying to use that same 2000ms for testing.
 
My current server sends every 100ms packet to client which is marked with Date.now() (as current ms). At client I print results to console, which seems to be as following (clumsy is not activated, normal conditions):
from server to client (ms): 113 last packet processed (ms ago): 113 
from server to client (ms): 128 last packet processed (ms ago): 110
from server to client (ms): 144 last packet processed (ms ago): 108
from server to client (ms): 157 last packet processed (ms ago): 107 

Printing it with this: (where result.net.now is the Date.now() at server packet)

 

console.log("from server to client (ms): " + (Date.now() - result.net.now) +
          " last packet processed (ms ago): " + (Date.now() - this.prevTime));

this.prevTime = Date.now();

 

This looks OK, from server to client e.g. 113 ms and last packet processed 133ms ago
 
However, when I activate the tool to use 2000ms lag with this configuration: (using Outbound only which results that sending to server and sending to client, both sides is having this 2000ms lag) 
 
tcp and outbound and ip.DstAddr >= 127.0.0.1 and ip.DstAddr <= 127.255.255.255

..and then starts to happen some interesting issues, it logs this at client side (same for server tbh):

 

from server to client (ms): 2068 last packet processed (ms ago): 119
from server to client (ms): 2053 last packet processed (ms ago): 80
from server to client (ms): 2081 last packet processed (ms ago): 120
from server to client (ms): 2109 last packet processed (ms ago): 122

It seems that e.g. 2068 seems to be OK but ms ago is not? My character can move every 100ms (btw).

 

If I watch how it behaves it seems for me that its bursting packets at once at both sides of the connection.

 

To my eyes it looks like that client/server sides first waits 2000ms and then every 100ms it shows what has happened because then it actually received the packet.

 

I dont know if this is because of TCP or because the tool is not working? Or my codes is not working, bad configs for node.js? Does anyone have any opinions on this, am I missing something relevant or doing something completely wrong with the tool.

 

I though that following would have happened: If 4 packets are sent, every 2000ms one packet is received?

 

Edited by maunovaha
0

Share this post


Link to post
Share on other sites
Have you turned off Nagle (TCP_NODELAY)?

Also, it's very hard to understand what piece in your network stack may be changing the behavior. To make sure you're not seeing locally induced problems (scheduling, etc) it's always best to put the client on a separate physical machine from the server. And, ideally a machine that has highly configurable networking built-in, such as Linux or BSD, so that applying network filters etc is well documented, not using "third party" tools of undetermined mechanism.
0

Share this post


Link to post
Share on other sites

Have you turned off Nagle (TCP_NODELAY)?

Also, it's very hard to understand what piece in your network stack may be changing the behavior. To make sure you're not seeing locally induced problems (scheduling, etc) it's always best to put the client on a separate physical machine from the server. And, ideally a machine that has highly configurable networking built-in, such as Linux or BSD, so that applying network filters etc is well documented, not using "third party" tools of undetermined mechanism.

 

Thnx for the reply, I have plans to push it to places such as amazon or heroku but configs not quite there yet, could also introduce too much new problems at this stage. Trying to do this locally thats why.. at least for now :) . TCP_NODELAY, should be turned off by default with node, according to docs:

 

http://nodejs.org/api/net.html#net_socket_setnodelay_nodelay

 

The thing is, that it wont burst if tool is not activated, or maybe everything is too fast to notice it.. I doubt it actually.

0

Share this post


Link to post
Share on other sites
So it sounds like the tool is introducing the burstiness.

Do you have a second machine to use as the server while developing? An old laptop or desktop can typically easily run Linux or BSD and would in my experience give you better networking tools.
0

Share this post


Link to post
Share on other sites

So it sounds like the tool is introducing the burstiness.

Do you have a second machine to use as the server while developing? An old laptop or desktop can typically easily run Linux or BSD and would in my experience give you better networking tools.

 

Not right now sad.png I guess I need to find some alternative tool for win 7 in order to validate that its not a tool specific issue.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0