# 2D display in Rails

**URL:** <https://www.ruby-forum.com/t/2d-display-in-rails/96526>\
**Category:** Rails\
**Created:** [June 29, 2006, 7:56am UTC](https://www.ruby-forum.com/t/2d-display-in-rails/96526 "2006-06-29T07:56:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![joe-dumoulin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9dc877/32.png) [@joe-dumoulin](https://www.ruby-forum.com/u/joe-dumoulin)\
**Post date:** [June 29, 2006, 7:56am UTC](https://www.ruby-forum.com/t/2d-display-in-rails/96526/1 "2006-06-29T07:56:12Z")

</div>

Hi,

Imagine you have a program that contains information on an entity  
called a Player. There can be lots of Players, say a thousand of  
them. Players have 20 or so attributes, two of them are an X and Y  
position. The Players’ attributes are updated many times per second.

Now imagine you need to create a web app that shows a 2D overhead  
display of the all the Players. A grid should be drawn over the  
Players (representing latitude, or feet from the origin, or  
something). The web app’s user can zoom in and out and can move  
around in the world. The user should also be able to select a Player  
and view its information.

Would Rails be a good choice for such an application? Or would you  
want to use Flash? Or something else? If Rails, I’m thinking  
something similar to how Google Maps works.

Joe

---

<div class="post-metadata">

**Author:** ![joe-dumoulin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9dc877/32.png) [@joe-dumoulin](https://www.ruby-forum.com/u/joe-dumoulin)\
**Post date:** [June 29, 2006, 7:56am UTC](https://www.ruby-forum.com/t/2d-display-in-rails/96526/2 "2006-06-29T07:56:23Z")

</div>

On 6/28/06, Joe Van D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> something). The web app’s user can zoom in and out and can move  
> around in the world. The user should also be able to select a Player  
> and view its information.
> 
> Would Rails be a good choice for such an application? Or would you  
> want to use Flash? Or something else? If Rails, I’m thinking  
> something similar to how Google Maps works.

Oh, also the display should be updated once every 2-5 seconds or so.  
The Players should move around on the overhead display.

---

<div class="post-metadata">

**Author:** ![joe-dumoulin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9dc877/32.png) [@joe-dumoulin](https://www.ruby-forum.com/u/joe-dumoulin)\
**Post date:** [June 29, 2006, 8:17am UTC](https://www.ruby-forum.com/t/2d-display-in-rails/96526/3 "2006-06-29T08:17:51Z")

</div>

On Wed Jun 28, 2006 at 10:53:03PM -0700, Joe Van D. wrote:

> something). The web app’s user can zoom in and out and can move  
> around in the world. The user should also be able to select a Player  
> and view its information.
> 
> Would Rails be a good choice for such an application? Or would you  
> want to use Flash?

i’d proably use TkPath (or GlimR in a few weeks). unless the requirement  
was run in a browser, then the widget or even plain divs…

---

<div class="post-metadata">

**Author:** ![joe-dumoulin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9dc877/32.png) [@joe-dumoulin](https://www.ruby-forum.com/u/joe-dumoulin)\
**Post date:** [June 29, 2006, 8:21am UTC](https://www.ruby-forum.com/t/2d-display-in-rails/96526/4 "2006-06-29T08:21:00Z")

</div>

On 6/28/06, carmen [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > Players (representing latitude, or feet from the origin, or  
> > something). The web app’s user can zoom in and out and can move  
> > around in the world. The user should also be able to select a Player  
> > and view its information.
> > 
> > Would Rails be a good choice for such an application? Or would you  
> > want to use Flash?
> 
> i’d proably use TkPath (or GlimR in a few weeks). unless the requirement was run in a browser, then the widget or even plain divs…

Yeah – it should be in a web browser (IE 6 or Firefox 1.0 - 1.5).

---

<div class="post-metadata">

**Author:** ![joe-dumoulin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9dc877/32.png) [@joe-dumoulin](https://www.ruby-forum.com/u/joe-dumoulin)\
**Post date:** [June 29, 2006, 9:03am UTC](https://www.ruby-forum.com/t/2d-display-in-rails/96526/5 "2006-06-29T09:03:59Z")

</div>

Joe Van D. wrote:

> Would Rails be a good choice for such an application? Or would you  
> want to use Flash? Or something else? If Rails, I’m thinking  
> something similar to how Google Maps works.  
> I think your difficulty in this would be the client-server nature of a  
> web browser / server relationship. If you code properly, you could  
> probably do it with a combination of Rails and AJAX. If you have to  
> update all of the information in 2-5 second intervals, your primary  
> concern is going to be round-tripping the communication. You may be  
> able to break it up into more frequent calls of a smaller number of  
> objects (though I doubt data transfer is going to be the main issue).  
> Even on a quick broadband connection to a quick server, a page load  
> round-trip will be within the timeframe you’re looking at.

Worst case scenario, try it…it should take a little less than a  
weekend to mock it up in Rails. If it looks good, then refactor the  
sucker and make it production code. 🙂

-Curtis

---

<div class="post-metadata">

**Author:** ![joe-dumoulin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9dc877/32.png) [@joe-dumoulin](https://www.ruby-forum.com/u/joe-dumoulin)\
**Post date:** [June 29, 2006, 7:23pm UTC](https://www.ruby-forum.com/t/2d-display-in-rails/96526/6 "2006-06-29T19:23:29Z")

</div>

On 29-jun-2006, at 8:18, Joe Van D. wrote:

> > > Would Rails be a good choice for such an application? Or would you  
> > > want to use Flash?
> > 
> > i’d proably use TkPath (or GlimR in a few weeks). unless the  
> > requirement was run in a browser, then the widget or even  
> > plain divs…
> 
> Yeah – it should be in a web browser (IE 6 or Firefox 1.0 - 1.5).

Flash + XML messaging without polling. Otherwise requests with 2-5  
second delay might swamp the server (but what You will employ on the  
server depends on  
how much concurrency you will be handling).

From Rails you can trivially message the Flash movie with xml  
packets in the style of:

and then parse it on the Flash side and move the elements.

–  
Julian ‘Julik’ Tarkhanov  
please send all personal mail to  
me at julik.nl
