Archive for December, 2011
I’m sure everyone has been waiting with baited breath to see what became of the typing game that I mentioned in my last post. It’s coming up on the last weekend of my vacation, and I wanted to make sure to finish the game before I have to go back to work. It’s always incredible how much work there is to ‘finish’ any project. In particular, I always forget that with games you want to support sound effects, music, icons, etc. It took a while, but I’m finally decently happy with the game as it stands (meaning that for a brief moment I’m just too tired to think about any more changes).
I learned a lot about XNA from this project. Particularly about 2d sprit manipulation. The XNA content pipeline is a thing of beauty really, it’s so convenient just to be able to plop all of your assets into the content project and load them using the content manager. It’s also a great place to do build time processing and manipulation.
I also learned that I still have no idea how to draw good looking sprites. I had originally planned to have several different space ships that varied depending on the length of the word being typed, but ultimately gave up after I had started on the first ship. I spent a lot of time tweaking the ship I did end up with, and it still looks awful. It’s not so much the general shapes that seem to cause me problems, but the actual texturing of the object. I have like 16 million colors to play with, and my ships look only slightly worse than the 16 color Gameboy sprites.
I thought about trying to craft some music myself. I even watched several videos explaining how to use FL Studio. The videos convinced me that no matter how good the software has gotten you still need to have some form of rhythm to compose decent music. The guy giving the tutorial would often put together a quick pattern and then play it, and I’d be bobbing my head and thinking wow that’s awesome, and then he’d spend the next 30 minutes explaining how terrible that sounded and showing all of the things that needed to be done to make it sound reasonable. If I ever switch professions, video game composer is not going to be high on the list of options.
The game itself ended up being pretty close to what I had envisioned. The basic idea is that ships fly across the screen with words ‘mounted’ on the top. The goal is to type those words before the ships make it to the other side of the screen. You start the game with 3 lives, and each time a ship reaches the left side of the screen, you lose a life. When you have no lives left, the game is over. There are 10 ships per ‘level’, with an unlimited number of levels. A ship’s speed is dictated by the level that you are on, insomuch as the speed increases on each level. There are 3 difficulties, easy, medium and hard. The difficulty controls how quickly a new ship will start heading towards your left side. I’m not convinced that hard is really that much more difficult than easy, so maybe I’ll need to tweak that.
There were several problems that I hadn’t considered when I started, which are amusing in retrospect:
- I had to find a word list to use which wasn’t too hard. Unfortunately after playing the game a bit, I started to notice that there were all sorts of profanity in the words it was choosing. Honestly the random number generator seems particularly prone to picking out the dozen or so swear words from the dictionary, because pretty much every game it would throw something out there. I had to remove these by hand, which almost certainly means I’ve missed some. Oh well…
- It turns out that playing on landscape was way easier than portrait for a long while. The reason? Landscape is quite a bit wider than portrait, and since the ships go from right to left, it took them longer to get across the screen. I eventually fixed it by just scaling their speed appropriately.
- There is no API at all for the phone keyboard (it’s meant to be ‘invisible’ to app developers). Unfortunately that makes programming a game that needs to know what kind of keyboard is being used, how large it is, what keys have been pressed, etc. very difficult. I think I figured out most of the issues, though ultimately the choice of landscape vs. portrait, and hardware vs. software keyboard is made in the options page prior to starting a game and can’t be switched until the next game. Worse, it’s entirely possible to claim a hardware keyboard even if you don’t have one (which means that the software keyboard will be drawn, but the ships might fly below it). There is still one bug sitting around where the software keyboard will randomly disappear. Touching the screen brings it back… but I have no idea why this happens and cannot figure out any repro for it.
I will probably throw this up in the Windows Phone Marketplace after I get some folks to try it out and let me know what they think. Anyway, I thought I’d include a short video showing what the game looks like:
Anson and I have really been enjoying the holidays this year. We were lucky that Anson was able to take some time off in December to relax and have fun. And by “have fun,” I mean “write apps.” He’s written 3 so far, including a cute Christmas snow app for me! Considering there has been no sign of snow yet, it’s nice to be able to see it on my phone. Gotta love my hubby 🙂
To kick off the season, we went to Jane and Eric’s annual Christmukah Party. Delicious food, good friends—it was awesome! It’s my yearly excuse to drink eggnog 🙂
Here’s a pic of the entire group (Thanks Sunava!). Anson and I are the ones in the ridiculous Christmas sweaters. You can’t really see mine, but you can check out Anson’s new sweater—Santa is golfing on it. I need to find a better one for next year though. I’m thinking a flashing Rudolph nose would be awesome. In the meantime, we have some pretty awesome Christmas socks to help make us look a little more Christmas-y. I mean, when else can you get away with wearing these clothes?
The next night, we went to see the Nutcracker. I LOVED IT! The dancing was so impressive and it SNOWED ON STAGE! We may have to make this a holiday tradition! Plus, it gave us an excuse to get dressed up.
On Christmas Eve I rang bells with my church choir. This year, we rang Hark the Herald Angels Sing. We also rang Little Drummer Boy while the children’s choir sang. It was a lot of fun! If they end up sending out a recording of the performance, I will post it.
In the wee hours of the morning, Santa arrived and we were able to open our presents! We were already in our Christmas jammies—I had reindeer footie pajamas and Anson had robot jammies.
We had a lot of fun with stocking stuffers this year. Or should I say, Anson had fun with stocking stuffers this year. It was a complete surprise!
I got a flip/flap plant (I can’t kill it! yay!).
Naturally, it was from a reindeer:
Anson and I both got 6 pairs of Christmas socks, but Beta tried to steal them.
I got some cupcake lip gloss from Mrs. Claus—she knows how much I like to bake!
And Anson got some lightsaber chopsticks from Darth Vader. Don’t ask me how Vader got involved with Christmas. I’m thinking maybe Anson is sending his list to the wrong guy 🙂
Anson got me a glowing necklace. We were having trouble getting a good pic of it, but believe me when I say that it is glows purple—super cool! Plus, I got several colored necklaces from Aaron and Daniela. I’m set!
We also got to play with some gifts from our family:
Anson got a train set! I need to get a new picture (it is currently running around our Christmas tree). He also got a sound bar for the tv. Now we’ll actually be able to hear our shows without turning the volume all the way up!
Games! We’ve played Pirate Fluxx a few time and Anson will probably start playing Batman while he’s still off work. Fun stuff!
Anson got me a stand mixer for my Christmas gift! Now I’ll actually be able to mix things without pulling a muscle in my arm. Thanks hun!
And, of course, we exchanged our traditional anniversary ornaments. He got me a crystal candy cane and I got him a Gizmo ornament. I figured that his favorite Christmas movie should be represented somewhere 🙂
We want to thank our families for sending such wonderful gifts! I need to start writing some Thank You cards—and I can do that easily since Mary gave me some nifty card-making materials for Christmas. Merry Christmas EVERYONE!
A few weeks ago at Thanksgiving, Irfaan introduced us to a new board game called Betrayal at House on the Hill. The game is a lot of fun and it’s different from any other board game that we have played before. The game is divided into two main phases. The first phase consists of exploration where there is no real objective other than to try to ‘improve’ your character by finding items, increasing your character’s stats, and triggering events that may help you in the second phase. The second phase, known as the ‘haunt’, starts after a random number of turns. In this phase one of the players turns into a traitor and the objective of the game is revealed. There are roughly 60 different unique scenarios in the game, again randomly determined, all of which have unique objectives.
The game itself is a blast to play, but pretty quickly we realized there was one major flaw. The stats, which dictate whether a character is alive or dead, how far the character can move during a turn, how well the character survives various events, and pretty much every interesting aspect of the game are tracked by moving 4 small plastic pointers up and down the side of a cardboard character cutout. The problem is that these plastic pieces tend to slide and the space between each of the values of any given stat is very small. For the first couple of times that we played the game, we resorted to paper and pencil to keep track of the stats in addition to the cutout to make sure that we were tracking them accurately. Ultimately, since I was on vacation last week, I decided it would be fun to solve this problem with a Windows Phone 7 app.
I hadn’t written a full WP7 app before, and it’s been something I’ve been meaning to do for a while. I figured the stats tracking app would be a good starting place because the app itself was conceptually pretty simple. I figured it would have two screens, a character selection page and then the page on which the stats were actually tracked. The trickiest, and most interesting, part of the app had to do with tracking the actual value for a stat. In the game it’s important that for any given stat you can see the value that immediately precedes and immediately follows the current selection. The reason this is important is because the game often gives you a choice about what stat to increase, and the scales for the stats are nonlinear. It’s entirely possible to increase speed, for example, w/o actually being able to move any faster (e.g. the scale might be 3 3 4 4 4 5 5 6 6 8). In that case, it might behoove you to increase your might instead. Unfortunately there was no ‘out-of-the-box’ control that had exactly the look and feel that I wanted. The DatePicker/Calendar control was probably the closest, except that I didn’t want the selection ‘wheel’ to disappear when it lost focus, and I wanted it to be horizontal instead of vertical. Ultimately I decided to write my own control.
I finished the app near the end of last week, though it really only took a couple of days to get it entirely functional. I learned a lot in pretty short order – all of which I think are fascinating, and will probably bore anyone else to tears that managed to read this far:
- The selection of a listbox in WPF and Silverlight is tracked via hashcode. So if you happen to databind to a List<int> and your list duplicate multiple values then your selection will be wonky. In the multi-selection case it will select all of the numbers of the same value, and in the single selection case it will simply select the one that appears first in the list.
- The performance tools for WP7.1 are really good. It was pretty easy to figure out why selection in my app was slow (which I didn’t even notice until Luke said – hey! why is selection so slow!). Sadly it was non-obvious on how to make it faster. In reading about performance tips for phone apps, it turns out that I did pretty much everything wrong. In general, my biggest performance problem was simply that the visual tree for my character stats page was too complicated. Outside of removing controls, optimizing the display, and removing certain converters, there was little I could do to speed it up. Ultimately I delay loaded some controls which made the experience better but didn’t actually speed up the loading of the page.
- Microsoft Express Design is a fun product to use to make small graphics, such as for the icon of your app. I made a haunted house design of which I’m very proud. Everyone else that’s seen it hasn’t thrown up, and given my artistic talent, that says a lot for the software.
- JPGs load faster than PNGs, content loads faster than resources.
- The new Beta option on the marketplace is really cool. It publishes the app comparatively quickly. My experience was the app could be downloaded within 12 hours of being published. That said, it sucks that you cannot update a Beta app. I ended up creating a second ‘Beta’ after I got some feedback and wanted people to try out the new version. That requires putting in all the same information again. It also sucks that you cannot tell when the app can actually be downloaded by people. You know when it’s ‘published’ (which happens within an hour or so), but it’s many hours after that before the folks you’ve added to the Beta can actually get the app. They don’t get sent email, so you sort of just have to keep trying it until it works for you and then send them email yourself. The best practice seems to be to wait a day or so. Until they fix the update thing, you really shouldn’t bother until you think you’re really done the app and you want broader testing. The best thing about it, of course, is that the people trying the app don’t need a developer unlocked phone.
- Saving state is pretty easy, but implementing the INotifyPropertyChanged pattern just generally sucks in C#. There is so much boiler plate code.
- I remain confused about capabilities. I tried removing all of the ones I don’t need (which is all of them), and the next time I opened the project the tools prompted to me add them all back. I figure I’ll just leave them there for the moment.
The app ended up looking like this:
The icon for the app, of which I continue to be happy with of despite the looks of confusion when I show it other people, looks like this:
I don’t know that I’ll actually post the app to the real marketplace or not. I’m waiting to hear back from the company about whether they would be okay with the usage of some of the artwork from the game. That said, it turned out pretty much exactly how I imagined it which is always gratifying. Phone development is really a lot of fun since it brings back that feeling that it’s possible to write a complete app by yourself. That said, the quality of a lot of the apps on the store is pretty amazing. In particular, a lot of the games are flat out astounding. Still, it’s fun to write apps that you can use at least for yourself 🙂
I was going to switch over to do some Windows 8 development, but I had so much fun working on the app above I decided I would do another quick phone app this week. I wanted to try a 2d XNA game. My general premise is a ‘typing texting tutor’. The idea is a simple game that has words that fly across the screen. You try to type the words before they get to the other side. The dictionary contains normal words + a lot of SMS acronyms. I just started, but already I’ve found that the keyboard API for the phone is woefully inadequate for what I’d like to do. The other thing that is woefully inadequate are my drawing skills. This is what the app looks like so far. Hopefully it will look much better, and be functional, by the end of the week: