Monthly Archives: January 2015

X Marks the Language

So, I accidentally discovered an awesome little language for game programming. There I was, browsing Hacker News and clicked a link to read some blog post. The post was well written and interesting so I noted the url to come back for more later.

A week later, wanting something to read, I started going through a couple older posts on the previously noted blog and came across this article on community and vibrancy. In it the author referred to an amazing community around a language that most “real” programmers look down on and the amazing productivity that people seem to be getting out of it. I checked out the language, which in turn led me to a spinoff language/framework that had been created.

X Marks the Monkey

The language in question is Monkey-X. It is for game programming and has a lot of similarities to Basic. What is cool about it is that it is designed to write the games once and publish them on multiple platforms, including Xbox, Mac, Playstation, Android, IOS, Windows, and the Web.

Two of the things that really got me excited about it though is that for publishing to desktop and web, it is completely free (as in no dinero required) and it is available to run on Linux. Not that your average gamer plays on a Linux box, but I sometimes do (Battle of Wesnoth anyone?).

Get Started

If you want to try it out you can download it here, although you will need to create an account on their website.

In addition, there is a fantastic series on getting started with the language and even making a simple game on youtube. The links can be found in the Monkey-X forum. Or you can go directly to the youtube channel.

Programming Action in 2015

Not sure why but the new year always seems to be a good time to make plans. 2014 was the year of study. I spent a lot of time reading books and blogs, listening to podcasts, and watching talks on a variety of topics that had a common theme of becoming a person of action instead of a person of wishful thinking.

Therefore, beginning of a new year, it’s time to put this blog to work.

Lots of goals for 2015. Will I accomplish all of them, probably not. Will I hope they happen and do nothing to maker it so? Not this year. This year shall be different.
An action plan will be created to help in the accomplishment of the goals.

PROGRAMMING GOALS:
1. Write 1 blog post every week (52 total)
2. Write 1 game per month (11 total, using the first month to get prepared)

BUSINESS GOALS:
3. Get and complete 6 freelance programming/consulting gigs.

I have other goals for the year, like learning to play guitar, but this blog will be focused on the these three goals.

Looking forward to making them happen.

Shallow Copy Got Me

How to properly initialize a 2D array in Ruby

I am working on a small game and that game happens to have a two dimensional map. In trying to be minimalistic, the implementation of the map is just a 2d array. For some reason, I decided it was a good idea to learn a new programming language and 2 new frameworks to make this game.
When creating an array in Ruby, one can prefill it easily like so

myarray = Array(10, 0)

So without reading any documentation I thought “well I think I know what I’m doing” and proceeded to write

myarray = Array.new(10, Array.new(10, 0))

The problem here is that it makes an array of 10 references to the same array. The right way to do it is to use a block following a call to Array with only 1 argument. This is conveniently listed fairly early on in the Ruby Array documentation.

myarray = Array.new(10) { Array.new(10, 0) }

Its just one of those things that happens when you are learning a new language.