Game servers: UDP vs TCP by Christoffer Lernö, an article by Christoffer Lernö can be found at http://1024monkeys.wordpress.com/2014/04/01/game-servers-udp-vs-tcp/Why UDP is “hard”
Topics:
- Background
- What TCP means in practice
- Why UDP is “hard”
- The flawed case for TCP
- When TCP doesn’t work
- Myth: Reliable UDP is TCP implemented poorly
- The bottom line:
So UDP or TCP?
Use HTTP/HTTPS over TCP if you are making occasional, client-initiated stateless queries and an occasional delay is ok.
Use persistent plain TCP sockets if both client and server independently send packets but an occasional delay is ok (e.g. Online Poker, many MMOs).
Use UDP if both client and server may independently send packets and occasional lag is not ok (e.g. Most multiplayer action games, some MMOs)
These are mixable too: Your MMO client might first use HTTP to get the latest updates, then connect to the game servers using UDP.
Never be afraid of using the best tool for a task.
Computers & Life. Giving you as much crap as possible. Good, useful crap. «somahovering, soma-hover-ing, the act body hovering»
Showing posts with label Programação. Show all posts
Showing posts with label Programação. Show all posts
Wednesday, April 23, 2014
Thursday, August 1, 2013
Basics of Function Pointers in C
A good article about Basics of Function Pointers in C by Dennis Kubes can be found in his website denniskubes.com
"This post is very detailed because I am attempting to create a mental model to help beginners understand the syntax and basics of function pointers. If you are ok with detail happy reading.
Function pointers are an interesting and powerful tool but their syntax can be a little confusing. This post will going into C function pointers from the basics to simple usage to some quirks about function names and addresses. In the end it will give you an easy way to think about function pointers so their usage is more clear."
... in which I found a link to Steve Friedl's Unixwiz.net Tech Tips - Reading C type declarations
"This post is very detailed because I am attempting to create a mental model to help beginners understand the syntax and basics of function pointers. If you are ok with detail happy reading.
Function pointers are an interesting and powerful tool but their syntax can be a little confusing. This post will going into C function pointers from the basics to simple usage to some quirks about function names and addresses. In the end it will give you an easy way to think about function pointers so their usage is more clear."
... in which I found a link to Steve Friedl's Unixwiz.net Tech Tips - Reading C type declarations
Why there is no Hitchhiker’s Guide to Mathematics for Programmers ?
Good article at jeremykun.com
Why there is no Hitchhiker’s Guide to Mathematics for Programmers ?
Remember when you first learned how to program? I do. I spent two years experimenting with Java programs on my own in high school. Those two years collectively contain the worst and most embarrassing code I have ever written. My programs absolutely reeked of programming no-nos. Hundred-line functions and even thousand-line classes, magic numbers, unreachable blocks of code, ridiculous code comments, a complete disregard for sensible object orientation, negligence of nearly all logic, and type-coercion that would make your skin crawl. I committed every naive mistake in the book, and for all my obvious shortcomings I considered myself a hot-shot programmer! At least I was learning a lot, and I was a hot-shot programmer in a crowd of high-school students interested in game programming.
http://jeremykun.com/2013/02/08/why-there-is-no-hitchhikers-guide-to-mathematics-for-programmers/
Why there is no Hitchhiker’s Guide to Mathematics for Programmers ?
Remember when you first learned how to program? I do. I spent two years experimenting with Java programs on my own in high school. Those two years collectively contain the worst and most embarrassing code I have ever written. My programs absolutely reeked of programming no-nos. Hundred-line functions and even thousand-line classes, magic numbers, unreachable blocks of code, ridiculous code comments, a complete disregard for sensible object orientation, negligence of nearly all logic, and type-coercion that would make your skin crawl. I committed every naive mistake in the book, and for all my obvious shortcomings I considered myself a hot-shot programmer! At least I was learning a lot, and I was a hot-shot programmer in a crowd of high-school students interested in game programming.
http://jeremykun.com/2013/02/08/why-there-is-no-hitchhikers-guide-to-mathematics-for-programmers/
Labels:
Matemática,
math,
mathematics,
Programação,
Programming
Thursday, August 23, 2012
Javascript break out of frames script
Javascript break out of frames script.
A simple way to break out of frames on page load.
<script type="text/javascript">
if (top != self)
top.location = self.location;
</script>
A simple way to break out of frames on page load.
<script type="text/javascript">
if (top != self)
top.location = self.location;
</script>
Friday, August 10, 2012
C function for getting user input
C function for getting user input.
Reads up to uinput-1 characters from stdin to uinput, removes \n adn adds \0.
Returns number of characters of uinput.
int getUserInput(char *uinput, int size){
size_t last;
fgets(uinput, size, stdin);
if (strlen(uinput) > 0){
last = strlen(uinput) - 1;
if (uinput[last] == '\n'){ //if last char is \n replace with \0
uinput[last] = '\0';
} else {
//no \n in buffer, discard additional characters.
fscanf (stdin, "%*[^\n]");
(void) fgetc (stdin); // discard \n
}
}
return strlen(uinput);
}
Subscribe to:
Posts (Atom)