A Pinball Prototype

April 24, 2009 at 6:57 pm (IceCream, XNA) (, , )

Last night I set myself and a friend a challenge. Make a game in 1 night. We’ve done it before with Rock Paper Scissors Live. This time we failed, miserably. It’s not a functional game by any stretch of the imagination, however it is a cool little prototype.

2D Pinball was the genre we chose, so I created a new IceCream project and off I went. Using the Farseer integration it meant I had something up and running in no time, but it was proving difficult and time consuming to get the physics settings to feel like a pinball game. IceCream support for Farseer isnt quite complete yet, so there was quite a bit of code to write surrounding Springs and Joints. After some quick tweakage after arriving home I’ve got it to feel much better and much more like a pinball game. Here’s what it looks like now. I wonder if I’ll come back to this project and turn it into a game 🙂 could be fun.

pinball

Permalink Leave a Comment

IceCream Release (Update)

April 20, 2009 at 5:26 pm (IceCream, XNA) (, , , )

After finally releasing a release of IceCream early this morning which was probably not my wisest move as I was rushing and it showed in the release. Firstly I just messed up but secondly there were a couple of bugs I’ve been coping with that I should not have inflicted on anyone who tried it out. These were when you tried to open a project file and it couldnt find the scene file or no scene file was to be opened, the loading progress screen would stay alive and look like the app had hung. It didn’t, you just close the progress window and it’s ok to use. The second bug was deeper, when you open a project while already having a different project open, it would die a horrible death. I’ve been working hard on SBARG so it’s been a single project for me for some time. Both these bugs are now fixed in this release, along with an appropriate version number along with being compiled in Release mode so that should eliminate any debug performance issues.

You can grab the latest download of IceCream release here.

Again, please feel free to leave feedback, suggestions, comments or if you want some help email me at conkerjo at hotmail dot co dot uk.

Permalink 1 Comment

IceCream quick and dirty crash course.

April 20, 2009 at 1:18 am (IceCream, XNA) (, , )

So now that IceCream has been let out of the bag, how do you use it? well this post should give you a better idea of how a IceCream game is built and what are the basics of making your own game.

In the release there is a IceCreamPong demo sample, so let’s use this as our example.

This consists of a Visual Studio XNA Game 3.0 project, just like any other game project you would create. The installer adds a template for you which adds the reference and creates the default files. There is also a Game.icproj file. This file is the IceCream project file and is used by Milkshake to open your project.

Next is the global.ice file. This is a global data holder for template scene items and global assets such as materials.
Then you will have 1 or more scene files for your game, this sample contains TestScene.icescene. This is the main data store for any scene in your game. Both the scene files are xml and can be edited by hand, I highly recomend studying the data before attempting this though.

The game project contains a reference to the IceCream.dll. You will notice a lot of similarities with a standard XNA game project, we also gave a Game1.cs file which is our main game entry point. The difference is we inherit from IceCream.Game instead of the normal Game class from XNA.


public class Game1 : IceCream.Game
{
IceScene scene;
public Game1()
{
}


protected override void LoadContent()
{
base.LoadContent();
scene = SceneManager.LoadScene("Content/TestScene.icescene");
}
}

All it takes is 2 lines of code to get a scene up and running.
This is important the base.LoadContent(); method call must come before you LoadScene call as this is what loads the global content potentially required by your scene data.

When the LoadScene method is called it loads the specified file into the SceneManager.ActiveScene property if it’s the first scene loaded.

Next we wil take a look at the components. In IceCream there are 2 types of Components. A IceSceneComponent which is added to the Scene.Components collection and a IceComponent which is added to a SceneItem’s Components collections.

These components are updated on every game update much like the component system built into XNA except with more flexibility.
The IceComponent contains a property called Owner which is a reference to its Owning SceneItem, but a IceSceneComponent has a property called Owner too which is a reference to its owning Scene.

In the sample game we have an IceSceneComponent called PongEngine. This has been added to the scene in the TestScene.icescene file.

When the LoadScene method is called this Component is added to the scene and the OnRegister method is called.

public override void OnRegister()
{
Instance = this;
Enabled = true;
BottomWall = (Sprite)Owner.GetSceneItem("WallBottom");
TopWall= (Sprite)Owner.GetSceneItem("WallTop");
SetupPlayers();
SetupBall();
}

A couple of things to point out here, the Owner property is a SceneItem so it needs to be casted to a Sprite in this instance. But if you look more closely we have Owner.GetSceneItem method, this will retrieve the SceneItem if it’s registered in the scene with the specified name.

If we look at the decleration of the Component we see how IceCream & Milkshake utilize your custom components.


[IceComponentAttribute("PongEngine")]
public class PongEngine : IceSceneComponent

Some of the other types of SceneItem available are

  • Sprite
  • AnimatedSprite
  • TileGrid
  • ParticleEffect
  • TextItem
  • PostProcessAnimation
  • One of the cool things about IceCream is you can add Components to the scene and SceneItems from within Milkshake by right clicking an item in the main tree.

    I know this is only a brief overview of a tiny portion of what IceCream is. I will be writing more specific articles very soon.
    If you have a specific task you want to achieve, please post a comment and I’ll gladly help.

    Permalink 1 Comment