Hacker Newsnew | past | comments | ask | show | jobs | submit | getkey's commentslogin

When a game server connects to the master to be registered, what the master gets is the the IP address relatively to it. If this address happens to be accessible from a client, everything's fine. However in some cases, it is not. For example in the case described where 127.0.0.1 is the game server's address (relatively to the master), if the master sent the address 127.0.0.1 to a client, it wouldn't connect. So we need to find out the public IP address in some cases, but sometimes it is better to use the local IP address (for example if the master, the game server and a client are on the same network and the client is not allowed to access the internet).

So basically finding out which IP address the master must send to the client is a huge pain. WebRTC does it automatically (to traverse NATs).


Do you adapt the amount of data sent based on the bandwidth? If so, how?

To me the best way to do this involve knowing how often the TCP socket is doing retransmissions, which is an information typically not available at the WebSocket level.


I don't at all. But the game sends very little data (I think Agar.io does an average of 4 KB/s from server to client).


Okay. And do you send positions of all players or only those that are visible?


Only visible and only what changed


On Node.js you have https://github.com/js-platform/node-webrtc and https://github.com/vmolsa/webrtc-native which are a bit unstable, or https://github.com/mappum/electron-webrtc which works fine but requires running an Electron process.


I noticed that when you search on Google for example "why are the french so", the suggestions you get are pretty much… stereotypes. So basically the websites asks google for "why are the <insert nationality> so" and "why are <insert nationality> so", filters results, then send them to your browser that displays them on the map.

Also, the website is open source, and here is the code: https://github.com/getkey/stereotype-map

P.S: I'm a student looking for an internship in web development, please send me a mail if interested! (it's in my bio) :-)


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: