Week 10

Leave a comment

With the end of week 10 comes the end of the Fall quarter here at RIT, and my work on the Python/XO/Sugar version of Blocku. Since the last post, I’ve added quite a bit to the game. Here’s the commits from our git repo –

Blocks now spawn in random positions, made the solution-checking more accurate

The game now reads in a text file containing the board (boards/testFile.txt)

Updated Instructions screen

Game now plays sound (trololo guy) when board is solved correctly (after pressing A)

Unfortunately we didn’t get a chance to sugarize the game. It was sugarized when we inherited the project, so there shouldn’t be too much that needs fixing. The only major change was that we worked on Blocku with Python 3.1, while the XO is using Python 2.6. Some code will need to be updated to work correctly with 2.6 before the game will work on the XO. From this point, Kai Ito will be the only one still working on Blocku, as he’ll be doing a continuation of the course through a co-op.

As for Blocku, I will be working on an XNA version of the game with the intent of submitting it to the National STEM Video Game Challenge, a competition to develop games focusing on Science, Technology, Engineering, and Math (or STEM) education. You can find the Blocku website at blocku.sourcefortsmod.com – I’ll have a proper domain and website set up in the near future. If you click on the image on the website, it will take you to our YouTube page.

The XNA version of Blocku can also be found in the same SVN as the Editor (links are on there on the site). This past Sunday I spent some time working on the XNA version, and it is now caught up to (or even a little advanced) past the XO version. Future updates about the project will be found on the website.

Blocku Editor

Leave a comment

So, for the past 10 days or so I’ve been working on the board editor for Blocku. The editor is a tool that will let teachers, parents, or even students create their own boards to play in Blocku. The editor is currently in a quasi alpha-beta stage, and will hopefully be completed within the week. There is an SVN repo set up for the editor at: http://blocku.sourcefortsmod.com/svn/. Downloading/updating is open to everyone, but a login is needed to commit. The editor is written in C#/XNA – downloads for both XNA 4 and Visual Studio Express can be found online, for free (VSE 2010 or Visual Studio 2010 is needed for XNA 4).


Currently, you can choose to create either a square board or a free-form board that you design yourself. At the moment, you can only create a 3×3 board from the menu (you can change the size of the board in the Game1 class, line 25). In a future release a screen will be added to let the user choose what size board to create.

Once you select the board type, you are taken to the next screen. If you selected a square board, the blocks will have already been generated; if you selected free-form, you will be given a blank slate to work upon. In both versions you are given an “Add Block” button, so if you choose a square board then decide you want more blocks, you can add more without having to re-do all your work.

The save button at the bottom of the screen will create a text file containing all the necessary information about the game. These files can then be put on the XO and, when loaded, will show up in-game exactly as they looked in the editor, including block color and position. The file format is as follows:

total # of blocks
Xpos Ypos BlockHeight NorthTextbox SouthTextbox WestTextbox EastTextbox R G B

Currently, only one text file at a time can be saved – the editor will overwrite an old board if it is still present. Saved boards can be found at BlockuEditor\BlockuEditor\BlockuEditor\bin\x86\Debug\testFile.txt. If you want to save multiple boards, simply copy the text file somewhere safe and rename it.

One last feature worth mentioning is the textbox. There are 4 of these on each block, and one at the top of the screen for the teacher to put the answer in. As noted above, the editor is written in XNA. While XNA is a very powerful and accessible language, it is missing some things. Of importance to the editor is the absence of controls you might be familiar with from Windows Form applications – like buttons, labels, and, most importantly, textboxes. This meant that I had to create a textbox control for the editor from scratch.

This actually turned out to be a very interesting exercise. One of the things that I’m aiming for with the editor is to make it as easy to use as possible. Part of that goal is what I would call ‘system continuity.’ In a Windows environment (although this is pretty similar across any desktop environment), there are certain ways you expect a textbox to behave – being able to delete characters, being able to use the arrow keys to navigate through your text, that little blinking cursor that appears after whatever you just typed. When you create a Windows Form app, controls are included in Visual Studio, so you don’t have to worry about them behaving differently from one application to the next.

For the editor, I’ve done my best to replicate these behaviors, and to make the editor as intuitive as possible. When you click on a textbox, it becomes highlighted, so you know where you’re typing. A blinking red cursor will show you where to type, and all the keys work – even when holding down shift. You can also navigate through a textbox with the arrow keys, and insert and delete characters at any point. As of now, the textboxes in Blocku feel very similar to the ones people are used to using in their everyday activities.


The editor is far from complete. Below is the ‘Must-Have’ list:

  • Screen to choose what size grid to spawn
  • Finished interface – a background for the actual editor part, which will match the in-game background
  • Ability to specify a file name and location when saving boards
  • Package the editor to an executable that can be easily downloaded and installed

Luckily, there isn’t much more needed to get the editor to a deploy-able state. There are a few features in the works for future releases, that may or may not be finished by the end of the quarter.

The first is block movement. Currently, if you drag a block into another block, they will get ‘stuck’ together at the point where the mouse entered the second block. While the blocks can be pulled apart, this is somewhat annoying, and can mess up a board if the user is not aware of this behavior. This should be a pretty easy fix.

The second is the ability to select multiple blocks. Take a look at the screenshot below of a board I tried to build in the shape of a pyramid.

It looks good, except for one thing – the top block is cut off at the top of the screen. I built this board from the bottom up, and actually ran into this problem a couple of times, and each time I had to move every block in order to make it fit. It would be really helpful to be able to draw a box around several blocks and move them all at once – like moving icons on your desktop.

The third is with regards to the textboxes. Currently, when you click a textbox, the cursor will appear where ever it was when you last used it, regardless of where in the box you actually clicked. This isn’t too bad for the textboxes on blocks, since those will only be a few characters long. It does get kind of annoying having to hit the arrow keys several times in the Answer textbox at the top of the screen though. Luckily, this isn’t too big of an issue, and can wait to be fixed.

I’ll be wrapping up my work on the editor pretty soon (hopefully). At that point I’ll get back to working on the actual game, as we try and have a playable build by the start of next week.