Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / Launching gosu from Ruby on Rails
- - By guerragiancarlo Date 2015-11-28 20:25
Hey everyone,

I'm new to the forum, but have been following https://leanpub.com/developing-games-with-ruby/read in order to get myself up and running with Gosu game development :) I stumbled upon another article, http://brettu.com/rails-ruby-tips-336-turn-rails-into-a-game-engine/ that claims that it is possible to launch Gosu from rails. When I tried it out in the rails console, I get a nasty stack trace along with a segmentation fault :( It also tells me that i've detected a bug in Rails and that I should report it.

Is the information in the second link misleading? Is there a way for a Gosu game to run from rails? Please help. Thanks!
Parent - By guerragiancarlo Date 2015-11-28 21:06
It turns out that it is possible! After a lot of tinkering around, I removed the 'spring' gem from my bundle install. Worked like a charm after that ;)
Parent - - By jlnr (dev) Date 2015-11-29 14:39
I don't understand the advantage of launching Gosu from a Rails project. If you are not running a web server, then why use Rails? If you just need all the niceties that ActiveSupport brings to Ruby's standard library, you can also require them in a plain Ruby/Gosu project:

require 'active_support'
require 'active_support/core_ext'
Parent - - By guerragiancarlo Date 2015-11-30 12:08
The purpose was not really about 'advantage' or 'disadvantage'. I'm fairly new to Ruby, and even newer to Ruby on Rails and Gosu, so i'm just trying out different things to get a feel for the language and the Gosu library.

Ideally, I'd like to do the following:

- Rails server starts
- User visits localhost:3000/play
- a view is rendered with a simple <button></button>
- when user clicks the <button>, Gosu game window opens and user can play game

And if that works:

- host the rails app(heroku or something)
- users visit http://games.herokuapp.com/play (this is a sample link. doesn't actually exist)
- same steps as above

I'm thinking that since all dependencies are already bundled in the rails app, visitors to the webpage wouldn't need to download any extra files for this to be possible. Anyway, I'm fairly new to all this so please excuse me if what I'm trying to achieve seems ridiculous or out of the question :P
Parent - By jlnr (dev) Date 2015-11-30 18:48
No, that won't work. The link can only launch a Gosu game on the server (where Gosu has been installed as a dependency), not on the client.
Running Ruby/Gosu in the web browser would require a port of Gosu to http://opalrb.org/, or you could try out the Dare project: https://www.libgosu.org/cgi-bin/mwf/topic_show.pl?tid=1164
(I am not sure what the progress is on the Dare project)
Up Topic Gosu / Gosu Exchange / Launching gosu from Ruby on Rails

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill