Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Showcase / GalaxyCraft - Beginners' Project
- - By ml Date 2013-02-16 22:19 Edited 2013-02-16 23:01
Hi everyone. Gosu is awesome!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    HOW TO PLAY GALAXY CRAFT:

Requires RubyGems with Gosu Gem. You could probably make it
work with C++, but I don't know how to do that.

To check out GalaxyCraft, simply clone:

    https://github.com/MattLemmon/g

into whatever folder, then go into the 'g' folder and type:

    $ ruby g5.rb

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    ABOUT THE GAME:

A more detailed description of the game is included in the README.
(https://github.com/MattLemmon/g/README.txt)

   

This game is a derivative work of the gosu tutorial spaceship game.

   

I am fairly new to programming and I am wondering if anyone can
point me in the right direction (perhaps a link?) to show me how
to create a welcome screen...

Or, even better, if you want feel free to create a welcome screen
yourself, and add it to the git with a pull request, or by sending
it to me, or however seems best.

Gosu is total awesomeness.

   

Also, on a side note, how many people have their games on github?
Are there other suggested games that I can check out to see how
the code works? I have successfully installed CtnRbyWithWallJump.
I will continue to search through this forum for other similar games.

   

Also, if anyone wants help creating artwork for their games, I am a
pretty good artist, and I am eager to participate. Just let me know.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    HOW TO BEAT GALAXY CRAFT:

        You win if you can help create a welcome screen.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    WINNERS' CIRCLE:

        Mike
        Jon

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Parent - - By Spooner Date 2013-02-16 23:12
The whole point of a version control system, like Git, is so you don't have to keep copies of all your old versions of the game (but still have access to them). You should just have a game.rb file and let git handle the old versions.

Otherwise, welcome to Gosu and have fun looking at other people's games here!

EDIT: Oh, it seems that each version of the game is quite different. You should, however, have modularised it rather than completely copied the whole code base into every file. Look at something like Gamebox or Chingu to help you manage things like different levels (scenes or game_states, respectively).
Parent - - By lol_o2 Date 2013-02-17 09:30
For game states etc. you could use my game template: https://github.com/KoBeWi/Sapphire
Choose it if you don't want additional gem to such stuff
Parent - By ml Date 2013-02-17 20:25
Wow I can't believe how quickly you have pointed me in the right direction!
These two posts will give me enough information to keep me busy for many
days!

Thank You!!!
Parent - - By ml Date 2013-02-18 02:11
UPDATE:

I have successfully installed Chingu, and also Texplay. I have run all the
Chingu examples, and now I am working my way through the code.

I was unable to run Sapphire.rb, because it requires 'gl' and 'glu'.

I already have the following ruby-opengl gems installed:
ruby-opengl (0.61.0, 0.60.0)
ruby-opengl2 (0.60.6)

But it looks like the one I need is (0.60.1).

I downloaded ruby-opengl-0.60.1 from this link, which I found in the
Bottomless Mine v.0.07 Discussion. But it looks like this link works for
Windows only. I am on Linux (Ubuntu).

I keep trying   $ gem install ruby-opengl --version 0.60.1
and I am running into the following error:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension
ERROR: 'rake/gempackagetask' is obsolete and no longer supported. Use 'rubygems/package_task' instead.
/home/matias/.rvm/gems/ruby-1.9.3-p362@sampleGemset/gems/ruby-opengl-0.60.1/Rakefile:24:in `<top (required)>'

I will keep trying. In the meantime, if anyone can tell me how to
include 'gl' and 'glu' on Linux, it would be greatly appreciated.

Perhaps I could manually change the Rakefile to say 'package_task'
instead of 'gempackagetask' and then somehow magically manually
install the gem with a local gem install?...
Parent - - By lol_o2 Date 2013-02-18 09:55
Edit Sapphire.rb and just remove lines that require Openg-GL and other gems you don't need, because they're especially for  .exe  file that works with no problems
BTW, I've read somewhere that it should be  gem install ruby-opengl --pre
Parent - - By BlueScope Date 2013-02-18 11:45 Edited 2013-02-19 13:01
'gem install ruby-opengl --pre' is correct. [EDIT: It actually should be 'gem install opengl --pre']

If you need anything else, this link has about everything you need to get opengl to work without hacks.
Parent - - By ml Date 2013-02-18 19:02
Thank you for all the useful assistance!

REGARDING RUBY-OPENGL-0.60.1:

I tried:
$ gem install ruby-opengl --pre

and it returned:
ERROR:  Could not find a valid gem 'ruby-opengl' (>= 0) in any repository
ERROR:  Possible alternatives: ruby-opengl

I am using rvm (could that be the problem?), and I have tried it on Ruby
versions 1.9.1, 1.9.2, and 1.9.3, always with similar results.

I also tried:
$ sudo apt-get install libGL

and it returned:
E: Unable to locate package libGL

I will re-read in the forum discussion from the link provided by BlueScope,
and keep tooling around with it, and I will post if I find anything noteworthy.

REGARDING SAPPHIRE:

I tried #-ing out the lines in Sapphire.rb which require 'gl', 'glu', and 'glut'.
Now I get the welcome message. However, when I type !help I get this error:

Error found:
No such file or directory - notepad /home/.../sapphire/documentation.txt

I checked to ensure that the documentation.txt file exists in its proper place,
and it is there. Not sure what is going on...

I am very interested in trying out Sapphire. At least now I'm halfway there...

I will keep trying...
Parent - By lol_o2 Date 2013-02-18 19:12
Sooo... if it is in correct directory, just open it from there (it's just a text file so there's no problem).
The Sapphire was meant to be only a single executable, but since not everybody is Windows, I gave a source. For people who have Ruby installed, only useful thing is The Template (and SciTE if using Windows).
And, in case you would post again with problem about template, run Sapphire.rb and type: !template your_game_name (with no spaces at name)
Parent - By Spooner Date 2013-02-19 00:36
It is: gem install opengl --pre
ruby-opengl is not the same as opengl

The only ruby-opengl version that works on Ruby 1.9 is not on Rubygems (but you can find it in this forum if you are desperate), but it makes more sense to use a published gem!
Parent - By ml Date 2013-02-19 02:41
Nice!!!!! I can finally use 'gl', 'glu', and 'glut'!!!!  Thanks Spooner!!!
Thus ends a two-day-long battle!!!

@lol_o2, thanks for the extra information. I am now reviewing the
documentation, and I have created a template project called 'example'
using Sapphire.rb.

With Sapphire I am still running into problems with loading other files,
similar to the issue I faced with '!help'. When I run my game, 'example.rb',
I get an error:

/home/.../.rvm/.../1.9.1/rubygems/custom_require.rb:36:in require':
cannot load such file -- /home/.../sapphire/example/data/scripts/gui.rb (LoadError)
  from /home/.../.rvm/.../1.9.1/rubygems/custom_require.rb:36:in
require'
  from g1.rb.rb:13:in `<main>'

It seems that my computer is treating these files as gems. hmmm....
Onward and upward....
Parent - - By ml Date 2013-02-19 05:05
UPDATE:                (RE: SAPPHIRE)

I think I've figured out what's going on with Sapphire and the
'require' issue. It appears to be a $LOAD_PATH issue, which
I will be able to figure out on my own, with the help of google
of course.

'require_relative' seems to be helping...
Parent - - By lol_o2 Date 2013-02-19 09:29
Thanks for any interest, I changed in source to require_relative. Just there was no difference before
Parent - - By ml Date 2013-02-20 23:10
I'm still trying to figure it all out. I'm new to programming.

It appears that in the end 'require_relative' didn't fix things for me after all. I'm still facing difficulties trying to load the template program generated by Sapphire. It can't load 'GUI.rb' for some mysterious reason.

I am making slow but steady progress on creating a welcome screen.
Parent - - By lol_o2 Date 2013-02-21 10:10
I heard that some users experienced problems with uppercase letters (just Linux), so try renaming  GUI.rb  to  gui.rb. and changing it also in require. But you'd also need to rename all files in 'data' directory
Parent - By ml Date 2013-02-22 05:49
Thank you I will try this and let you know how it goes.
Parent - By ml Date 2013-02-24 23:28
UPDATE:

Using Chingu, along with some things I learned from looking at Sapphire,
I have created an example of what I am hoping to accomplish in terms of
a GalaxyCraft Welcome Screen.

It is the Chingu Example Loader:
https://github.com/MattLemmon/ch_loader

$ /.../ch_loader$ ruby ch_loader.rb

It loads the Chingu examples from a Main Menu. A more detailed
description is included in the README.

It's still under progress. I am posting this in case anyone would like to
"look over my shoulder" and make suggestions along the way.

NOTE:  I have tested ch_loader on Ruby Version 1.9.1 only.

If nothing else, I think people will be impressed with the Fart Feature...
Parent - By jlnr (dev) Date 2013-03-09 04:50
Maybe you often work offline, but the gosu docs are also available under http://libgosu.org/rdoc :)
Up Topic Gosu / Gosu Showcase / GalaxyCraft - Beginners' Project

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill