2
\$\begingroup\$

I'm wondering if this is possible and what obstacles I might face.

I have a game that's browser based, and since I can't send UDP packets from a browser, Can I use a plugin that the browser connects to via a web socket, and have that plugin send the UDP messages?

When the plugin receives a UDP packet, it'll then relay it to the browser via the TCP websocket?

Could this work? And can TCP handle tons of messages from the plugin even though it's connecting to 127.0.0.1? At least 64 players in this game. The UDP packets are usually no more than 40 bytes.

\$\endgroup\$
2
  • \$\begingroup\$ There is websockify which acts as a websocket-to-TCP bridge. But I don't know about one which does the same for UDP. \$\endgroup\$
    – Philipp
    Commented Feb 10, 2013 at 13:42
  • \$\begingroup\$ I'll be using c# to create the udp server/listener and the local wss server. I'm jst curious if this architecture would work. \$\endgroup\$
    – Taurian
    Commented Feb 10, 2013 at 16:38

1 Answer 1

1
\$\begingroup\$

Performance advantages of UDP over TCP is very case dependant based on your specific needs (delivery persistence, order, frequency), in most cases in fact people implement many mechanics to make UDP as reliable so at the end it performs same as TCP.

Plugin can actually can create JS interface to use UDP communication directly without need to create local WS server socket. But implementing such plugin will be an overkill in terms of game development.

You have another option in modern browsers: WebRTC which is made for performance over quality, and that can be used for peer-to-peer communication so that players can talk to each other directly but not through the server.

64 players is a lot, and do not try to find "easy solutions" there will be none. You will have to think of "visibility" of clients between each other based on your gameplay, as well you need to think how to simulate 64 players - this is not easy as well, and probably will be hardest bit.

BTW, you might be OK using WebSockets as well, depends on how often you want to send data and how much. Take in account that if you think that it is to hard for WS, maybe you want to much regardless of tech?

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .