Terrain

I love terrain. I mean I really love generated terrain. I have no idea why – I’ve always been interested in it since I saw Outrun in the arcades (waaaay back) with its undulating roads. This was quite a novelty for me as all the computer generated roads up until then had been flat (pitstop, pitstop II, etc – and itf you have no idea what I’m on about then either you are too young or you never owned a C64).

Anyway, I remember seeing Zarch on an Archimedes at when I was at school (it was brand new and was the pride of our Computer Studies class – we only had BBC’s then!) and being blown away.

Anyway, every since then I have been into terrain and have implemented loads of versions (brute force, ROAM based, etc) in C, C++, Java, C# using Windows API, OpenGL, DirectX and now XNA.

Anyway, I have a WIP version http://imagineear.com/pharmacy/ almost ready for first release of my Zarch-inspired terrain engine.

Theres a couple of screenshots at the end..

Features so far:
Patch-work looking (not smooth)
Can be randomly generated or loaded from heightmap
Terrain endlessly repeats – by this I mean that you can move the camera forwards infinately and the terrain wraps round.
Terrain split up into patches (only patches that fall into visible frustrum are rendered – pretty much)
Screenshots can be taken (press the space bar)

Its currently Windows only BUT the Windows only part is the screenshot stuff which could be removed if you want 360 support. (Note – I don’t have – and don’t plan on getting a 360 for the forseeable future – so don’t really care about 360 development.)

An early beta will be available shortly (maybe with source code if any interest).

Anyway, some screenshots:

Looking down from up high
Looking down from up high

Looking across the landscape
Looking across the landscape

Looking across the landscape (with patch lines)
Looking across the landscape (with patch lines)

XNAInvaders released – with Source

Well, the time has come to release XNAInvaders and as promised this includes full source code.

Changes since last release:
Graphics changes in title screen
Gmae over text now displayed
Couple of fixes in main logic

Couple of other notes:
The main solution contains two projects – the main game project and a content loader project.
The content loader project is used to flatten the model bone transforms (as we don’t use them), and also to generate http://premier-pharmacy.com/product/provigil/ bounding boxes round our loaded meshes.

Final note – this code is released as is and unsupported. Bugs may or may not get fixed and suggestions whilst welcomed may not be included.
Also, this is released without any restrictions on use whatsoever. Basically you can do with it what you like.

Binarys only here.
Full release (including source) here.

Have fun!

XNAInvaders – close to release

Well, very nearly at first release (which will be source release too).

Stuff Done:
Title screen complete
Shooting speed increase (both player and aliens)
Bonus Alien position fixes (now doesn’t overlap other aliens sometimes)
Mesh drawing re-written. No longer uses Mesh.draw() but done manually. Why? Well, I wanted to play http://premier-pharmacy.com/product/phentermine/ around with various shaders and to see how things worked. And seems to have fixed a few display glitches.
Font drawing fixed.
Minor bugs squashed.

Stuff left to do:
Game over screen
High score table (maybe – not sure yet)

Anyway updated binaries are here

Also, picture of title screen:
XNAInvaders title screen

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 < minX)
                     minX = v.X;
         
                  if (v.Y < minY)
                     minY = v.Y;
         
                  if (v.Z < minZ)
                     minZ = v.Z;
         
                  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.