Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Building your own hand-held game console with, Netduino, C# and the PIX-6T4 project

Gaming = fun, right? Writing games with C# = fun, right? Writing games with C# that runs on Netduino hardware = run, right? Wrap all that into a hand-held package and we're talking some serious fun.

Funny enough, coming to us via Fabien's Bit Bucket and his PIX-6T4 posts, that's what today's project is all about.

PIX-6T4 [Building your own gaming console with C# and Netduino]

  • Build Your Own Video Game Console
  • Join the Maker Revolution
  • Use your console as a Turn-Key Development Board
  • Discover The Power of Netduino by 'Secret Labs'!
  • Learn C# Programming
  • Have Fun Building Your Own Games
  • Companion Book Included With the Full Kit

The goal of the PIX-6T4 and its companion book is to teach you how to use 'Electronic and Software Building Blocks' to become a Skilled Maker and, optionally, a Mad Scientist Wink

To achieve this, we'll break down for you the process that we followed when we set out to build a simple video game console from readily available parts. Why a video game console? Because they're fun!... because a game console touches on many fundamental electronic concepts. In addition, a game console offers countless possibilities for learning how to write software: dream up a game and build it yourself by following our examples and techniques.

We chose the Netduino over other types of microcontrollers simply because the programming skills that you will learn on the .Net Micro Framework, as you discover the Netduino, will also be applicable to the full-featured .Net Framework used to build professional applications, large scale web services, mobile applications running on phones and web applications. Our hope is to empower you with life skills that can help you build a career or just build anything you can think of.

Schematics & Parts

Here's what the schematics of the PIX-6T4 look like below.

We tried to make it easy for you to build your own console from scratch if you want and since we don't expect people to be familiar with printed circuit board design tools, we decided to make the schematics available as a PowerPoint file, which most people can easily read on their systems.

...

image

The PIX-6T4 Source Code

The PIX-6T4 code is open source and is part of the netduino helpers repository on CodePlex.

The projects that you will need to build are located in the \Samples folder:

The Brain

  • ConsoleBootLoader: is the program that runs when you turn on the console. Its job is to read the content of the SD card, looking for game modules for you to select in a main menu. When a game is selected, it is dynamically loaded from the SD card and starts. When the game ends, the player is brought back to the main menu.

The Games

  • Paddles: is a two player game of Ping Pong. Each player controls a paddle with one of the analog joysticks of the console, trying to hit the ball back to the opponent. A player scores a point when the other misses the ball.
  • MeteorsFromOuterSpace: is a game where the player controls the movement of a small ship with the left stick of the console, and fires at meteors coming from all directions with the right stick. To shoot a meteor, just point the right stick in its direction

 image

Digging Deeper

If you want to explore how the 'layers of the cake' really work, you should dig into the netduino.helpers project:

  • \Fun: abstracts the hardware away from the game code. It also provides a small framework to write your games simply and efficiently.
  • \Hardware: contains all the drivers for the hardware components used to build the console.
  • \Helpers: contains the resource loader used to read and execute games from the SD card
  • \Imaging: provides an interface to build your game world, create and display sprites, test collisions between objects and display small and large fonts.
  • \Math: a library of trigonometric functions, frequently needed when building games.
  • \Sound: provides a simple method to play tunes using the standard Nokia RTTL ringtone format

 

Here's a couple code snips form the Meteors From Outer Space project;

public GameOfMeteors(ConsoleHardwareConfig config) : base(config) {
    World = new Composition(new byte[WorldSize * WorldSize / 8], WorldSize, WorldSize);
    World.Coinc += WorldCoinc;
    Ship = new PlayerMissile {
        Name = "Ship",
        Owner = World,
        X = WorldSize/2,
        Y = WorldSize/2
    };
    Pruneau = new PlayerMissile {
        Name = "Pruneau",
        Owner = World,
        IsVisible = false
    };
    Meteors = new Meteor[WinningNumberOfMeteors];
    for (var i = 0; i < Meteors.Length; i++) {
        Meteors[i] = new Meteor(this, i);
    }
    NumberOfMeteors = StartingNumberOfMeteors;
    SpawnMeteors();
    DisplayDelay = 0;
}

public override void Loop() {
    // Ship
    Ship.HorizontalSpeed = (float)Hardware.JoystickLeft.XDirection * EnginePower;
    Ship.VerticalSpeed = (float)Hardware.JoystickLeft.YDirection * EnginePower;
    Ship.Move();

    var ship = Ship;
    ApplyToreGeometry(ship);

    // Meteors
    foreach (var meteor in Meteors) {
        meteor.Move();
    }

    // Pruneau
    if (Pruneau.IsVisible) {
        Pruneau.Move();
        ApplyToreGeometry(Pruneau);
        if (AgeOfPruneau++ >= RottingAge) {
            Pruneau.IsVisible = false;
        }
    }
    else {
        var shootXDir = Hardware.JoystickRight.XDirection;
        var shootYDir = Hardware.JoystickRight.YDirection;
        if (shootXDir != AnalogJoystick.Direction.Center ||
            shootYDir != AnalogJoystick.Direction.Center) {

            Pruneau.ExactX = Ship.ExactX;
            Pruneau.ExactY = Ship.ExactY;
            Pruneau.HorizontalSpeed = (float) shootXDir*PruneauSpeed;
            Pruneau.VerticalSpeed = (float) shootYDir*PruneauSpeed;
            AgeOfPruneau = 0;
            Pruneau.IsVisible = true;
            Beep(2000, 20);
            Beep(1000, 20);
        }
    }

    // Display
    Hardware.Matrix.Display(World.GetFrame(0, 0));
}

If you've been wondering how to use Netduino, C# and the .Net Micro Framework to build something pretty cool, to build and write games, this is the project for you...

 

Here’s a few more links you might find interesting:

Follow the Discussion

Remove this comment

Remove this thread

close

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.