Here’s a little Ruby function I came up with today. I thought it might be useful to other people, so here it is.
Think you can do better? Fork me and prove it! ;)
Here’s a little Ruby function I came up with today. I thought it might be useful to other people, so here it is.
Think you can do better? Fork me and prove it! ;)
Lately, I’ve been having visions of a game I’ve been wanting to make for years, which I call Ambienome, a pseudo-portmanteau of Ambient (as in ambient music) and Anemone (the tendrilled sea creature). Both the concept and the name are inspired by Toshio Iwai’s Electroplankton. Like Electroplankton, Ambienome would be more of a musical toy than a game; the purpose of it is to have fun and express your creativity, not to “win”.
I’ve finally migrated this blog from Mephisto to WordPress. I’ve set up redirects, so ideally all the old URLs should still work fine. Apologies for the RSS feed spam, if you got hit with any. Once the dust has settled here, I’ll be migrating the Rubygame blog too.
Why the switch? Simply put, Mephisto wasn’t cutting it anymore. It’s not as usable or polished as WordPress, and it doesn’t feel like it’s going anywhere. Worse, the Rails-based setup was making it difficult to keep up and running, and it was prone to mysterious breakages that would come and go with no apparent cause. In the end, it just wasn’t worth it to me.
For the migration-curious, here’s how I did it. Read More
(Pssst. Check out my Git Submodules Cheat Sheet for a quick reference.)
This post is the result of my investigations into how Git submodules work and how to use them. My goal in investigating submodules was to decide if they would be an effective way to share specs among the various Ruby FFI implementations (Ruby-FFI for MatzRuby, JRuby’s FFI, Rubinius’ FFI, etc.). We wanted all the projects to be able to include the specs as a subdirectory of their main repository so that they could easily run them, yet we also needed an easy way to keep all the projects in sync. Read More
I’m pleased to announce a small helper library I’ve created, Nice-FFI. It sits on top of Ruby-FFI and makes certain things easier and more convenient. Nice-FFI started out as helper classes I made for Ruby-SDL-FFI (which is coming soon), but I decided to generalize it and make it its own library so that other people might get some benefit from it.
Even though it’s still young, Nice-FFI already has some useful features:
load_library('SDL') (instead of ffi_lib) to look in platform-specific places. E.g. on Linux, it would first look for “/usr/local/lib/libSDL.so”, while on Windows it would look for “C:\windows\sys32\SDL.dll”. Linux (and BSD), Mac, and Windows each have a good selection of default search paths already, and it’s easy to add, remove, or change them using the NiceFFI::PathSet class.layout :x, :int, :y, :int gives you #x, #x=, #y, and #y= for free. You can control which members get accessors using the read_only and hidden module methods.NiceFFI::TypedPointer( MyStructClass ) instead of :pointer to get auto-wrapping. So, instead of returning a Pointer, a function would return a MyStructClass instance that holds the pointer.MyStructClass.new( :x => 1, :y => 2 ). You can initialize from a Hash, Array, another instance, or a pointer as usual. Struct attributes can also be dumped to a Hash or Array. And, structs have a nice #to_s method to show you the values of its members, for debugging.All of the features are described in detail, with examples, in the docs (see especially docs/usage.rdoc, in addition to the class and method docs).
Nice-FFI is still young, though. So while I’d love for people to play around with it and give me feedback (and patches!), it’s probably not quite ready for prime time yet. It’s still under development, so the API may change suddenly. But if you are willing to tweak your code from time to time, I think you’ll find Nice-FFI to be very helpful. (Otherwise, just wait until 1.0, when the API stabilizes.)
You can get Nice-FFI:
gem install nice-ffiPlease send bug reports and feature requests to the issue tracker on Github.
This is a look back at last weekend’s RubyWeekend #3 game contest and the process of developing my entry, Droplet. You can read more post-mortems from the contest in the Rubygame forums.
Gamebox is interesting, and much more mature than its version number (0.0.6 as of this writing) might lead you to believe. The game contest helped flush out several bugs and shortcomings, but Shawn has been super-fast to fix them. I’m sure it will polish up very nicely as he gets feedback from more people.
In general, I am wary of frameworks. Certainly, Rails puts a bad taste in my mouth these days (despite my positive initial reactions two years ago). I tend to find frameworks restrictive, and would much rather be handed a set of building blocks to assemble. For one thing, a framework makes assumptions about what shape I want the final result to have. And I find that many frameworks assume more than they should, and make it too difficult to do things the framework creator didn’t anticipate.
Gamebox suffers from this a little bit, but not nearly as much as Rails does. This is evidenced by the fact that even an unorthodox game like Droplet could be made with it. For instance, a more rigid flamework would not have been able to handle the game objects being arranged radially or having no set appearance. There were some things that I had to work around, though:
There were a few other things that felt like work-arounds to me, but which I think I could have done better if I were more familiar with Gamebox, especially its Behaviors system.
Would I use Gamebox again? Sure! Especially for more conventional games, Gamebox is a great way to get a head start on your game. Even weird stuff like Droplet can be accomodated without a great deal of trouble. And at the rate Shawn is improving it, I’m certain Gamebox will soon be one of the most kickass game frameworks around.
… at least until Rebirth comes out. >;)
I’m pleased to present my entry to the RubyWeekend #3 game competition: Droplet. From the README:
Droplet is a small musical toy created by John Croisant in 72 hours over the weekend of June 26-28, 2009 for the third RubyWeekend game creation competition.
The theme of the competition was “A Tiny World”. The inspiration for Droplet comes from photographs that people have commonly described as “tiny worlds”: droplets of water, and the small plants and fungi that grow underfoot.
Initially, Droplet was going to feature both plants and creatures interacting in their tiny droplet world, but I abandoned plans for the creatures due to time constraints. So, what’s left is abstract, rainbow colored plants that sing when you tickle them!
Enjoy!
The controls are simple:
To run Droplet, you will need Ruby 1.8.6 (1.9 might work), Rubygame 2.5.2 (with SDL_gfx, SDL_image, and SDL_mixer support), and Gamebox 0.0.4.
What’s working:
draw_line_s, and anti-aliased, but not as roundy at the ends.What’s not:
All in all, though, it’s coming together well. 16 hours left.
A quickie progress update and screenshot of my RubyWeekend game, Droplet.
What’s working:
What’s not:
The contest period is nearly half over (39:30 hours left as of this writing). I’m going to try to fix the color and leaning issues, then head to bed. The focus tomorrow will be on sound/music.
Update 03:52: Fixed the color and leaning issues. Both were just stupid little mistakes. Here’s an updated screenshot:
Nice-FFI 0.3 (and 0.2)
I’ve just released a new version of Nice-FFI, my convenience library for Ruby FFI libraries. You can install the new version with
gem install nice-ffi, as usual. Please note that Nice-FFI is still not considered API-stable, so if you aren’t willing to update your code when a new version comes out, you shouldn’t use it until version 1.0.Version 0.3 has a few changes:
Also, since I never posted an announcement for 0.2, here are the changes for that version:
:autorelease => falseto MyStruct.new.TypedPointer.new(MyStruct). You can also pass:autorelease => falseto disable memory management for all structs created via that TypedPointer, which is useful when using the TypedPointer as a function return type.Struct#to_bytes), and also created from a bytestring (by passing a String to Struct.new).Pathset#<<andPathset#>>. Use append and prepend instead.func=attach_function,var=attach_variable.You can get Nice-FFI:
gem install nice-ffiPlease send bug reports and feature requests to the issue tracker on Github.