Not logged inGosu Forums
Forum back to Help Search Register Login
Up Forum
1 2 3 4 5 6 7 8 9 10 Previous Next  
Topic By jlnr Date 2016-02-03 09:07
Nice! :)
Topic Procedural terrain generator works! well . . . sorta. By jlnr Date 2016-01-30 10:46
I have not built mip-maps before, but I'd try to generate the different mip-map levels during development using RMagick or some other tool. Less code, better results, because it does not simply skip pixels :)
(Or maybe Gosu should just let you enable mip-mapping with a flag...but so far this has not been a common request.)
Topic Procedural terrain generator works! well . . . sorta. By jlnr Date 2016-01-29 09:06
So are these black thin lines between tiles intentional? I am surprised that they're there :O

Also no idea about the black triangles. If you can build a small test case and it turns out that draw_quad cannot handle some coordinates well, I'll gladly look into it. In the meantime, can you add some runtime tests to make sure that the corners of adjacent tiles always match?
Topic Procedural terrain generator works! well . . . sorta. By jlnr Date 2016-01-27 08:00
Welcome to Gosu! I think you might be the first user to build a isometric map with depth :)

Have the images been loaded with tileable: true?
Topic Gosu #draw_line bug? By jlnr Date 2016-01-26 21:32
I think including a non-AA mode would be the way to go.

This is a common problem in Gosu, actually. If you create a Gosu::Font in a fullscreen window that is being scaled up, it would be nice if Font could automatically use a higher resolution. I wish Gosu could magically handle this behind the scenes, but for now that's all up to the game itself.
Topic Using an image as an alpha channel for another image By jlnr Date 2016-01-26 21:29
When you you notice that values are being clipped at 127/128, it might be the case that Ruby does not treat it as a binary string. newtile.encoding should return #<Encoding:ASCII-8BIT>, which is what Gosu::Image#to_blob returns by default.
Does it work if, instead of creating a new string, you modify tile by merging the mask values in?
Topic Using an image as an alpha channel for another image By jlnr Date 2016-01-25 06:51
I think Surface also has to provide width/height as accessors, or columns/rows. But playing around with to_blob is fun.
My suggestion for improved performance is to avoid the packing/unpacking and work with binary strings instead, using the character values as the alpha channel. Or maybe I just like dirty solutions ;)
Topic Gosu #draw_line bug? By jlnr Date 2016-01-25 06:47
Thanks for the links, I've filed a ticket:

One downside that I anticipate is that img = record { draw_line(...) }; scale(10) { img.draw(...) } will inevitably look terrible, because the quads used for anti-aliasing would be 10px wide now, instead of 1px.
Topic Gosu #draw_line bug? By jlnr Date 2016-01-24 17:12
OpenGL lines seem to be pretty unreliable, depending on the graphics driver. I recommend that you use draw_quad or images whenever you can.
Topic Error installing lib gosu By jlnr Date 2016-01-24 16:40
Sorry, I think I meant 'heading', not 'header' - the bold part that says

> Ubuntu (last tested on Trusty Tahr (14.10.1), with Gosu 0.8.6) / Linux Mint (last tested on Linux Mint 17.3)

now. Anyone who's logged into GitHub can edit the wiki. Almost everything on this page was contributed by Linux users who found this page and added to it.
Topic Error installing lib gosu By jlnr Date 2016-01-24 16:16
np! I've added the version number to the header.
Topic Error installing lib gosu By jlnr Date 2016-01-24 13:34
Usually there are two Ruby packages on Debian-ish distributions, ruby and ruby-dev. You need ruby-dev for the mkmf library.

If the Ubuntu instructions on this Wiki page work for you, please add "last tested on Linux Mint x.y.z" to the section header, thanks!
Topic Gosu 0.10.5 released By jlnr Date 2016-01-17 06:25
I can't see anything in the changelog :(
Topic Gosu 0.10.5 released By jlnr Date 2016-01-15 18:29
This release makes me happy because I had to do so little ^^"

• All: Update SDL to 2.0.4 stable. Finally!! <3
• All: Update stb_image, stb_imagewrite and stb_vorbis dependencies
• Ruby: Update SWIG to 3.0.8 - who knows what this will break
• All: Support clockwise coordinates in Macro#draw
• Ruby: Use sdl2-config on OS X, not only on X11-based systems

Also, thanks to @mhsjlw on GitHub for dragging the old plain text README into the world of Markdown.
Topic Mac OS X Ruby Gosu Packaging By jlnr Date 2016-01-10 08:29

> I have seen the mac os x packaging page, for the first option, i create the app with my game files inside the Contents/Resources folder and follow the steps but the application doesn't run.

Can you please open a Terminal, cd into and run ./Ruby? That is the most reliable way to see why the .app won't run.
Topic The Variety - small sci-fi game By jlnr Date 2016-01-07 06:50
I keep wondering if it wouldn't be a good idea to write a one-stop script that uploads Ruby/Gosu games to the Ubuntu App Store or some other desktop software directory that is still empty enough :) Getting feedback on the web has become soooo hard - and I can't blame people for being wary of random .EXE downloads.

Anyway, on topic - I liked the colourful design more :P
Topic Gosu without Xcode on Mac By jlnr Date 2016-01-05 16:50
You will need Apple's C/C++ compiler to install new versions of Gosu or any other C-based RubyGems, like Texplay, EventMachine etc. It doesn't have to be Xcode, you can also use Apple's command line toolchain:

If the current version of Gosu is all you need in the foreseeable future, you don't need to reinstall anything, though.

The same applies to SDL 2, which you've probably installed using Homebrew.
Topic Collision detection in a roguelike By jlnr Date 2016-01-03 00:02
Great to hear that you're enjoying Gosu! :)

I can't tell what x/y and @x/@y are from just looking at these two lines, but:
x.between?(@x, @x + 20)
is not the same as:
@x.between?(x, x + 20)

In the first case, x ≥ @x. In the second case, x ≤ @x. Or in other words,

x.between?(@x, @x + 20)
is the same as:
@x.between?(x - 20, x)

You should be able to put together a combination that works by reversing some parts of the equation :)

But...I wonder if some of these variables should have a different name? If this is in the Map class, then there usually shouldn't be a @x/@y, just maybe a @width/@height?
Topic Something went terribly wrong... By jlnr Date 2015-12-29 09:59
It is quite possible that this is what is happening here! record() is built for quads and I don't think Gosu already translates draw_line into a quad when it should. Same for draw_triangle. I feel bad that you folks keep running into the rough edges of Gosu :?

Using draw_quad to draw lines should fix the issue!
Topic Using an image as an alpha channel for another image By jlnr Date 2015-12-24 07:49
Nope, not without additional OpenGL hackery. Or you can use Gosu::clip_to to render the background again, clipped to the window/door rectangle on a tile, but that's only efficient if the background is very simple (a static image, for example).

It should be easy to generate each tile/cutout combination using RMagick.
Topic Problem for install Gosu By jlnr Date 2015-12-23 08:37
The issue has been fixed in RubyGems 2.5.1. You can keep the installed 0.10.5.pre2 gem until I release 0.10.5 (hopefully before 2016), and then just gem update gosu to install the normal version.
Topic Problem for install Gosu By jlnr Date 2015-12-23 08:36
RubyGems has fixed the issue now :)
Topic Have a screen render with Gosu::Image By jlnr Date 2015-12-21 21:22
Are you using plain Gosu to render? Then it should be as easy as Gosu::scale(1, -1, 0, window.height / 2) { ...draw everything... }
Topic Have a screen render with Gosu::Image By jlnr Date 2015-12-21 15:13
Are you rendering to an OpenGL texture? If so, can you simply invert the matrix while you are rendering, so that the image data won't be inverted to begin with?
Topic (Gosu.record).draw_as_quad issue By jlnr Date 2015-12-19 13:21
Hey, thanks for reporting this issue...and for diving into the hell that is Macro.cpp :)

Gosu originally used "reading order" for coordinates everywhere: top left, top right, bottom left, bottom right. (I think this was a Direct3D thing, but I'm not sure.)
But everyone except me seems to prefer clockwise coordinates, so while Gosu uses "reading order" internally, it now accepts arguments in both(!) orders.

And here comes the bug: I forgot to translate clockwise coordinates into "reading order" in Macro::draw. I've pushed a commit and will release a new version of Gosu once I've verified that Rubygems 2.5.1 does not break my pre-compiled Windows gem anymore. In the meantime, you can just swap the parameters to Image#draw_as_quad and everything should work.
Topic Launching gosu from Ruby on Rails By jlnr 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, or you could try out the Dare project:
(I am not sure what the progress is on the Dare project)
Topic Launching gosu from Ruby on Rails By jlnr 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'
Topic Gosu in Slow-Motion on Windows By jlnr Date 2015-11-24 19:38
This is usually the symptom of a computer that does not run Gosu with hardware acceleration, caused by outdated graphics drivers. You could try to find other games/demos that use OpenGL for rendering (not Direct3D) and compare.
Topic OpenGL vs fake 3D By jlnr Date 2015-11-21 21:33
Oh, you'll still need to draw things up to 5 times, depending on the camera position. I just wanted to say that the math for this is simple, since you've mentioned trigonometry - but I see below that you're already using a very simple formula :)
Topic OpenGL vs fake 3D By jlnr Date 2015-11-21 09:47
I've used fake 3D boxes in a few games and was quite happy with the results. Usually, what I've done is just to calculate the x/y delta of each vertex to the screen centre, then multiplied it by 1.1 or some other value > 1.0. Then I use draw_quad to connect the original vertices and the offset vertices, drawing up to five images per box.
So if part of your problem is that your math has become tricky, you can maybe simplify it like that :)

Very simple fake 3D in action ->
Topic Preparing a Spritesheet for Gosu By jlnr Date 2015-11-16 09:18
I don't know if any good tools for this task exist. But if I had to do this, I'd write a plain Ruby/Gosu tool that lets me drag rectangles on the graphic and cuts up the image, rearranging it into a grid of sprites where each image has the same measurements. Then you can either load it with Image.load_tiles (easy), or as a several 1024x1024 images with and use .subimage() to load specific sprites (that'll be a little faster).
Topic How do I put a delay in Animation? By jlnr Date 2015-11-16 09:01
I would also suggest using @lower_case for variables and instance variables. UpperCase is only used for constants in Ruby.
Topic Problem with Opengl now... Yeah ! By jlnr Date 2015-11-14 10:42
Is it just this test script that is broken? Have you tried the OpenGL example in gosu-examples (gem install gosu-examples, then run gosu-examples)?

I can't get this particular test to run either, but that's probably because I have no Glut on my system.
Topic Problem for install Gosu By jlnr Date 2015-11-12 09:45
Okay, forget about the pre gem :) It's not going to work for TexPlay.

I forgot that you can just download the .gem files from For example, here is TexPlay for 32-bit Windows:

Just click "Download" in the lower right corner.

Same for Gosu:

Then run gem install <path_of_downloaded_gem> (you can just drag the .gem file from the Explorer into cmd to insert the path). Et voila! :)
Topic Problem for install Gosu By jlnr Date 2015-11-11 20:47
Does it work if you first install Gosu (with --pre, as before, not with --platform) and then install Texplay?
Topic Problem for install Gosu By jlnr Date 2015-11-11 09:44
I don't think there will be a Texplay update anytime soon, and the current gem is only precompiled for 32-bit Ruby on Windows, anyway. In the Rubygems issue thread above, it seems that 32-bit Ruby might be unaffected by the issue altogether.

Does downgrading to a 32-bit Ruby fix everything for you (for now)?
Topic Problem for install Gosu By jlnr Date 2015-11-10 23:38
The issue is caused by this bug in Rubygems 2.5.0:

To work around the issue, I've pushed a Gosu 0.10.5.pre2 gem that is ONLY available for Windows. So if you run gem install gosu --pre now, gem has no chance but to install the Windows version.
Topic Problem for install Gosu By jlnr Date 2015-11-08 21:28
Ah, I see. Updating Rubygems itself has broken Gosu here too. =( I hope all I have to do to fix this is to release a new gem. Hope to try that tomorrow.
Topic Question about opengl texture coordinates By jlnr Date 2015-11-07 15:43
Thanks for analysing the issues with gl_tex_info. I am a complete idiot when it comes to OpenGL, so I'm glad that the feature even works as well as it apparently does!
Fixing the first issue would be relatively easy by introducing a :single_texture => true flag in the Image constructor. (This would also fix the second issue.) I don't have the time to release a new Gosu version in the next days, though :(
As for the second issue, you are right that Gosu uses inverted Y coordinates - but at least it does so consistently (y=0 is always the top). Here are the calculations for gl_tex_info:

If you want to translate the coordinates to a bottom-to-top coordinate system, you can use 1 - and 1 - tex_info.bottom.

I guess you could even add a few helper methods on Image or GLTexInfo to wrap away all these calculations.
Topic Problem for install Gosu By jlnr Date 2015-11-07 15:30
Can you please try upgrading Rubygems itself (gem update --system)? gem install should install the right architecture (pre-compiled) even without the --platform parameter, but every few years there is a bug that breaks this logic. Sigh :(
Topic Some Gosu requests By jlnr Date 2015-11-05 09:07
Yes, try this: "Hello <c=ff00ff>World!</c>"

I'm afraid the syntax is VERY poorly documented, but for now this should do the trick :)
Topic Passing around window 2: Electric Bugaloo By jlnr Date 2015-10-26 15:58
Yes, that was usually necessary because the Player class wanted to load images, and required a window reference. That is not the case in Gosu 0.9+.

In any case, the easiest workaround was to use a global variable called $window throughout your app, and set it in YourWindowClass#initialize (right after the super call). You could also use the Singleton module from the Ruby standard library, but I am not sure if it has any practical advantage over a global variable.
Topic Passing around window 2: Electric Bugaloo By jlnr Date 2015-10-26 11:25
Did you perhaps copy the wrong link there?

I think you are referring to the interface changes in Gosu 0.9+. Previously, you had to pass a Window reference to etc. (for 10 years!) - that has changed in Gosu 0.9, half a year ago.

The old overloads are documented in Gosu's rdoc, and are not likely to go away anytime soon:

I would guess that at least 95% of all Gosu code ever written still uses the old interface.

If you see a tutorial that uses the old interface, maybe you can help the author migrate it to the new one? I've been meaning to to ping the authors of the various Gosu Tutorial translations, but I haven't found the time yet.
Topic RPG Paper Maker (a 3D game editor) By jlnr Date 2015-10-18 09:59
Imagine that the implementation of Window#show looks like this (pseudocode):

def show
  while not self.closed?
    self.button_down(x) for each x that the OS reports

When you create a second window and call .show on it from within button_down, you will have two nested while loops, one for each window, and the outer loop will be stuck until the inner while loop completes. So the first window never has a chance to clean up and hide itself.
The only way around this is to wait for the first call to Window#show to return (doesn't matter if you've manually called close or if the user clicks the X), and only then show the second window. So, more like:
puts "the first window has been closed now"

The global variable was just an example for you could pass data between both windows. I don't know what your launcher actually does, so please ignore that bit.
Topic Problem with Delta-Time Physics in a windowed Gosu (Ruby) By jlnr Date 2015-10-18 09:51
This also happens when the user closes their laptop and opens it up on the next day. I think limiting dt is the way to go, but to be honest I haven't ever built a dt based game.
Topic RPG Paper Maker (a 3D game editor) By jlnr Date 2015-10-11 21:14
button_down is called in the main loop that Launcher#show starts. So basically the launcher window will be stuck forever in its loop, waiting for the whole main Window#show loop to finish. The call stack will be (among others) main > Launcher#show > Launcher#button_down >
You'll have to store the launcher settings into some sort of global variables, then let the launcher close itself, and then create the new window. Something like: # stores settings in global $settings_from_launcher
# .show returns at some point because .close was called$settings_from_launcher).show

(Assuming that the point of the launcher is to decide on settings)

Hope that helps (and works-haven't tested it)!
Topic RPG Paper Maker (a 3D game editor) By jlnr Date 2015-10-11 15:37
Which version of Gosu do you use? Closing and opening windows should work fine in the current version, the only limitation being that you can only .show one window at a time.
Topic RPG Paper Maker (a 3D game editor) By jlnr Date 2015-10-10 15:57
Wow, the indoor screenshot looks awesome, and the transition to battle even more so!

Also liked this rotation demo in the forum thread:

Let me know if you encounter any problems in Gosu! Great work. (And I'm a little jealous at how busy the RPG Maker forums are :P)
Topic Gosu 0.10.3 released By jlnr Date 2015-10-10 11:30
Awesome! Thanks for reporting.
Topic Gosu 0.10.3 released By jlnr Date 2015-10-04 20:59
That's strange, which was the last version of Gosu on which it worked? 0.10.2, 0.10.3 or 0.10.4? Can you provide a minimal example? (Probably just an empty window with one call to Gosu.draw_rect?)

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill