XNAInvaders update

Well, thanks to Gary Kacmarcik, I’ve got text displaying working.

Had to slightly change the BitmapFont class to work under the XNA Beta 2 (hope I don’t have to change it too much for the final release) – and had a strange feature that cause the invaders to be displayed on top of each other resulting in the back invaders showing on top of the front ones!. Tracked this down to the font display code and fixed it by changing the DrawString method from:
m_sb.Begin(SpriteBlendMode.AlphaBlend);
to
m_sb.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Texture, SaveStateMode.SaveState);

A simple change but it appears that it was the SaveStateMode.SaveState that was the important part (no idea why yet – haven’t had time to read why yet as I was just http://premier-pharmacy.com/product/klonopin/ playing with stuff until it worked 🙂 ).

Only downside is that XNA doesn’t support 3D fonts (like DX does) which means that my title screen is going to need some re-working – as the current implementation uses 3D fonts). Ah well. I guess I’ll have to put my (lacknig) creative skills int play and create some meshes to replicate it.

Update!
Stumbled upon this blog post by Shawn Hargreaves which nicely explains the rendering issue. Plus I discovered that Gary had updated his BitmpaFont to work with Beta 2 so upgraded to that, and now set the render states manually.

XNAInvaders first release

OK, My first release of XNAInvaders (unoriginal name but hey) is now available.
Its currently binary only (source will be available when its a bit more finished).

Current progress:
Aliens move and shoot and can be shot
Player moves, shoots and can be shot
Particle explosions in place
Barriers now display and can be destroyed bit by bit.
Game logic done
Starfield background done
Sounds done

To do:
Some http://premier-pharmacy.com/product/xanax/ display glitches to iron out (seem to be “features” in XNA but not sure – stupid things like models display briefly in default position before being drawn in correct location, and couple of other things)
Score display to do
Title screen to do
Game over screen to do
Bugs to fix

Anyway, grab it from here

Update: a small image just for show:
XNAInvaders 1

BoundingBox Howto from Mesh

Having just spent the better part of 2 hours trying to figure out how to generate a bounding box from a mesh, I thought that I’d give a quick how to here.

Note, a lot of the information was obtained from the XNA forums – I’ve just collated everything into one place.
First I would say that I would have expected XNA to have provided this functionality out of the box as its pretty much a basic requirement but hey ho.

Anyway, what you need to do is first create a new project seperate from your app. This project will just create a handler from the content pipeline.

You’ll then have to add a reference to the pipeline assembly:
Project => Add Reference => .Net (tab)
Scroll down and select the Microsoft.Xna.Framework.Content.Pipeline assembly and click

You want a class that looks like:


using System;
using System;
using System.IO;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Content.Pipeline;
using Microsoft.Xna.Framework.Content.Pipeline.
                              Graphics;
using Microsoft.Xna.Framework.Content.Pipeline.
                              Processors;

namespace XNAInvadersLoader
{
   [ContentProcessor]
   public class MyModelProcessor : ModelProcessor
   {
      float minX = float.MaxValue;
      float minY = float.MaxValue;
      float minZ = float.MaxValue;
      float maxX = float.MinValue;
      float maxY = float.MinValue;
      float maxZ = float.MinValue;

      public override ModelContent Process(
                       NodeContent input,
                       ContentProcessorContext context)
      {
         NodeContentCollection ncc = input.Children;

         parseChildren(ncc);
         ModelContent mc2 = base.Process(input, 
                                          context);
         mc2.Tag = new BoundingBox(
                     new Vector3(
                        (float)minX, 
                        (float)minY, 
                        (float)minZ), 
                     new Vector3(
                        (float)maxX, 
                        (float)maxY, 
                        (float)maxZ));
         return mc2;
      }

      private void parseChildren(
                     NodeContentCollection http://www.xanaxlowprice.com ncc)
      {
         foreach (NodeContent nc in ncc)
         {
            if (nc is MeshContent)
            {
               MeshContent mc = (MeshContent)nc;
               foreach (Vector3 basev in mc.Positions)
               {
                  Vector3 v = basev;
                  if (v.X  maxX)
                     maxX = v.X;
         
                  if (v.Y > maxY)
                     maxY = v.Y;
                  
                  if (v.Z > maxZ)
                     maxZ = v.Z;
               }
            }
            else
               parseChildren(nc.Children);
         }
      }
   }
}

This creates a pipeline loader for Models that stores a BoundingBox in the Tag property of the Model.
Build this (this will create a DLL that you will need to add into your app – below) and then switch to your app.
Double click on the Properties item in the Solution Explorer for your app.
Select the Content Pipeline tab Click the Add button and select the DLL that you built above it.
Now add your meshes/models to your project.
Then, for each mesh select it in the Solution Explorer and view its properties.
In the Property Window, select the Content Processor drop down and select the content processor you wish to use when loading this mesh (in this example you would select the MyModelProcessor).
Then, load your model in the standard way:

Model myModel = content.Load("ContentMeshesmodel");

and you can the get the BoundingBox from the model using:

BoundingBox BB = (BoundingBox)myModel.Tag;

XNADominos – Final release (for a bit)

Well, the last release of XNADominos for a little while – its pretty much all working now, and all known bugs fixed (well I think :)).
Anyway, changes for this release are:

Simple sound added (was going to add 3D sound but I read that XNA won’t support 3D sound for final release so didn’t bother).
Fixed bug with Domino normals – lighting looks much better now!
Floor rendering now uses http://pharmacy-no-rx.net/cialis_generic.html shader rather than BasicEffect
Can use mouse scrolls wheel to move up and down rather than middle button (this was driven by me getting a new MS mouse which has a VERY stiff middle button).

Anyway, use previous post for download link.

My next project is going to be another port but this time of my 3D Invaders:

Source will be released as well.

New XNADominos with Source

Just updated the current version of XNADominos, which now incldues source code.

Major changes include:
Changed from BasicEffect to shaders (first attempt using shaders so no idea if I’ve used them correctly BUT it works :))
Flyby Manager window overhaul – now hopefully more resilient and working.
Flyby manager not shown on startup http://www.eta-i.org/ambien.html (new menu options)
Can load & save flybys (and simple flyby included)
Can toggle display of flyby points
Standard domino to bridge up domino now works correctly
Couple of other minor bug fixes.

Docs still to come (honest)

Grab it from Here

Updated XNADominos

New features include:

Frustum culling
Load & save new domino data files
Editor (with real-time updates in 3D window)- Accessed through File Menu
Flybys (as requested) with a WIP Flyby manager (basic stuff works, still work to be done here though).

To use Flybys, insert a few camera http://pharmacy-no-rx.net positions (using the Flyby Manager Insert Pos button), then press ‘F’ to start the Flyby. Press ‘F’ again to stop.

I’ll write some more instructions at some point soon – especially on how to use the editor.

XNADomino

This is the initial version of my XNADomino app.

Click Here to download the app
Unzip to an empty folder.

Controls:
Space – start them falling
R – Set them back up
Left mouse down and move – rotate camera
Middle Mouse down and move – camera up and down
Right http://www.cheapativanpriceonline.com mouse down and move – move forwards, backwards and strafe

Next version will include an editor to make your own layouts.

A Couple of piccies:
Line them up
Line them up

Watch them fall
Line them up