Note that there are some explanatory texts on larger screens.

plurals
  1. POrealtime communication with ruby
    primarykey
    data
    text
    <p>I'm about to write a game server with ruby. One feature of the game includes player walking around &amp; others should be able to see it.</p> <p>I've already written a pure socket demo using event machine. But since most of the communication are going to be http-based, so I'm looking for some http polling solution. And of course I could write it with event machine, but is there any gem out there for this kind of job already?</p> <p>I've tried something like faye, but most of these are for a messaging system, like subscribing &amp; publish to a channel, I seem not to be able to control what clients I should push to. In my case I need to be able to push to specific clients, like one guy moves from 10,10 to 20,20, only those around him (maybe from 0,0 to 30,30, but not a guy at 40,50) need to receive the message.</p> <p>------------pregress with cramp</p> <p>Here's a quick update. I'm working on cramp, with 5000 connections, and 100 client move each second, the CPU usage is almost 100%. When I double both figures, the CPU usage is still 100% or so, and the response is very slow.</p> <p>Clearly I'm not using every resource I had, instead there's only one CPU core occupied. Need more work on it.</p> <p>------------Node.js's turn</p> <p>@aam1r Actually Node.js is doing better than cramp. With 5000 connections and 100 client moving per seoncd, the Cpu usage is over 60%. When I doubled to 10000 connections and 200 client moving per second, the CPU usage is 100% and response is becoming slow. Same problem here, either cramp or Node.js can only use one cpu core per process. That's a problem. </p> <p>------------What about JRuby?</p> <p>Because of the presence of <a href="http://en.wikipedia.org/wiki/Global_Interpreter_Lock" rel="nofollow">GIL</a>, there's no true multi-thread simultanious execution with Ruby MRI. None with Node.js either.So I'm going to give JRuby a try.</p> <ul> <li><p>When a client moves, use another thread to find all the other clients need to notify(which is a CPU-heavy work). Then push the result to a channel.</p></li> <li><p>The main thread simply subscribes the channel. When it gets the result, push them to the clients.</p></li> </ul> <p>Need some time to write a demo though.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload