Jason L Perry

Ambethia

Downgrading From the Rails 4 Beta

Did you just start a new greenfield Rails app, want to get a head start with the Rails 4 beta, only to find out some dependency or another you would need wasn’t ready for Rails 4 yet, and updating it yourself might be non-trivial? I did.

Here’s my notes on downgrading from Rails 4.0.0.beta1 to Rails 3.2.

In the Gemfile, change:

gem 'rails', '4.0.0.beta1'

To:

gem 'rails', '~> 3.2'

You might need to change the versions of other gems as well, depending on your setup.

In config/environments/development.rb, remove or comment out:

config.active_record.migration_error = :page_load

In config/initializers/session_store.rb:

MyApp::Application.config.session_store :encrypted_cookie_store, key: '_my_app_session'

Change :encrypted_cookie_store to :cookie_store.

In config/initializers/secret_token.rb:

MyApp::Application.config.secret_key_base = '...'

Change secret_key_base to secret_token.

The asset pipeline is enabled by default in Rails 4, so you’ll need to turn it on for your Rails 3.2 app, in config/application.rb:

config.assets.enabled = true

Depending on if you made use of the feature, you may also need to setup Strong Parameters yourself. It’s built into Rails 4, but abstracted into a gem for Rails 3.x. I’ll leave this as an exercise for the reader.  

The Ladu

The Ladu is a puzzle game (a Sokoban clone). The game uses the LibGDX game library, this time I opted to implement it in Java (Lucky Princess Nitro was written in JRuby). “The Ladu” is my second game completed for #onegameamonth, and really, my second game ever. It’s also my first real experience with Java, which went better than expected. I decided to try some tricks with pseudo 3D lighting on the 2D artwork, and I think it looks awesome. I may write a blog post on that subject alone in the near future.

My friend James did an excellent job the artwork. I’m really proud of what we were able to accomplish with so little time, just nights and weekends over the last 5 weeks for both of us. The music is one of the first compositions I’ve made in almost a decade, and I’m also really pleased with how it turned out.

I look forward to hearing any feedback you have on the game, so comment here or drop me a line some other way.

Screenshots

Gameplay

There’s actualy no “help” in the game, I didn’t get to that, so here’s the keys you can press. There may or may not be cheat “functions”.

Key Action
←↑→↓ Move player
HJKL Move player (for Vim hackers)
WASD Move player (for 1337 gamers)
Esc Exit to menu (or quit the game from menus)
X Restart a level
M Toggle music
N Toggle sound
F Toggle fullscreen
Scroll Zoom

The goal of the game is to push all of the silver widgets onto the brass sockets. There is no undo, only restart, so relax and take your time solving the puzzles.

Download

Altering the OS X Host in Loom

Today I got introduced to the Loom Game Engine. It looks fantastic; the feature set, supported platforms and philosphy all seem to be just what I’m looking for. I’m going to reserve judgement on “LoomScript” for now. An open mind…

As I was playing around with it this evening, something kept getting under my skin. There didn’t seem to be a way to configure the generated application name, it’s perpetually hard coded every where as “LoomDemo”. So you’re stuck with LoomDemo.app, LoomDemo.exe, the property lists and manifests for mobile apps are also all filled with “co.theengine.LoomDemo” instead of “com.yourcompany.YourApp”.

I decided to poke around in the SDK’s source and see what all would be involved in customizing the host. Things started off well, when I looked the top level CMakeLists.txt file there’s a couple options:

#--------------------------------------
# Configuration Options
#--------------------------------------

# This is the name of the binaries/.apps we generate
set(APPLICATION_NAME LoomDemo)

# The package for the application.
set(APPLICATION_PACKAGE co.theengine.LoomDemo)

I go ahead and change them:

set(APPLICATION_NAME Ochre)
set(APPLICATION_PACKAGE com.ambethia.ochre)

Install the SDK according to the docs:

rake deploy:sdk[ochre]

I also needed to install the Android NDK, that was easy. Some more things blow up because I have a more recent install of XCode without the iOS 6.0 SDK. I only have 6.1 installed. That’s okay, looking through the rake file, I see there’s an environment variable I can set for this:

IOS_SDK=6.1 rake deploy:sdk[ochre]

The project generation and complilation went well, but when the rake task gets to the part where they package up the SDK, they are looking for LoomDemo again. It look’s like “LoomDemo” is hard coded all over the Rakefile too. Blargh. Right around line 60 in the Rakefile, after the settings for the IOS_SDK environment variable, I add this:

if(ENV['APP_NAME'])
  applicationName = ENV['APP_NAME']
else
  applicationName = "LoomDemo"
end
puts "*** Application Name = #{applicationName}"

Next, I find and replace every other occurrence in the file of LoomDemo with ${applicationName}. I run the deploy task again:

IOS_SDK=6.1 APP_NAME=Ochre rake deploy:sdk[ochre]

Side note: I also needed to install the rubyzip gem (gem install rubyzip).

At this point my “customized” SDK is installed:

$ loom use
Listing installed loom sdks...
   1.0.776
 * 1.0.782
   ochre

Sweet!

∴ loom use ochre
Configuring Project...
Checking for sdk ochre
Preparing sdk files...
    Adding permissions to LoomDemo at
/Users/ambethia/.loom/sdks/ochre/bin/LoomDemo.>     app/Contents/MacOS/LoomDemo
error: No such file or directory - /Users/ambethia/.>     loom/sdks/ochre/bin/LoomDemo.app/Contents/MacOS/LoomDemo. Use >     --trace to view backtrace

Blarg! I take a look at the backtrace for the exception, and find that LoomDemo is also hardcoded into the CLI scripts. Are you kidding me? I’m a bit frustrated at this point, but I’m confident that this is something the team at The Engine Co. will be fixing, so for now, just a quick hack will do.

$ subl /usr/local/loom/lib/helper.rb

And I add this line near the top of the file:

APP_NAME = ENV['APP_NAME'] || "LoomDemo"

And I do another find and replace for “LoomDemo” with “${APP_NAME}”

This allowed me to select my custom SDK. Once I tried to build a .app bundle though, I found another script that needed the same hack:

$ subl /usr/local/loom/lib/loom/build.rb

For further customization, I went into PATH/TO/SDK/application/osx/en.lproj/MainMenu.xib and stripped out all the references to “HelloCpp”, and deleted the extra menu items that aren’t really needed for a game.

I didn’t bother messing with the Application.icns in the sdk source, because the surprisingly build script actually swaps this out for you with what’s in your project’s icons folder. Yay, I hope all of this gets handled by that soon.

It could be that I’m completely daft, and I didn’t need to do any of this to change these things. I don’t know. There’s also a bunch of LoomDemo assets left in the app bundle, and the Android manifest is still littered with “LoomDemo” references, but I’ll cross that bridge when I come to it. I wrote this up now, because I figured I can’t be the only person out there who will want to change these defaults.

Maybe now I can actually get to making something in Loom…

Lucky Princess Nitro

I’ve finished my January entry for #onegameamonth. I actually finished last week, but I’m just getting around to putting it out there.

Now with more action. Added some rough sounds and effects.

This is an old video of the game. I’ll get around to posting a video of the final version soon.

It’s a really simple top-down shooter. The goal is to collect all the orange gems. You can see the nearest ones on your radar in the bottom right corner. The enemies are buggy as hell. Revisions may come in the future.

It’s written in Ruby (JRuby) using the Java library LibGDX (which I really dug a lot, despite Java). I put together a talk for Tampa.rb, the slides and source code (at the time the presentation was given) are on Github.

Download

Requires Java to be installed. I’ll get around to packing up a proper Windows executable soon, maybe with the JRE bundled.

Bowie

Update from the last few days. A bowie knife and a dented baseball bat. These will be 3D printed at a 1/6 scale along with the crowbar and kunai’s from the last two posts. I’ve also included a render of the updated crowbar, now in SubD.

Up next it’s a laminated recurve bow.

Crowbar

Crowbar

Crowbar using bend deformers. Low-poly, I didn’t add the detail to support SubDs (yet).