Archive for ‘March, 2010’

How to filter Autospec Warnings from C-libraries

datePosted on 22:23, March 28th, 2010 by Peter Fitzgibbons

I ran into this issue with Ruby 1.9 (not verified w/ 1.8.7) and the SDL C libraries on Mac OSX.  The specific issue here is related to the Objective-C wrapping of SDL (I guess?).  This issue is not necessarily seen on other platforms.

When running Autospec, noise abounds!

/Users/peterfitzgibbons/.rvm/rubies/ruby-1.9.1-p378/bin/ruby /Users/peterfitzgibbons/ruby-projects/wizardry/vendor/gems/rspec-1.3.0/bin/spec --autospec /Users/peterfitzgibbons/ruby-projects/wizardry/spec/gosu_star_catcher_spec.rb -O spec/spec.opts
Profiling enabled.
/Users/peterfitzgibbons/ruby-projects/wizardry
./Users/peterfitzgibbons/ruby-projects/wizardry
./Users/peterfitzgibbons/ruby-projects/wizardry
.

Top 10 slowest examples:
0.2427560 GosuStarCatcher when initialized should have set dimensions
0.1411460 GosuStarCatcher when initialized should have a background image
0.1077080 GosuStarCatcher when drawn should have background

Finished in 0.526593 seconds

3 examples, 0 failures
2010-03-28 21:47:13.642 ruby[72302:903] *** __NSAutoreleaseNoPool(): Object 0x1005200f0 of class NSCFNumber autoreleased with no pool in place - just leaking
2010-03-28 21:47:13.645 ruby[72302:903] *** __NSAutoreleaseNoPool(): Object 0x100567690 of class NSConcreteValue autoreleased with no pool in place - just leaking
2010-03-28 21:47:13.646 ruby[72302:903] *** __NSAutoreleaseNoPool(): Object 0x11236f080 of class NSCFNumber autoreleased with no pool in place - just leaking
2010-03-28 21:47:13.647 ruby[72302:903] *** __NSAutoreleaseNoPool(): Object 0x1005300c0 of class NSConcreteValue autoreleased with no pool in place - just leaking
2010-03-28 21:47:13.649 ruby[72302:903] *** __NSAutoreleaseNoPool(): Object 0x100538b40 of class NSCFDictionary autoreleased with no pool in place - just leaking
2010-03-28 21:47:13.667 ruby[72302:903] *** attempt to pop an unknown autorelease pool (0x100db0a00)
2010-03-28 21:47:13.668 ruby[72302:903] *** __NSAutoreleaseNoPool(): Object 0x101976320 of class NSCFNumber autoreleased with no pool in place - just leaking
2010-03-28 21:47:13.668 ruby[72302:903] *** __NSAutoreleaseNoPool(): Object 0x1019f1d30 of class NSConcreteValue autoreleased with no pool in place - just leaking
2010-03-28 21:47:13.688 ruby[72302:903] *** __NSAutoreleaseNoPool(): Object 0x11236f080 of class NSCFNumber autoreleased with no pool in place - just leaking
2010-03-28 21:47:13.689 ruby[72302:903] *** __NSAutoreleaseNoPool(): Object 0x100589980 of class NSConcreteValue autoreleased with no pool in place - just leaking
2010-03-28 21:47:13.693 ruby[72302:903] *** __NSAutoreleaseNoPool(): Object 0x1019c1710 of class NSCFDictionary autoreleased with no pool in place - just leaking
2010-03-28 21:47:13.706 ruby[72302:903] *** attempt to pop an unknown autorelease pool (0x100db1a00)

Solution?  Run autospec in terminal window-x with a file redirect of stdout :

autospec 2>>autospec.log

If you have issues, tail the log.  Most of the time, your useful info will be written to &1 (stdout) because autospec is trappping all exceptions and wrapping.

Yeay, nice output!

/Users/peterfitzgibbons/.rvm/rubies/ruby-1.9.1-p378/bin/ruby /Users/peterfitzgibbons/ruby-projects/wizardry/vendor/gems/rspec-1.3.0/bin/spec --autospec /Users/peterfitzgibbons/ruby-projects/wizardry/spec/gosu_star_catcher_spec.rb -O spec/spec.opts
Profiling enabled.
/Users/peterfitzgibbons/ruby-projects/wizardry
./Users/peterfitzgibbons/ruby-projects/wizardry
./Users/peterfitzgibbons/ruby-projects/wizardry
.

Top 10 slowest examples:
0.2427560 GosuStarCatcher when initialized should have set dimensions
0.1411460 GosuStarCatcher when initialized should have a background image
0.1077080 GosuStarCatcher when drawn should have background

Finished in 0.526593 seconds

3 examples, 0 failures

Gosu Star Catcher : Iteration 1 – Basic Window

datePosted on 21:11, March 28th, 2010 by Peter Fitzgibbons

Following Tutorial steps 1 and 2.  Establishing a screen and background.  Not much exciting on the game progress.  As seems usual, Iteration 1 makes minimal app progress and continues to clean up infrastructure issues of Iteration 0

Github Tag for Iteration-01

Observations :

  • Most Gosu objects are opaque due to the Ruby wrapper of C++ Gosu library
  • Heavy use of mocking and expectations will be required to properly Spec the game

Additions to environment:

  • mocha gem : additional mocking tools above Rspec’s internal mocker

Gosu Star Catcher : Iteration 0

datePosted on 09:56, March 25th, 2010 by Peter Fitzgibbons

I am naming the codebase of my Gosu Ruby Tutorial : Gosu Star Catcher

It’s on GitHub http://github.com/pjfitzgibbons/Gosu-Star-Catcher .

I’m using a basic Ruby library layout.. hand created.

Here are the components involved at the current moment :

rvm 0.1.23 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]
ruby 1.9.1p378
*** LOCAL GEMS ***

archive-tar-minitar (0.5.2)
autotest (4.2.9)
autotest-fsevent (0.2.2)
bundler (0.9.11)
columnize (0.3.1)
ffi (0.6.3)
gosu (0.7.18)
linecache19 (0.5.11)
nice-ffi (0.3)
rake (0.8.7)
rsdl (0.1.4)
rspec (1.3.0)
ruby-debug-base19 (0.11.23)
ruby-debug19 (0.11.6)
ruby-sdl-ffi (0.2)
ruby_core_source (0.1.4)
rubygame (2.6.2)
rubygems-update (1.3.6)
sys-uname (0.8.4)

Editor is Textmate

Test-Driven Ruby Game Development

datePosted on 09:25, March 25th, 2010 by Peter Fitzgibbons

I’ve been into a game development project using Ruby.  This is inspired by my friend Jared working on re-implementing Wizardry 1 (of Apple ][e fame) on (of all things) Excel and VBA.

So, I’ve reviewed several libraries.  Currently I’m trying Gosu for Ruby.

I will blog of my experience in following the Gosu Ruby Tutorial