Sitting Around Waiting…

•November 1, 2009 • Leave a Comment

I’m sitting at my computer, waiting. Not in silent inaction, as if I’m waiting for a call, or a knock on my door. But actively looking for something to capture my attention, and call me to action.

No, because of the miracles of email, RSS, and random other mediums I can actively look for something to do, find nothing, and feel like I’ve been doing something!

But I’m smart enough to know that if anything, I should be calling myself to action. I know there are things I should do, things I want to do, things that are more productive than scrolling through blog feeds.

Don’t do what I’ve been doing.

If you’re not being productive, at least have fun. And if you can’t do either, you’re fooling yourself by looking in the wrong places for something to do.

[quote] Asking a good question…

•October 18, 2009 • Leave a Comment

Asking a good question is like deciding where to put the door. You can cut an ample hole in the front of the building and fit a glass automatic double door that leads straight into reception, that would certainly work. You could take a wild guess and cut a hole into the boiler room, you could still get where you need to eventually, but it could take some time. Or you could take a lump hammer and smash a hole in the wall, leaving a ragged hole that no-one will go near and a very irate person the other side sitting in front of a brick covered desk. To sum up, have an idea about where you want to be and make it clear and simple for those you are asking to help you.

- http://www.sloperama.com/advice/designprep.html

(found this in a random doc on my computer… I should put all my quotes in one place…)

To The Exit… Again!

•October 15, 2009 • Leave a Comment

Last night, after I pronounced Ruby Tower Defense dead, I opened up a text editor and wrote some new code. All it did was draw a green box. Then I started messing with some drawing commands, and had a cool-looking green box.

Then I remembered a simple platformer I had made a while back, I found the code for the player dropped it in and changed one line. (Yay! for using the same engine! :) ) Now I had the player jumping around on green boxes!

Then I started experimenting with varying amounts of green boxes, added an exit, and a level system. A while of tweaking and polishing later, and I had a game!

Then I had to decide on a name… “To The Exit!” I thought, except… I already made a game with that name. So I concentrated my super-duper-totally-awesome game-naming skills and came up with: “To The Exit… Again!” :P

You can get the game from these links:

To The Exit… Again on GitHub
To The Exit… Again Source Download (zip)
To The Exit… Again Linux Binary Download (tarball)
To The Exit… Again Windows Binary Download (zip)
(Sorry mac people, I don’t own a mac)

My high score is 59, what’s yours?

Git vs Bzr

•October 15, 2009 • Leave a Comment

For Ruby Tower Defense, I tried out bazaar (bzr) instead of git for version control. Here’s some quick points/impressions:

Pro Git:

  • GitHub is more intuitive than launchpad.
  • Launchpad is confusing, has links that go where you don’t think they go, hard to find certain things.
  • Git is faster than Bzr (I especially noticed slowness pushing and pulling).
  • I like how git has every branch in the same folder (simply git checkout branch to change). Bzr’s separate folders for each branch seems more clumsy.
  • Running “bzr status” when nothing has changed, says nothing; making me worry it’s not working… I’m used to git saying: “nothing to commit (working directory clean)”

Pro Bazaar

  • Bzr has an easier and clearer install for Windows
  • Launchpad has automated build+packaging system. I don’t need it, but it sure seems like it would be useful!
  • Some of the commands are named better than their git counterparts

Platform Note: I’m using the default git and bzr packages in Ubuntu 9.04 repositories

Git and Bazaar seem very similar to me. But I like the way git does things better than bzr, and the fact that git is faster is a nice plus :)

Ruby Tower Defense is Dead

•October 15, 2009 • Leave a Comment

While I’ve been coding rbtd, I’ve grown tired of it. It’s so boring, the gameplay sucks, I have no grand vision, no motivation to keep coding… So I’m done with it!

It is possible that I’ll come back to it if I ever get the urge, but not now.

Ruby Tower Defense So Far

•October 2, 2009 • Leave a Comment

The code I wrote in Block Bounce was scary, “Please, please don’t make me look at the source again I’ll do anything!” I told myself. I attributed this to awful ad hoc structure I had built. It worked great for the core game, but not for anything else. “You know what would solve all this,” I thought to myself, “a game engine would surely make all my troubles go away!” So I started hacking, and slowly what seemed a decent game engine built up. So far this engine has worked pretty well for rbtd, besides being a major distraction from the game itself…

After spending way too much time creating the engine, I had to actually start work on the game. Some ideas popped into my head and I thought, “I’ll write these down, and design it out!”
*write, write, write*
“Hmm… while I’m at it I suppose I should flesh everything else out!” And that is where the trouble started. I added some ideas for the enemies, how the gameplay would work, pretty much everything. I even wrote milestones!

To cut a long story short: I’ve wasted my time. The whole game is over-designed, I need to start with a simple prototype, see if it’s fun and go from there. At the moment I’ve gone way too far into things that don’t matter, when I should actually be making the game!

Block Bounce on Gentoo Linux

•September 29, 2009 • Leave a Comment
My game Block Bounce! running on Gentoo Linux

My game Block Bounce! running on Gentoo Linux

I installed Gentoo Linux, since I heard it was a good way to learn how Linux works (or at the very least, how the install process works).

Everything went pretty smoothly, but there was one bad thing: I compiled EVERYTHING, no binary packages for me! I had no real hardware to install Gentoo on, so I was doing this in a virtual machine. Compilation is slow enough, but compiling everything from the kernel to Xorg to SDL on a VM takes a very, veeeeeeeeeeeeeerrrrrrrrrrrrrrryyyyyyyyyyyyy long time!

After everything had compiled, I was staring at the GNOME desktop thinking “What now?”And then I decided I would try to get Block Bounce running! Everything installed so easily, I almost felt a little disappointed… But I was happy when I saw my game load up, and I could start playing!

Oh yeah: I wrote a rubygame installation guide for Gentoo!

Programming Language Fun

•September 26, 2009 • Leave a Comment

Found some code I made a while ago, it was an attempt at writing a programming language (albeit a very simple one). I hadn’t gotten it working (maybe I had written it while I was tired), and decided I wanted to.

Here’s the source for a program using the most awesome language ever :) :

The Books Of Totally Awesome Awesomeness

	Your Commander Is Tyler Church

	Execute All I Say

	Book 1: Printing Stuff

		Show the Deciples What I Am Capable Of

	You Will Obey My Will

	Book 2: Inspired By LOLCATS

		Show the Deciples I Can Haz Teh Cheezeburger

	You Will Obey My Will

This is The Word of The Programmer

Which should give us:

What I Am Capable Of
I Can Haz Teh Cheezeburger

I decided it should compile to a Ruby program, and wrote a very short, very unflexible converter:

# Compiler Variables
@indent = ""
@flags = {}
@flags[:exec_all] = false
@methods = []
@result = "# This code was generated by the BOOKS compiler, which was written by Tyler Church\n\n"

# Start Converting Code
text = File.read(ARGV[0])
text.split("\n")
text.each do |line|
	{
	"The Books Of" => lambda { |text| "# Program Name: " + text[13..-1] + "\n" },
	"Your Commander Is" => lambda { |text| "# Original Code Written By: " + text[18..-1] + "\n" },
	"Execute All I Say" => lambda { |text| @flags[:exec_all] = true ; "" },
	"Book" => lambda { |text| if text[0..3] == "Book" ; @indent += "\t" ; name = text.split(":")[1].strip.gsub(" ", "_").downcase ; @methods += [name] ; "def " + name + "\n" ; else ; "" ; end },
	"You Will Obey My Will" => lambda { |text| @indent.sub!("\t", "") ; "end\n" },
	"Show the Deciples" => lambda { |text| "puts \"" + text[18..-1] + "\"\n" },
	}.each do |text, code|
		@result += @indent + code.call(line.strip) if line.index(text) != nil
	end
end

# Process Flags
@flags.each do |flag, value|
	{
	:exec_all => lambda { |value| if value ; @methods .each { |name| @result += name + "\n"} ; end },
	}.each do |flag2, code|
		code.call(value)
	end
end

# Output Ruby File
File.open ARGV[0] + '.rb', 'w' do |f|
	f.puts @result
end

puts @result

# Run the program!
puts "\n-----------Running Program-----------"
exec("ruby " + ARGV[0] + '.rb')

(its a lot more readable if you view it in the plain source window)

That gives us this code:

# This code was generated by the BOOKS compiler, which was written by Tyler Church

# Program Name: Totally Awesome Awesomeness
# Original Code Written By: Tyler Church
def printing_stuff
	puts "What I Am Capable Of"
end
def inspired_by_lolcats
	puts "I Can Haz Teh Cheezeburger"
end
printing_stuff
inspired_by_lolcats

Which outputs this:

What I Am Capable Of
I Can Haz Teh Cheezeburger

It's not really related to game development, but it was lots of fun making it, so I figured I'd put it up here. :)

A Cool Way of Passing Arguments in Ruby

•September 22, 2009 • 2 Comments

As I was programming the game engine for Ruby Tower Defense, I realized something: Sometimes you want to pass arguments out of order (So you can leave certain default parameters, but skip past others). It appears that in Ruby, there is no built-in way to do this. To give an example:

class Text < Engine::GameObject
    def initialize x=0, y=0, text="TEST STRING", size=20, \
        color=[255,255,255], font="FreeSans.ttf", aa=true
        # initialization code here
    end
end

So if I wanted to have the text “Hi!” at 200, 50:

Text.new(200, 50,"Hi!")

But what if I want to change anti-aliasing (aa) to false? So far, I’d been entering everything in order. I remembered back to when I was using Python, where I could pass arguments out of order, if I specified the variable names. I tried this in Ruby:

Text.new(x=200, y=50, text="Hi!", aa=false)

and size would become equal to false, not what I wanted…

Then after messing around for a little while, I found out that you can pass a hash to a method, in a way that looks about right from the outside:

Text.new(:x => 200, :y => 50, :text => "Hi!", :aa => false)
# It looks event better if you leave off the parenthesis,
# but if I don't wordpress turns x into a smily

But has some problems on the inside:

class Text < Engine::GameObject
    # Creates a new Text object
    #
    # Parameters are in hash format (i.e. Text.new(:x => 30, :y => 500) )
    # Takes:
    # * x position (:x)
    # * y position (:y)
    # * the text to display (:text)
    # * Life (:life)
    # * color (:color)
    # * Anti-Aliasing (true or false) (:aa)
    # * Font Size (:size)
    # * Font file to use (must be ttf) (:font)
    def initialize settings={}
        # ||= is the ruby conditional assignment
        # operator, only if the variable has no value
        # is it assigned the value
        settings[:x] ||= 0
        settings[:y] ||= 0
        settings[:text] ||= "TEST STRING"
        settings[:life] ||= 1
        settings[:color] ||= [255,255,255]
        settings[:aa] ||= true # Anti-Aliasing
        settings[:size] ||= 20
        settings[:font] ||="FreeSans.ttf"
        # ...
    end
end

This works, but with two drawbacks:

  1. More to type (but I could create a function to make this better)
  2. We lose auto documentation, and have to write it ourselves

Update: See comments

It’d be much better, IMO, if Ruby supported this internally… But this’ll have to do for now!

Tools Programming

•September 17, 2009 • Leave a Comment

I’ve created some tools lately, and it’s been fun making them. Realizing this I started thinking about what I like about making tools vs making games; Then I made a list!:

Why I like tools programming better:

  • More objective
  • Different integration challenges
  • Makes making games easier
  • Makes it easier for others to add to your game

Game Programming:

  • Your end result is FUN!
  • Different problems from normal application development
  • Other people (non-programmers) can see why what you made is so awesome
  • Many programmers are interested in game development, and you can get questions like: How did you do that!?