<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jacob Repp &#187; rubycube</title>
	<atom:link href="http://jrepp.com/category/rubycube/feed/" rel="self" type="application/rss+xml" />
	<link>http://jrepp.com</link>
	<description>Game programming, music and life</description>
	<lastBuildDate>Fri, 16 Dec 2011 06:03:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>RubyCube on Ubuntu 7.10</title>
		<link>http://jrepp.com/2007/10/19/rubycube-on-ubuntu-710/</link>
		<comments>http://jrepp.com/2007/10/19/rubycube-on-ubuntu-710/#comments</comments>
		<pubDate>Fri, 19 Oct 2007 05:04:32 +0000</pubDate>
		<dc:creator>proj</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubycube]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://jrepp.com/2007/10/19/rubycube-on-ubuntu-710/</guid>
		<description><![CDATA[I spent a few minutes on my new laptop with RubyCube. Since it uses GLUT as a foundation it was simple to port the extconf.rb to build on Ubuntu. I&#8217;m going to have to wait until after we ship TR &#8230; <a href="http://jrepp.com/2007/10/19/rubycube-on-ubuntu-710/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I spent a few minutes on my new laptop with RubyCube. Since it uses GLUT as a foundation it was simple to port the extconf.rb to build on Ubuntu.</p>

<p>I&#8217;m going to have to wait until after we ship TR before I do any of the real work that I want to get done on RubyCube.</p>

<p><a href="http://jrepp.com/?attachment_id=112" rel="attachment wp-att-112" title="rubycube-ubuntu">
<p style="text-align: center"><img src="http://jrepp.com/wp-content/uploads/2007/10/rubycube-ubuntu.thumbnail.png" alt="rubycube-ubuntu" /></p></p>

<p></a></p>
]]></content:encoded>
			<wfw:commentRss>http://jrepp.com/2007/10/19/rubycube-on-ubuntu-710/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RubyCube 0.2.1 released to RubyForge</title>
		<link>http://jrepp.com/2007/05/03/rubycube-021-released-to-rubyforge/</link>
		<comments>http://jrepp.com/2007/05/03/rubycube-021-released-to-rubyforge/#comments</comments>
		<pubDate>Thu, 03 May 2007 07:18:59 +0000</pubDate>
		<dc:creator>proj</dc:creator>
				<category><![CDATA[game programming]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubycube]]></category>

		<guid isPermaLink="false">http://jrepp.com/2007/05/03/rubycube-021-released-to-rubyforge/</guid>
		<description><![CDATA[A new windows binary and source distribution is ready on ruby forge with inital support for sprites.Â  I also took this opportunity to fix a few small bugs and update the documentation. This also marks the first public upload of &#8230; <a href="http://jrepp.com/2007/05/03/rubycube-021-released-to-rubyforge/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A new windows binary and source distribution is ready on ruby forge with inital support for sprites.Â  I also took this opportunity to fix a few small bugs and update the documentation. This also marks the first public upload of the master sources to ruby forge trunk. Although the sources are included in every release up to this point I have kept the main trunk version private but it&#8217;s now available for public download.</p>

<p>The sources in the distribution and on trunk can be built for Mac OS X for anyone who would like to experiment on that platform. Window start up time on my dual G5 is a bit slow for my tastes and I haven&#8217;t gotten in to optimize it yet.</p>

<p>I would like to thank basaah for his great suggestions and feedback on the 0.1.1 release.</p>

<p>I feel the code structure is straining a bit now that I&#8217;m starting to add in new objects.Â  It&#8217;s not terribly hard to add new functionality but the code base is definitely much larger than it was when I first threw this together as a proof of concept.</p>

<p>I&#8217;m going to do a dot release to document sprites and flush out the functionality. I&#8217;d love to get more feedback from anyone using RubyCube as to what you would like to see to make it more useful.</p>

<p>Since documentation is not yet ready for sprites the best way to see the API is in the new test/testsprite.rb driver.
<ul>
    <li><a href="http://rubyforge.org/frs/?group_id=3415" title="RubyCube downloads">Download available here</a></li>
    <li><a href="http://jrepp.com/rubycube_docs">Updated docs available here</a></li>
</ul></p>
]]></content:encoded>
			<wfw:commentRss>http://jrepp.com/2007/05/03/rubycube-021-released-to-rubyforge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RubyCube on Mac OS X</title>
		<link>http://jrepp.com/2007/04/17/rubycube-on-mac-os-x/</link>
		<comments>http://jrepp.com/2007/04/17/rubycube-on-mac-os-x/#comments</comments>
		<pubDate>Tue, 17 Apr 2007 04:53:04 +0000</pubDate>
		<dc:creator>proj</dc:creator>
				<category><![CDATA[macos]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubycube]]></category>

		<guid isPermaLink="false">http://jrepp.com/2007/04/17/rubycube-on-mac-os-x/</guid>
		<description><![CDATA[I&#8217;ve been making small incremental progress. First problem I ran into was: objc: failed objc_getClass(NSObject) for GLUTApplication-&#62;isa-&#62;isa objc: please link appropriate classes in your program Trace/BPT trap This was pretty easily fixed by making sure to pass &#8216;-framework Foundation&#8217; to &#8230; <a href="http://jrepp.com/2007/04/17/rubycube-on-mac-os-x/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been making small incremental progress.</p>

<p>First problem I ran into was:</p>

<p>objc: failed objc_getClass(NSObject) for GLUTApplication-&gt;isa-&gt;isa
objc: please link appropriate classes in your program
Trace/BPT trap</p>

<p>This was pretty easily fixed by making sure to pass &#8216;-framework Foundation&#8217; to the linker.</p>

<p>The next issue I&#8217;ve run into and I don&#8217;t have a good solution for so far is the GLUT startup performance on OS X. According to Sampler most of the time spent is in glutInit. When I drill down into glutInit I see that it is spending all it&#8217;s time in HIDUpdateDeviceList which it calls once during __glutGetNumberOfMouseButtons and again in __glutLoadPrefs. This descends down into a long chain of methods that appear to build an internal dictionary of devices (connected HID devices?). It appears this process is painfully slow, at least on my sample configuration.</p>

<p>I want the graphics window to pop up immediately (if at all possible) and so I&#8217;m going to have to spend more time figuring out the internals of what is really going on here. I&#8217;m sure it&#8217;s possible to speed it up but at what cost of my personal time? I&#8217;m not yet ready to write a specific windowing layer for the Mac.</p>
]]></content:encoded>
			<wfw:commentRss>http://jrepp.com/2007/04/17/rubycube-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RubyCube 0.1.1 Released</title>
		<link>http://jrepp.com/2007/04/07/rubycube-011-released/</link>
		<comments>http://jrepp.com/2007/04/07/rubycube-011-released/#comments</comments>
		<pubDate>Sat, 07 Apr 2007 04:34:16 +0000</pubDate>
		<dc:creator>proj</dc:creator>
				<category><![CDATA[game programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubycube]]></category>

		<guid isPermaLink="false">http://jrepp.com/2007/04/07/rubycube-011-released/</guid>
		<description><![CDATA[I just released the initial distribution of RubyCube locally. RubyCube 0.1.1 I&#8217;m in the process of getting a new ruby forge project setup to host the project files, mirror the source depot and manage bugs. I&#8217;m very happy with the &#8230; <a href="http://jrepp.com/2007/04/07/rubycube-011-released/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I just released the initial distribution of RubyCube locally.</p>

<p><a href="http://jrepp.com/rubycube"> RubyCube 0.1.1</a></p>

<p>I&#8217;m in the process of getting a new <a href="http://rubyforge.org">ruby forge</a> project setup to host the project files, mirror the source depot and manage bugs.</p>

<p>I&#8217;m very happy with the overall quality of this initial release.</p>

<p>Incidentally, I also uploaded a copy of my <a href="http://rubyforge.org/frs/download.php/19369/rbaio-0.1.zip">async IO extension</a> to ruby forge.</p>
]]></content:encoded>
			<wfw:commentRss>http://jrepp.com/2007/04/07/rubycube-011-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Profile Based Optimization and Test Driven Development</title>
		<link>http://jrepp.com/2007/04/02/profile-based-optimization-and-test-driven-development/</link>
		<comments>http://jrepp.com/2007/04/02/profile-based-optimization-and-test-driven-development/#comments</comments>
		<pubDate>Mon, 02 Apr 2007 04:45:27 +0000</pubDate>
		<dc:creator>proj</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[game programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubycube]]></category>

		<guid isPermaLink="false">http://jrepp.com/2007/04/02/profile-based-optimization-and-test-driven-development/</guid>
		<description><![CDATA[Modern video games can be about as hard to tame as a large fire breathing dragon. It&#8217;s usually not until around when the marketing budget is finalized, traditionally around 6 months before release that people start talking about bringing the &#8230; <a href="http://jrepp.com/2007/04/02/profile-based-optimization-and-test-driven-development/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Modern video games can be about as hard to tame as a large fire breathing dragon. It&#8217;s usually not until around when the marketing budget is finalized, traditionally around 6 months before release that people start talking about bringing the dragon out of the cave to meet the general public. It&#8217;s not wise to allow the general public to be maimed, charred and eaten by a fire breathing dragon.So the dev team picks a few brave souls to go into the cave and coax the dragon out. Presumably at this point the band of merry men look around blithely at one another and one of them decides to prove his worth by charging straight on in and <a href="http://www.youtube.com/watch?v=leEsz9ci5XE">biting the dragons knees off</a>. This however royally pisses off the dragon and only makes the matter worse.</p>

<p>It takes some serious hardware to fight dragons, don&#8217;t go into a dragon fight without taking at least some of the following:</p>

<p><a href="http://www.glowcode.com">GlowCode</a>, <a href="http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html#SEC1">gprof</a>, <a href="http://freshmeat.net/projects/efence/">ElectricFence</a>, <a href="http://blogs.msdn.com/angryrichard/articles/Profiling_Windows_Services.aspx">LOP/F1 Profiler</a>, <a href="http://www.compuware.com/products/devpartner/bounds.htm">BoundsChecker</a>, <a href="http://valgrind.org/">ValGrind</a>, <a href="http://www.debuginfo.com/examples/dbghelpexamples.html">dbghelp.lib</a>, <a href="http://www.debuginfo.com/examples/dbghelpexamples.html"></a><a href="http://www.codeproject.com/tools/visualleakdetector.asp">VLD</a></p>

<p>I put <a href="http://www.glowcode.com">GlowCode</a> at the front of the list intentionally. I just downloaded it but this thing is the excalibur of dragon slaying tools.</p>

<p>GlowCode is a great developer tool, it might look a little crufty but all the little interface issues are thought through and the thing is just fast and does everything you want right how you want it. I quickly found a number of hot spots in the game and immediately went to take a nap (no sense fighting a dragon while tired right?)</p>

<p>Out of curiosity I profiled the RubyCube stress test and time<em>free() was using about 50% of the total time, this is the internal ruby hook that returns a Time object to the heap. Of the other time 70% was spent in g</em>shape_render() which is the function that renders a single shape. So again, this especially outlines the need to use <a href="http://jrepp.com/2007/03/26/rubycube-progress/">an alternative timing mechanism</a> in RubyCube. Exclusive time gives a good indication of what routines are doing the most actual work but often times looking at average or total Exclusive+Inclusive time can give you a good idea of where you might find some low hanging fruit.</p>

<p>All of the other tests are running well. One more documentation pass and I&#8217;ll be ready to do a windows release. I want to follow that closely with the mac release. To get things running on the mac should be as simple as:
<ol>
    <li>Replace Win32 threads with pthreads (nothing fancy, just conditional compilation)</li>
    <li>Ditto for the critical sections migrating to pthread mutexes.</li>
    <li>Some cross platform glue sniffing in extconf.rb will be needed as well.</li>
</ol>
I&#8217;ve been using these lists in my blog to keep me on track for what I need to do. I&#8217;ve been working about 60hrs a week on getting tabula rasa ready for closed beta and so my play coding time is extremely limited. I have been pretty disciplined though, my gamerscore has been stable since Crackdown ^^) When I sit down I usually go back and read my last blog post list and open up a test case.</p>

<p>Having the test cases has been instrumental in making any progress. I keep the build stable between work sessions and focus all my work around achieving results in a test case. A lot of bugs and usability issues have been fixed already using this method. I added a couple big handfuls of useful functionality as a result.</p>

<p>As an example two new global methods &#8216;pause&#8217; and &#8216;resume&#8217; were added to allow me to control the animation test more explicitly. This is actually a really simple feature that is fun to play with.</p>

<p>Also as a result of this type of work I converted to using array tuples for vector arguments. This has made the ruby code more readable and allows an easier transition from 2D to 3D.</p>

<p>Timers are another big example, without the stress test I never would have seen the timer GC thrashing and decided to implement a timer event.</p>
]]></content:encoded>
			<wfw:commentRss>http://jrepp.com/2007/04/02/profile-based-optimization-and-test-driven-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RubyCube progress</title>
		<link>http://jrepp.com/2007/03/26/rubycube-progress/</link>
		<comments>http://jrepp.com/2007/03/26/rubycube-progress/#comments</comments>
		<pubDate>Mon, 26 Mar 2007 21:00:26 +0000</pubDate>
		<dc:creator>proj</dc:creator>
				<category><![CDATA[game programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubycube]]></category>

		<guid isPermaLink="false">http://jrepp.com/2007/03/26/rubycube-progress/</guid>
		<description><![CDATA[I got some more time to hack on RubyCube so from my original almost ready post I got the following done: Finished the stress test Finished first pass of documentation (rubydoc) More test cases for basic functionality Perspective transform is &#8230; <a href="http://jrepp.com/2007/03/26/rubycube-progress/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I got some more time to hack on RubyCube so from my original almost ready post I got the following done:
<ul>
    <li>Finished the stress test</li>
    <li>Finished first pass of documentation (rubydoc)</li>
    <li>More test cases for basic functionality</li>
    <li>Perspective transform is working</li>
</ul>
Working on the above items exposed some underlying issues that need to be addressed.
<ul>
    <li>Object destruction had to be optimized a bit. This is a bit tricky due to multithreading issues. Basically once the ruby script calls the registered free callback the object is marked for cleanup. The graphics/update thread handles reclaiming the actual memory in the main loop.</li>
    <li>I couldn&#8217;t find an effecient way to do game timers in ruby. This code looks nice but creates too many Time objects:</li>
</ul>
<pre><pre>
stopTime = Time.now() + 60
while(Time.now() &amp;lt; stopTime) do
&nbsp;&nbsp;puts &quot;thinking&quot;
end</pre></pre>
So a custom solution has been cooked up. This ties into the existing low level events system used in rubycube (uglier but fast):
<pre><pre>
timerId = RubyCube.set_timer(10, -1) # interval 10 seconds, repeats forever
loop do
&nbsp;&nbsp;event = []
&nbsp;&nbsp;while(RubyCube.read_event(event)) do
&nbsp;&nbsp;&nbsp;&nbsp;if(event[0] == RubyCube::TIMER &amp;amp;&amp;amp; event[1] == timerId) then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts &quot;hit timer&quot;
&nbsp;&nbsp;&nbsp;&nbsp;end
&nbsp;&nbsp;end
end</pre></pre>
<ul>
    <li>I cut the number of animation types supported and am still working on a test that exercises all of them.</li>
</ul>
Remaining things TODO:
<ul>
    <li>Animation tests</li>
    <li>Timer tests</li>
</ul>
Things that have been cut for the first release:
<ul>
    <li>Proper lighting support. This really limits the usefulness of perspective mode.</li>
    <li>Physics support. The APIs are there but not tested or supported for now.</li>
</ul>
Current priorities for second release:
<ol>
    <li>Lighting support</li>
    <li>Texture/Material support</li>
    <li>Physics support</li>
    <li>Any user suggestions</li>
</ol></p>
]]></content:encoded>
			<wfw:commentRss>http://jrepp.com/2007/03/26/rubycube-progress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Conway&#8217;s Life in Ruby(Cube)</title>
		<link>http://jrepp.com/2007/03/10/conways-life-in-rubycube/</link>
		<comments>http://jrepp.com/2007/03/10/conways-life-in-rubycube/#comments</comments>
		<pubDate>Sat, 10 Mar 2007 10:45:09 +0000</pubDate>
		<dc:creator>proj</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubycube]]></category>

		<guid isPermaLink="false">http://jrepp.com/2007/03/10/conways-life-in-rubycube/</guid>
		<description><![CDATA[Inspired by the animated patterns in a stress test I put together an implemetation of the original cellular automaton program &#8216;life&#8217; using ruby and the extension I&#8217;ve been hacking on lately. It&#8217;s a simple idea but it can produce some &#8230; <a href="http://jrepp.com/2007/03/10/conways-life-in-rubycube/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Inspired by the animated patterns in a <a href="http://jrepp.com/2007/03/09/rubycube-stress-test/">stress test</a> I put together an implemetation of the <a href="http://en.wikipedia.org/wiki/Conway's_Game_of_Life">original cellular automaton program &#8216;life&#8217;</a> using ruby and the extension I&#8217;ve been hacking on lately.</p>

<p>It&#8217;s a simple idea but it can produce some very nice patterns.</p>

<p>Here&#8217;s life out of control, if you muck with the death condition:</p>

<p><a href="http://jrepp.com/wp-content/uploads/2007/03/rubycube_life.jpg" title="Life in Ruby(Cube)"><img src="http://jrepp.com/wp-content/uploads/2007/03/rubycube_life.jpg" alt="Life in Ruby(Cube)" /></a></p>

<p>Here&#8217;s a stable pattern produced by the block and blinker in the sample:</p>

<p><a href="http://jrepp.com/wp-content/uploads/2007/03/rubycube_life2.jpg" title="Stable Block and Blinker"><img src="http://jrepp.com/wp-content/uploads/2007/03/rubycube_life2.jpg" alt="Stable Block and Blinker" /></a></p>

<p>The code will be part of the samples but if you want to take a look <a href="http://jrepp.com/code/life.rb">I&#8217;ve uploaded it</a>. Any comments are welcome, I know that I&#8217;m not the best Ruby coder out there.</p>
]]></content:encoded>
			<wfw:commentRss>http://jrepp.com/2007/03/10/conways-life-in-rubycube/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RubyCube stress test</title>
		<link>http://jrepp.com/2007/03/09/rubycube-stress-test/</link>
		<comments>http://jrepp.com/2007/03/09/rubycube-stress-test/#comments</comments>
		<pubDate>Fri, 09 Mar 2007 22:16:35 +0000</pubDate>
		<dc:creator>proj</dc:creator>
				<category><![CDATA[game programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubycube]]></category>

		<guid isPermaLink="false">http://jrepp.com/2007/03/09/rubycube-stress-test/</guid>
		<description><![CDATA[Downloading 2+ gig through a VPN link is not very fun so to pass the time I&#8217;m doing some stress related tests for RubyCube: For some reason the garbage collector still kicks in and starts reclaiming the shapes even if &#8230; <a href="http://jrepp.com/2007/03/09/rubycube-stress-test/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Downloading 2+ gig through a VPN link is not very fun so to pass the time I&#8217;m doing some stress related tests for RubyCube:<a href="http://jrepp.com/wp-content/uploads/2007/03/rubycube_stress.jpg" title="Stress test for RubyCube"><img src="http://jrepp.com/wp-content/uploads/2007/03/rubycube_stress.jpg" alt="Stress test for RubyCube" /></a></p>

<p>For some reason the garbage collector still kicks in and starts reclaiming the shapes even if I keep references to them in the base script. Stress related crashes to look into now.</p>
]]></content:encoded>
			<wfw:commentRss>http://jrepp.com/2007/03/09/rubycube-stress-test/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>RubyCube is almost ready for release</title>
		<link>http://jrepp.com/2007/03/09/rubycube-is-almost-ready-for-release/</link>
		<comments>http://jrepp.com/2007/03/09/rubycube-is-almost-ready-for-release/#comments</comments>
		<pubDate>Fri, 09 Mar 2007 17:19:51 +0000</pubDate>
		<dc:creator>proj</dc:creator>
				<category><![CDATA[c++]]></category>
		<category><![CDATA[game programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubycube]]></category>

		<guid isPermaLink="false">http://jrepp.com/2007/03/09/rubycube-is-almost-ready-for-release/</guid>
		<description><![CDATA[Since I&#8217;ve not had a lot of time for home-hack projects lately I&#8217;ve been focusing on getting RubyCube ready for release. It&#8217;s a small, well contained project, it&#8217;s easy to make good progress with only 30 minutes of invested time. &#8230; <a href="http://jrepp.com/2007/03/09/rubycube-is-almost-ready-for-release/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Since I&#8217;ve not had a lot of time for home-hack projects lately I&#8217;ve been focusing on getting RubyCube ready for release. It&#8217;s a small, well contained project, it&#8217;s easy to make good progress with only 30 minutes of invested time.</p>

<p>RubyCube is a ruby extension that gives a high level ruby API on top of <a href="http://www.xmission.com/~nate/glut.html">GLUT</a> and <a href="http://www.ode.org/">ODE</a> currently. It abstracts away some stuff that doesn&#8217;t really belong in a graphics scripting environment but you tend to see people include anyways (like the render/update loop). I used it back in March of &#8217;06 to <a href="http://www.flickr.com/photos/lindseyrepp/sets/72057594080277664/">write a game</a> with my friend John in a matter of hours.</p>

<p><img src="http://farm1.static.flickr.com/54/111286994_7acf8a56d9.jpg?v=0" title="GameHack '06 GSpace in Action" alt="GameHack '06 GSpace in Action" align="middle" height="375" width="500" /></p>

<p>When I started I decided that I didn&#8217;t want the render loop to be bound to the performance of the ruby VM since it&#8217;s performance is pretty <a href="http://dada.perl.it/shootout/craps.html">crap</a>. Craps! score doesn&#8217;t really account for object lifetime management overhead which Ruby may have some issues with as well. Regardless of that I really like the language and I think it could make a good prototyping environment for game programming.</p>

<p>Most people when they create a language wrapper for something like OpenGL or  DirectX write a direct 1-to-1 mapping (<a href="http://sourceforge.net/projects/luasdl/">luasdl</a>, <a href="http://www.kmc.gr.jp/~ohai/rubysdl.en.html">rubysdl</a>, <a href="http://rubyforge.org/projects/rubygl/">rubygl</a>, etc). This is probably due to simplicity of implementation and maybe lack of imagination <img src='http://jrepp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  . It may have something to do with not really understanding the problem domain very well, which is a huge barrier to successful software design in general.</p>

<p>So the way that I approached the problem is to create a seperate thread in the extension and use queues to communicate between the script interface and the extension. The render and object update loop is handled in C. This has a lot of benefits but is more complex to code. Overall, I have been very pleased with this design.
Currently the interface is very simple, it&#8217;s intended as a prototyping environment. It&#8217;s not the kind of thing you would build a whole game on at this point. I&#8217;m going to try the approach of release early, release often and see how that goes. I was planning on including texture support in the first release but I think I&#8217;m just going to finish the docs and tests and release it as is.</p>

<p>It currently only supports vector based graphics, no lighting and only a few simple types of animations. Oh and it doesn&#8217;t yet compile on my Mac.</p>

<p>One nice benefit of using a background thread is that you watch the render window while you&#8217;re in irb.</p>

<p>irb -r rubycube</p>

<p>irb&gt; RubyCube.startup(&#8220;My test application&#8221;, 800, 600) # create the window and thread
irb&gt; myshape = Shape.circle(100, 200, 50) # create a circle at 100,200 with radius 50
irb&gt; myshape.move_to(300, 300, 2) # move to &lt;300,300&gt; in 2 seconds
irb&gt; myshape.color(1, 0, 0)</p>

<p>You can also create custom shapes that are lists of verts, normals, colors. You can create thousands of shapes and have them animate very easily without burdening the ruby interpreter.</p>

<p>For the first release I&#8217;m shooting for the following:
<ul>
    <li>All core methods documented</li>
    <li>Test cases for all animation types</li>
    <li>Test cases for ODE physics on shapes simulation</li>
    <li>Finish stress test</li>
    <li>Perspective transform mode working</li>
</ul>
In rough order of importance after releasing the basic framework will be:
<ul>
    <li>Mac OSX support</li>
    <li>Texture/Material support</li>
    <li>Sound support</li>
    <li>Shader support</li>
    <li>Implement changes from user feedback (if any)</li>
</ul></p>
]]></content:encoded>
			<wfw:commentRss>http://jrepp.com/2007/03/09/rubycube-is-almost-ready-for-release/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>mkmf versus mkrf round 1</title>
		<link>http://jrepp.com/2007/03/05/mkmf-versus-mkrf-round-1/</link>
		<comments>http://jrepp.com/2007/03/05/mkmf-versus-mkrf-round-1/#comments</comments>
		<pubDate>Mon, 05 Mar 2007 15:49:00 +0000</pubDate>
		<dc:creator>proj</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubycube]]></category>

		<guid isPermaLink="false">http://jrepp.com/2007/03/05/mkmf-versus-mkrf-round-1/</guid>
		<description><![CDATA[So in trying to cleanup a ruby extension (rubycube) for release I revisited the build system trying to get a good cross platform build going. The extconf.rb file that I had created was a thing of ugly and in looking &#8230; <a href="http://jrepp.com/2007/03/05/mkmf-versus-mkrf-round-1/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So in trying to cleanup a ruby extension (rubycube) for release I revisited the build system trying to get a good cross platform build going. The extconf.rb file that I had created was a thing of ugly and in looking around I found <a href="http://glu.ttono.us/articles/2006/06/28/mkrf-0-1-0-released">mkrf</a>. Now the code for mkrf is very small and clean and it uses a lot of ruby magic in order to stay small. However, when I tried to use it for my project which is fairly complex in extension terms (multiple platforms, 3 different dependent libraries and multithreading) it turned out to be <em>much to</em> simple. After spending far too much time trying to fix the various issues with mkrf I just went back to mkmf, read more of the code and some other extensions and got my stuff to work.
Here&#8217;s a short laundry list of problems I ran into with mkrf:
<ul>
    <li>Bug in non-supression of logging during test compile stage (using $debug rather than $DEBUG)</li>
    <li>Logging was too minimal overall, it was not clear in mkrf what settings and source it was trying to compile without getting into the code.</li>
    <li>Mkrf uses the wrong rbconfig settings for test compiles, the settings are not compatible on platforms other than the one it was written on. It should take a note from mkmf in this regard and use Config['TRY_COMPILE'] instead of Config['CC']</li>
    <li>It was not possible without a hack to modify the library search path of @availability before test compiles were invoked. This is troublesome when you have cascading library dependencies.</li>
    <li>Using rake is neat idea but it adds a seperate dependency to a project (albiet one that is easily resolved by rubyists who know how to install rake). I would like my extension to have as low a barrier to entry as posible to encourage non-ruby programmers to try it.</li>
    <li>All standard extensions use mkmf and so you know that if they could compile ruby on their systems (which many systems can by this point), they can compile your extension.</li>
</ul>
My opinion is that currently (as of version 0.20) mkrf is an <a href="http://glu.ttono.us/articles/2006/05/27/summer-of-code">interesting idea</a> that doesn&#8217;t yet close the gap for extension writers with more needs than compiling &#8216;libtrivial&#8217; on whatever platform mkrf was written on. Compiling cross platform code is not trivial matter but for the most part mkmf does a great job of making it feel pretty trivial.</p>

<!-- technorati tags begin -->
<p style="font-size: 10px; text-align: right">technorati tags:<a href="http://technorati.com/tag/ruby" rel="tag">ruby</a>, <a href="http://technorati.com/tag/rubycube" rel="tag">rubycube</a></p>
<!-- technorati tags end -->
]]></content:encoded>
			<wfw:commentRss>http://jrepp.com/2007/03/05/mkmf-versus-mkrf-round-1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

