Stay Updated!



Designed by:

Robot Foot Games
Puzzler Update 1
Written by Jeff Brown   

So the game is nearly feature complete at this point although I haven't even started on the hard puzzles yet. I built everything so it should scale to any size I choose so we'll see how well that actually works out. :) The game has 24 puzzles and I think I'll do 10 or so super-hard puzzles depending on how hard they actually turn out to be. I also worked out a tutorial that still needs to be improved on because I had a roommate play the game today (who isn't much of a gamer at all) and he was having a bit of trouble after the really easy levels and I think adding the interactive 'cheat' mode I have to the first few levels should help out a lot.

I also implemented the save system so it saves the current puzzle you're on and which puzzles you've completed so you can see which ones you still need to do from the Choose Puzzle screen. I'm not sure if I'm a fan of the arrows that show exactly where each piece goes. It helps the user out because you can see if your puzzle will work before setting it in motion to see if you win/lose.

Puzzler_5You can see how it's currently setup here (temp art) and this looks pretty well until you get into more complicated puzzles then there's arrows all over the place. If you understand how to solve the puzzles then the arrows are more clutter than anything. I want to make it helpful for those that don't know what they're doing yet (which is everyone when they first play it) but unobtrusive otherwise so I'll probably add an option so you can turn it off if you want.

 

The cheat button quickly shows you the solution by highlighting the pieces in order and vanishing away. Right now it shows the entire solution to that puzzle which I think may be too much. What if you just want a hint on which piece you should start at? I think I'll change it so it only highlights one piece (your next move). If someone wants to press it a bunch to let the game basically play itself then more power to them I guess. I don't really know what kind of penalty I'd add to prevent that kind of thing.

 

Next blog post will have a new video to show some everything off.

 

Still on the to do list:

-Background music?

-Find out what I'm doing art-wise (myself or someone else)

-Finish up a couple of sounds

 
Saving/loading on WP7 using Easy Storage
Written by Jeff Brown   

For those that don't know about Easy Storage here's the description from the codeplex project "EasyStorage is a library for making it quicker and easier for XNA Game Studio developers to manage the StorageDevice without all the details. EasyStorage uses a simple API to enable you to add file saving to your game."

 

Nick Gravelyn updated it to support XNA 4.0/Windows Phone 7 and since I've used it with both my games for the 360 I figured I'd check it out for my WP7 game. It's pretty simple to set up on the 360, and I wrote a tutorial on how to do that, and SUPER simple to use on WP7.

 

First off, download the latest build (55373 as of writing this) from here. It comes with windows/360/WP7 stuff and if you plan on supporting any multiple of those platforms then you'll have to look through the included sample to see how they get setup differently. For the purpose of this tutorial we'll just port the WP7 code into out project. From the easystorage-55373 folder navigate to GS4 and copy the EasyStorage folder into your project (and include it). Now that you have it as part of your project we can gut everything except the stuff we need. You can delete everything in the folder EXCEPT for these 3 things:

  • EasyStorageSettings.cs
  • ISaveDevice.cs
  • IsolatedStorageSaveDevice.cs

 

Now you should have a folder named EasyStorage with the 3 files above inside. I created a class called 'Global' so I have access to saving and loading through my project. Here's the class below that you can use for your project.

 

using System;
using EasyStorage;
using Microsoft.Xna.Framework;

namespace YOUR_NAMESPACE_HERE
{
    public struct SaveGameData
    {
        public int lives;
        public int score;
        public bool doIHaveTheKey;
    }

    public class Global
    {
        // A generic EasyStorage save device 
        public static ISaveDevice SaveDevice;

        public static string saveFileName = "YOURGAME_Save";
        public static string containerName = "YOURGAME_Container";

        public static SaveGameData saveData;
        public static SaveGameData loadData;
    }
}

 

Anything you'll want to save in your game can go in the in the SaveGameData struct above. I just have a few placeholders so you can see some examples of what you might save.

Now we just need to initialize our isolated storage. Since I'm working with the GameStateManagement (4.0) I added the initialization in my MainMenuScreen.cs. I'll move it into my 'Touch to begin' screen whenever that gets completed. You can add the code below in your LoadContent() method.

EasyStorageSettings.SetSupportedLanguages(Language.English);
Global.SaveDevice = new IsolatedStorageSaveDevice();

 

Here you can set your supported languages and we also set our isolated storage device to our global counterpart so we can access it if needed although I don't currently have a need to use it. On the 360 I would check to see if it was null (if the user refused storage) before I tried saving or loading data.

 

Now wherever you're saving your data (mine's in GameplayScreen.cs) you'll need to add the following line. I also had to add a reference to System.Xml.Serialization. To add that reference right click on the references folder in your project and click Add Reference. Then just scroll down (in the .NET tab) until you find System.Xml.Serialization and add it. You'll also have to add the using statement at the top: using System.Xml.Serialization;

public readonly XmlSerializer serializer = 
    new XmlSerializer(typeof(SaveGameData));


We need to add the saving/loading methods, as well as a method for each so we can read the data. Add these someplace in the same file:

private void SaveData()
{
    // serialize out some XML data
    try
    {
        Global.SaveDevice.Save(Global.containerName, Global.saveFileName, SerializeTest);
    }
    catch
    {
    }
}

private void SerializeTest(Stream stream)
{
    Global.saveData.lives = lives;
    Global.saveData.score = score;
    Global.saveData.doIHaveTheKey = doIHaveTheKey;

    serializer.Serialize(stream, Global.saveData);
}

So basically this serializes our file and if something goes wrong nothing happens. I have it in a try catch because it was needed for 360 development. I don't think you can remove the storage (correct me if I'm wrong) so putting it in a try/catch block might be a little overkill for working on the phone.


So here's our load methods which look much the same as the saving ones, it just reverses everything. Once again I just ported over the same code I used on the 360 so there's plenty of checks to make sure nothing can throw an exception if a storage device doesn't exist. Possible overkill but better safe than sorry right?

private void LoadData()
{
    if (Global.SaveDevice != null &&
        Global.SaveDevice.FileExists(Global.containerName, Global.saveFileName))
    {
        try
        {
            Global.SaveDevice.Load(Global.containerName, Global.saveFileName, DeserializeTest);
        }
       catch
        {
        }

        this.lives= Global.loadData.lives;
        this.score = Global.loadData.score;
        this.doIHaveTheKey = Global.loadData.doIHaveTheKey;
    }
}

private void DeserializeTest(Stream stream)
{
    Global.loadData = (SaveGameData)serializer.Deserialize(stream);
}

 

And that's everything! When we want to save our game we simply call SaveData() and when I load up my game I call LoadData() in my LoadContent() method.

 

I haven't tried it but you could probably use this as a way for tombstoning also (If the user takes a call or similar and your game is killed). Just set up an event handler that calls SaveData() when your game is deactivated and call LoadData() when your game is activated again.

 

Big props to Nick Gravelyn for keeping the Easy Storage library up to date!

 
Windows Phone 7 - Puzzler
Written by Jeff Brown   

This is the first time this project has seen the outside world so feel free to leave comments/suggestions! The video is at the bottom of the post if you want to jump straight to it. This is my first (of more to come!) Windows Phone 7 game and I have ideas flowing all around my head of things I think would work pretty slick on a mobile device. This is kind of a sliding puzzle game but you'll notice there's no empty space to move pieces around to. My plan for this game is to have a bunch of predetermined puzzles that get harder as you progress. I plan on supporting 3x3 and 4x4 grids (if 4x4 isn't too hard!) which will have up to 8 and 15 moves respectively.

 

How it works:

I'll start with a picture since it explains it pretty well.

Puzzler_1

As you can see #1 and #2 are switched so to solve this puzzle you simple select both of them by either tapping on each one or sliding along them. I selected #1 first and #2 second. The start and end text show where your first piece selected will end up. In this puzzle it can go either way so it's not much help at this difficulty. Here's another puzzle that requires 2 moves instead of 1.

Puzzler_2Here the start and end make a little more sense. The pieces are marked in the order you selected them (in the upper-left corner of each square) so the one with the subscript '1' or 'Start' is the piece that will end up in the 'End' square. So you're always moving the first piece you select to the last piece you select. Each piece in between those 2 spots will be moved to the previous spot (as shown by the arrow). Here's a more complicated puzzle.

Puzzler_3A good hint is that all pieces will be ONLY 1 spot away from the destination spot EXCEPT for the starting piece (there are exceptions to this rule like the first puzzle). In the examples above I always had the '1' piece as the start piece and if you look again you'll notice that the '1' piece is more than 1 spot away from where it needs to be. Using the puzzle above you can see that the '1' piece is 2 spots away from where it should be so you know that's your starting spot. Then you just have to work backwards to get each in it's correct spot. You cannot overlap pieces and puzzles must be completed in 1 complete move.

 

Controls:

You can either tap each square as you go along or if you can visualize how the pattern works ahead of time you can just slide your finger along the path. I used the sliding method in the video below and if you mess up you can tap on the squares (in reverse order) to remove them and select the ones on the correct track. Once you believe you have the correct path setup you can hold anywhere on the screen to move the pieces.

 

Things on my to do list:

 

  • Animate the pieces instead of just snapping them in place.
  • Add some kind of hint system if you get stuck or don't know where to start.
  • An in-game tutorial of some kind so you can learn how to play.
  • Graphics (obviously)
  • Whether I should keep both the subscript numbers AND the faded out boxes or change it altogether. The numbers make it easy to see which piece was which move but the fade is a little harder to tell. Combining both of them gives some visual feedback and absolute feedback (with the numbers). Everything's still a work in progress so it could change anyways.
  • Making more puzzles and seeing if 4x4 proves to be too hard.
  • Get a phone that I can dev on! :D

 

Here's a video showing off how it currently works: