Jump to content

  • Log In with Google      Sign In   
  • Create Account


Paulus_newbieus

Member Since 04 Aug 2002
Offline Last Active Nov 18 2012 04:11 PM

Posts I've Made

In Topic: Dealing with websocket message overload on client

20 August 2012 - 03:32 PM

Thanks for the help guys. You were correct - by turning off the Nagle algorithm, my jitter completely vanished!

For interest of other readers, in .Net this is possible by toggling the NoDelay property to true (by default its false) on the System.Net.Sockets.Socket class.

I believe this change will soon be integrated into the Fleck library by the project developer.

Cheers

In Topic: Dealing with websocket message overload on client

19 August 2012 - 08:58 AM

OK, interesting. I cant see any obvious way to disable Nagle (never heard of it) or how to turn off delayed-ACK. I don't suppose you guys could point me to a good source of on-line explanation for these things?

I do broadcast a single message to all my client connections once every 25 milliseconds, and I do actually already attach a time stamp to the message - I use this to work out the rate to animate (linear interpolation). So even though I have the time stamp, It's not yet clear to me how I can use this to re-arrange my packets. At the moment, positions are just drawn straight away. Should I be buffering the updates, re-arrange them depending on time stamps, and then draw them? This feels like yet more lag time.

Appreciate the help guys!

In Topic: Dealing with websocket message overload on client

19 August 2012 - 04:14 AM

Aaah! Of course, why not, this sounds extremely likely. I must admit I was expecting them to arrive in the correct order. Running this simulation locally (debugging on my PC) with server local) I do not get this issue, so I did not consider the ordering to be different.

I am using Fleck:
https://github.com/statianzo/Fleck

I am just using it in its default set-up - I have not done any tweaking or tuning whatsoever, just running it out the box.

In Topic: Seeding a pseudo-randomly generated game map

26 October 2011 - 03:51 AM

You should try to find some material on bit manipulations in C or C++ somewhere else, for a more complete understanding.

Let's analyze the expression ((x << 16) + y).

(x << 16) means "take the value of x and shift it 16 bits to the left", or equivalently "multiply x by 65,536". This means that (1, 65536) and (2, 0) map to the same number. I don't know if this is acceptable to you, but my guess is that it's fine. The magic constant I used is simply a random odd 64-bit number. You should use a random odd 32-bit number if you are using 32-bit arithmetic. The advantage of using a large random number instead of 65,536 here is that you can generalize the procedure to hash more information into the seed like this:

unsigned long seed = x;
 seed = seed * 10366439865051156459ul + y;
 seed = seed * 10366439865051156459ul + z;
 seed = seed * 10366439865051156459ul + w;
 // ...


If you were to do that by shifting alone, the information about x would eventually get lost in overflow.

There are situations where you need to hash information down to a single number and you need the result to look much more random (e.g., cryptographically signing a document), but I don't think you have to go crazy for your particular application.


Thanks, much appreciated guys.






In Topic: Seeding a pseudo-randomly generated game map

25 October 2011 - 05:50 AM


Thanks for suggestions guys.


Int=(int)short << 16 & short2

???


So short is the x coord and short2 is the y. You are bit shifting the x by 16 and adding it to the y, to make it a unique single value? This is so the point {1;2} will not result in the same seed as {2;1}, am I right?

And alvaro, you are doing something similar.


I am doing something similar, but my code works. What Waterlimon posted has several issues. He probably meant to say `(short1 << 16) + short2' or `(short1 << 16) | short2'. With '&' you'll get 0. And you can't use `short' as a variable name.


Thanks for clarification and taking the time to help me out alvaro!

I actually come from a VB .Net programming background (*hangs head in shame*) so could you please clarify with the symbols what's going on with the bit shift and addition i.e. should it be adding the results?
Also, alvaro what's the 10366439865051156459ul signify, and how would that be better than a bit shift?

Many thanks!

PARTNERS