Archive for the Software Category

Randomized Dungeons

Posted in Development, Software, Video Games on April 19, 2017 by osake

I wrote a little dungeon maze generator using randomize Prim’s algorithm in Ruby.  The snippet below is the algorithm itself and works off of any sort of walls/rooms combo as long as it’s valid.  This should also work in hex or even a 3D maze since floors and ceilings are effectively a wall pair.

Screen Shot 2017-04-19 at 6.11.26 PM

I’m looking to port this over to my new game, but wanted to prototype it in Ruby.  I think I should add some variety by dropping rooms at random on a given size.  This piece will work, but my room and wall generators will need some tuning.

Getting qt4-qtruby-2.0.3 running on Mac OS X (and Qt)

Posted in Development, Software on August 21, 2009 by osake

History

Please bear with me to share a little history of how I even got an interest in trying Ruby/Qt on the Mac.

In the past I’ve tried to learn GUI development.  The biggest roadblock (aside from the learning curve) was getting one installed with all its dependencies.  And maybe I’m asking for it when developing on a Mac.  They’ve always been company provided, so I’m not going to whine too much.

Some time ago, I co-presented on a GUI toolkit talk at my Ruby user group (KCRUG).  My compatriots chose Ruby Cocoa and Gtk, while I chose Shoes (I miss you _why).  I wasn’t just chosing Shoes to be eclectic, but I wanted ease of cross-platform.  Shoes to me also seemed easier to get up and running at the time.

So now, you should understand where I’m coming from.  I want cross-platform and I want something simple to setup.  Well, unfortunately, my portion of the presentation was a fail.  Not the presentation itself, but I was unable to get what I needed to talk to Wee War’s site and do anything.  Even with an excellent Wee War API wrapper in Ruby done up by Sean.

Shoes (still young at the time) wasn’t going to float for me any longer.  It did receive constant love from contributors to the source, but the struggle for me to achieve anything on par with the excellent sample apps ruined my glorious vision of triumph with a simple, elegant tool.  Someone recently gave me their thoughts on why Shoes failed me, and maybe its true.  I just couldn’t adapt my comprehension of programming to the Shoes DSL.

Gtk and Cocoa.  Well, let’s just dump Cocoa now, I had no interest in limiting myself.  So after that presentation (which mind you, was done in an Ubuntu VM), I tried to fire up the whole Ruby/Gtk thing native on the Mac.  After flailing for a few days, I caved in and abandoned my search for some time.

Present

Well, a little more history, but relevant to the post topic.  Something recently spurred my interest in Qt.  I’ll be the first to admit that I’ve always used Gnome, Windows, or Mac for my windowing system.  I do occasionally boot Knoppix, but I really don’t get too deep into Qt stuff.  Oh yeah, and I’ve used/currently use many things that have their claim to fame in Qt.

I tried hitting up TrollTech to get started.  No go, the link I found was dead with no redirect or anything.  A quick search clued me in to Nokia’s recent involvement.  This is fine by me, there is still an LGPL version and now it’s funded love.

Let’s review real quick, my requirements: must be cross-platform, I’d like to do it in Ruby if possible, and I have to be able to get it working natively on my Mac.

Recipe

As of this post, here is what I had to grab (oh yeah, you’ll need Xcode I’m pretty sure, comes with your Mac though)

  • Qt (4.5.2 from Nokia)
  • cmake (2.6.4 from cmake)
  • ruby (1.8.6, compiled version of Ruby)
  • qt4-qtruby-2.0.3 (2.0.3 from RubyForge)

I installed Ruby first since I do that professionally.  Qt was next, and I actually went with the full SDK in case I want to explore outside the realm of Ruby, or find limitations or interests that take me back to C++.   I then made the mistake of trying to just build qt4-qtruby.  You need cmake to build it, so get cmake up and running.  I actually used the binary dmg and linked it up in my shell path during installation.

Now, just so you don’t spend a lot of time asking why cmake in the source dir fails, let’s get you on the right foot off the bat.

$ cmake -Wno-dev \
-DRUBY_INCLUDE_PATH=/usr/lib/ruby/1.8/universal-darwin9.0 \
-DRUBY_LIBRARY=/usr/lib/libruby.1.dylib \
-DENABLE_QTWEBKIT_SMOKE=off \
-DENABLE_QTWEBKIT_RUBY=off

You may need to change your Ruby paths, but the other options will help get you through cmake and make.

I saw a more detailed build on phosphorescence‘s blog, but my cmake params should suffice.

After cmake is complete:

$ make && sudo make install

Feel free to break that up, but I just like getting it all done in one pass.

The next headache that plagued me over night and into the morning was that my build was successful, but I was unable to complete the ‘helloworld’ example.

require 'Qt4'

app = Qt::Application.new(ARGV)

hello = Qt::PushButton.new('Hello World!')
hello.resize(100, 30)
hello.show()

app.exec()

Line 1 was throwing a LoadError exception for ‘qtruby4’.  I am not terribly good at figuring this sort of thing out.  I mean, I know what it’s saying, but I don’t understand why.  To my knowledge everything was done correctly.  I spent several hours in IRC and searching forums last night.

I came across a German post which Google tried to help me with it’s translation, but I didn’t quite grasp what the fellow was saying.  At this point, I tried a few things before going to sleep and eventually gave in to the sand man.

The next day, I popped in IRC and low and behold, Richard Dale himself was there.  A short while after summarizing my issue, he blessed me with the answer.  For my installation:

$ cd /Library/Ruby/Site/1.8/universal-darwin9.0
$ ln -s qtruby4.so qtruby4.bundle

So really, just change to whatever directory contains your compiled qtruby4 library and create the symlink to qtruby4.bundle.  Go figure.  I’m tempted to spend a little time understanding what these .bundle files are, but that’s another story.

Top 10 Reasons To Own A T-Mobile G1

Posted in Hardware, Rant, Software on November 20, 2008 by osake

In other words, ten reasons I don’t own an iPhone (or the G1 is just as good).  And in no particular order, here they are:

10. It’s not AT&T.  Honestly, I don’t have a terrible grudge against them, but several people I am close to do.  My service provider happens to be T-Mobile as well.  Call me a shill.  Meh.

9. It has a physical keyboard.  I had a Blackberry as my last data phone.  Definitely spoiled by full qwerty access and the tactile response.

8. Applications that I write can easily be put on the phone, for free.  Last I checked, you have to pay out $99 USD and own a Mac.  Neither of which I had after buying the phone itself.  I still would like to own a Mac though.

7. My fairly content relationship with Google.  I enjoy most of the services that Google provides and having a device that is built to play well with my internet love affair is just dandy. (Yes, I refuse to capitalize the internet…take that!)

6. 3G.  Okay, my city doesn’t have it yet, but the end of the year is going to level the playing ground in most major US cities with our competitor.

5. Cross-platform development kit.  Maybe a little unfair to fill the list with dev arguments, but the fact is, you can develop for this phone on your choice of three major operating systems.  Thanks Java.

4. ShopSavvy.  I was a little pessimistic about this app after some bad luck with its lacking database, but it has grown tremendously since opening day.  I’m going to retire my other barcode scanning apps now.

3. Standardized USB communications port.  It looks a little wonky, but it works fine with a Mini-USB connector.  I know iPhones use that connector similar to the iPod, which I own, but I own far more Mini-USB cables, and I like being able to switch between all my other devices without carying a bunch of different cables.

2. ConnectBot.  It’s an SSH app that rocks the block.

1. I can find Uranus any time thanks to this stellar app called “SkyMap”

There are still several improvements that could be made to the G1, and maybe I’ll gird my loins up to write a top ten to counter this list.  I do admit that, as of today, I would buy maybe an iPod touch so that I could have that MachDice, die rolling, app currently available on the iPhone/iPod touch.

Turn For The Better

Posted in Hardware, Rant, Software, Zen on June 14, 2006 by osake

I might repeat myself a touch here.

I got my computer partially restored. I still don't have the 120GB hard drive, and I'm finally starting to accept it as a loss. The interesting bit is that before moving into my new place (yeah, the whole emancipation from sister-in-law thing which I don't recall explaining fully), I decided to dir /s my drive into a text file on another hard drive.

Had I the space to fully back it up, I would have. My nature, and new philosophy is to be more redundant. Moreso in computer data than real life, heh.

So I sent myself this E-Mail containing said text file of the now missing data, and here's where the whole rant/zen action comes into play:

Just data massage this shit and figure out what can/can't be restored…move on, watch shit tons of anime and forget that the world is cruel and material things are why we suffer.

–Josh

Now, when I say this. It's more of a personal note, hence less well formed. I'm not saying that I want to forget "material things are why we suffer" rather the cruelty of the material nature of my problem.

My dwelling on the whole debacle has been rather taxing on my relationships with everyone and everything I know. I want to move on. I'm finally feeling ready to accept this particular loss. Thus, the turn for the better.

I'm also pretty excited that I'll soon be back to modding Oblivion, watching anime, and balancing my other bajillion hobbies. I'm not ready to transcend my physical body. Heck, I'm just getting back into the swing of touching this mechanical beast that causes me so much pain.

So, before you go, remember this: If you get burned playing with fire, don't let that hold you back. Get some asbestos underoos and hop back into the flames. Saying that makes me understand that silly billboard of the surfer that suffered limb loss from a shark attack. "Me, quit? Never!"

Hah! It still makes me laugh. What a silly billboard. If my computer ever took my arm, I'd beat the crap out of it. Then I'd have it stuffed and mounted over my fireplace…if I had one. Finally, I'd buy a more obedient computer.

Modding Oblivion, Take 2

Posted in Development, Software, Video Games on April 26, 2006 by osake

During my hiatus, I read a little bit about texturing and modeling, so I've also started to fool around in that realm. Unfortunately, I've suffering from another hardware loss. My drawing tablet. Mouse editing of textures is super tedious for me, and I really like the tablet action when available. So for now, I'm putting that on hold until I can get a new drawing tablet.

Back on track, I recently discovered that the construction kit tells you the ID of what you want to load when you mouse over the NPC (or something like that.) So I now have the black bear ID…00097A15. At last! Time to test the script which I previously attached to this mysteriously untouchable bear. Failure. That's okay. I'd rather fail from trying, you know the saying.

I spent some more time with it and scored a usable script. It's not exactly what I wanted, but it's a start. Maybe I'll have something publishable soon. I haven't decided yet on this particular concept because I really wanted to be able to attach it to the player in some way. An attribute if you will. Ahh, back to the drawing board.

Modding Oblivion, Take 1

Posted in Development, Software, Video Games on April 21, 2006 by osake

So I've been playing Oblivion for a couple of days now, and I've heard about modding it, read about modding it, but hadn't tried it. That was until last night. I started with the couple of tutorials I found on it, then took to the road of writing my own mods.

Let's just say I wasn't super successful. My first problem, was I didn't read up enough on the syntax of the language. Okay, so I went back and read that instead of having something like:

timer = 10

you need something more like:

set timer to 10

Cool, fine, whatever. Every language I've tinkered around in has had growing pains. So, let's get this script setup and run with it. Well, I decide to attach this script to a bear. A black bear. I re-launch Oblivion and then I say, "D'oh!" I don't even know how to load up a bear. Back to the reference. Right, so player.placeatme <FormID> gets me the NPC I need. Alt+Tab back into the game, and BAM! A bear?!? No, another error. I can't load the bear. Why? Apparently, I don't have its FormID. After more searching, I find some nice reference sites that list NPC's, but guess what… keine Bären!

I'm tired at this point, but not down yet. I cheat my way into that monster testing area. Find the right door, find the right bear, and get the ID. I diligently type the command to load the bear. No dice! WTF? I'm done. I headed for the bed and will tackle this beast, later.