Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question
    
There is websockify which acts as a websocket-to-TCP bridge. But I don't know about one which does the same for UDP. –  Philipp Feb 10 '13 at 13:42
    
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. –  Taurian Feb 10 '13 at 16:38

1 Answer 1

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?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.