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.