Forums Archived

The forums are being archived. See this topic for more information.

Unusual error

Get help and support with Rubygame

Unusual error

Postby Fridgecrisis » Tue Sep 21, 2010 4:55 pm

Hey, everybody. I'm a new guy, both to this forum and to programming in general, though I feel pretty confident with basic Ruby concepts. I'm trying to learn Rubygame so that I can... well, make a game!

Lately, I've been working on creating an animated sprite sheet system. It was all going pretty well, until I gave each of my two Character objects an instance variable containing a proc they were to execute upon colliding with each other. These procs create a new instance of a Text_Box class over the Character's head, with an argument for the text to be contained. Usually, it all displays correctly and works fine, except when the Character I control pushes the second Character into the upper left-hand corner of the window, a strange error crashes the application. But it's not the usual type of error you'd get if you'd called a method that hadn't been defined or spelled something wrong. Instead, it gives me a "segmentation fault" and tells me to talk to the support team of the application... which is me. :(

This error doesn't always happen, either. It happens at totally random times, but only when my guys are in the upper left corner. I don't think it has anything to do with displaying text at negative values, because I can usually push both of my guys completely off the screen with no problem.

I talked to a programmer friend and he says the chances of me actually causing a segmentation error in my code (especially at my skill level) are slim to none. He said he wasn't even sure if that would be possible in Ruby. And I don't even know what a segmentation error is. I tried installing the newest version of Ruby, but all this does is give me a bigger error report.

Anyway, the error looks like this:

Code: Select all
C://Ruby192/lib/ruby/gems/1.9.1/gems/nice-ffi-0.4/lib/nice-ffi/struct.rb:405: [BUG] Segmentation fault
ruby 1.9.2p0 (2010-8-18) [i386-mingw32]

And then there's a bunch of code-y stuff, and at the end it says:

Code: Select all
You may have encountered a bug in the Ruby interpreter or extension libraries. Bug reports are welcome. For details:

This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.

As far as I can tell, the problem is coming from that nice-ffi thing, and I noticed that it was bundled with Rubygame. I visited the site it gave me, but I don't really understand how it works. I'm not sure where to take this problem, so I figured this is as good a place as any. If anyone has any info about this, please point me in the right direction. Thanks.
Posts: 4
Joined: Tue Sep 21, 2010 4:15 pm

Re: Unusual error

Postby brandon » Wed Sep 22, 2010 2:12 pm

Post the code that is causing the error, otherwise we won't be able to help you much
Posts: 9
Joined: Wed Mar 10, 2010 7:07 pm

Re: Unusual error

Postby Fridgecrisis » Wed Sep 22, 2010 8:43 pm

The thing is, I'm not really sure what part is causing the problem. And I can post it all, but it's long and interconnected, and I'm not sure anyone wants to wade through it all to find a little problem. But I'll do it anyway, I guess, if that's what it takes.

Attached a .zip. Animation.rb is the main file. Everything just needs to be in the same folder.

I may have found the problem. In my Text_Box class, I have the update method call draw, but draw is already handled by the Game class (through the Character class). So it was drawing itself twice at the same time, or something like that. I emptied the Text_Box.update method, and now everything looks the same but I'm not getting that error message. I'm going to keep trying, just to be sure.

EDIT 2--
I haven't gotten another of these error messages. I'm calling the problem as good as solved, unless someone feels like educating me on exactly what went wrong. :)
(85.14 KiB) Downloaded 176 times
Posts: 4
Joined: Tue Sep 21, 2010 4:15 pm

Re: Unusual error

Postby shawn42 » Sat Oct 02, 2010 5:58 pm

In general, if you're not shy with your code. I recommend using github for hosting via git. That way, if something goes wrong you can just say "go look at my code at
User avatar
Posts: 109
Joined: Tue Feb 10, 2009 8:22 pm

Return to Help & Support

Who is online

Users browsing this forum: No registered users and 1 guest