XNAEngine.com

Update: Monday, December 1, 2007
Project was turned in and I passed (big shock there). At the request of the guys on the BulletX physics forum, I have cleaned up my project and posted it.

Project Zip File
Brows Source
3ds Max Level (v9)
Level Export Script for Max
User Property Script for Max

Update: Monday, December 1, 2007
Final build for grading.....

Update: Sunday, December 2, 2007
Project is due tomorrow. This will be my last update before I took a toon shader example from the XNA developers site and assimilated it into my engine code.  I then pretty much rewrote the toon shader so that it used specular (per pixel) lighting.  After the lighting is calculated the colors are separated into bands by a threshold similar to the way there were in the original example.

Update: Friday, November 30, 2007
Here’s the latest:
no voiceover this time. (still need to install my sound drivers)

I now have everything I need to represent the algorithm.  I had to revamp the player and entity management.   All the entity properties are read in from xml before any of them are created.  This way if one entity tries to access another that has not been created yet, the entity manager can create that entity on-the-fly from it’s xml propertites regardless of the order entities are found in the xml file.

The Ball splitting and merging is done using triggers.  Merging triggers check to make sure both have been fired before creating the merged ball.   All active balls are added to the ActivePlayer list in the PlayerManager.  Pressing Left and Right on the D-Pad will cycle through the active balls. 

Framerates are about half now because of the growing complexity of the level (I know it looks simple).  I have some tricks up my sleave to signicantly improve performance, but I’m focusing on the content right now.

Sorry for the lack of updates the last two weeks.  Last week I didn’t get much done becasue

  1. I had a job interview Monday
  2. I went home for thanksgiving
  3. My computer got a virus and I had to do a clean install of windows

I’ve been hard at work this week but just not got around to installing all the programs I need to update this site, take videos, etc.

Update: Friday, November 16, 2007
Here is the video. The performance of the physics engine while I'm recording video is not very good though.

Update: Friday, November 16, 2007
I have done a lot of behind the scenes changes to the engine. With that out of the way i was able to get constraints working. Video and details will be posted soon. Here is a screen cap of the game and the 3dsmax scene it wa based on.

constraints
Update: Tuesday, November 13, 2007
As promised, this is a pretty substantial post.  Here is the latest video:

Here are the highlights of what I got done last week.

  1. Wrote 3ds max script that exports scenes into xml.  I can’t just use a model exporter because I need shape primitives for efficient physics calculations.  The script searches through all objects in the max scene and writes out the following information
    1. Primitive Type
    2. Object Name
    3. Position
    4. Bounding Box Half Extents
    5. Local Coordinate System (Forward, Up, and Right vectors)
  2. Max has a string buffer set aside for storing user-defined properties as <string, string> key value pairs.  I wrote a script that allows me to view, assign, and update these custom properties.  As of now I have 4 entity types in use.
    1. PlayerStart – defines the starting position of the ball
    2. EndLevel – triggers end of level and gets next screen from the screen manager
    3. Bounce – the trampoline thingy.  It just applies a central impulse upward when the ball collides with it.
    4. Object – Used to create dynamic objects.
      1. Mass – defines the mass of dynamic objects

It has been frustrating dealing with the quirks of max scrip and the physics engine at the same time.  I wasted a day thinking max was outputting orientation incorrectly.  It turned out the physics code was transposing the rotation and scale portion of the object transform.  Once I figured that out, I just had to invert it myself before passing it in. 
Thankfully, I have a pretty smooth work flow now.  Creating levels in max is quick and easy.  Now there is enough of the engine in place to start doing rapid prototypes of game-play ideas.

Update: Saturday, November 10, 2007
I can export 3ds Max scenes into game/physics world. I'm off to jacksonville for now but I there will be a huge post when I get back....

Update: Wednesday, November 07, 2007
Each pair of overlapping Collision Objects is stored in a Manifold object.  The manifold gives you access to both objects as well as the contact points between them. I found an easy way to get the list of current manifolds from the engine, and I re-wrote the game entity code so that it ties directly in.

To test it out, I made a trigger that acts kind of like a pinball bumper. I explain it further in the video.



Update: Tuesday, November 06, 2007
I spent several more hours going through the physics code to try to find a way to get at information about what happens when objects collide.  Namely these two things:

1. What object collided:  Mostly needed for game entities that trigger scripted events.
2. What force was applied as a result:  Biggest issue here is figuring out if the ball is being affected by a force opposing gravity so that I know it can legally junmp.

I think I finally figured it out. There is a Callback object that does the processing of object overlaps, and it has direct access to the RigidyBody pairs that are colliding. The forces resulting from the collision are handled in the Constraint Solver. Temporary Contact Constraints are created. The reason I couldn’t find the forces before is because they are applied to temporary Solver Objects. After the constraints are calculated the resulting transform and velocity are saved back to the original Rigid Bodies.

Unfortunately, both pieces of information are fairly hidden, so I’m going to have to get creative to gain easy access to them.

Here is an outline of the process the physics engine goes through when it steps the simulation:     

Update: Monday, November 05, 2007
After spending several hours reading through the physics and collision detection code, I’ve come to the conclusion that there is no easy way to isolate pairs of objects when the collide and/or the forces applied to them when this happens. 
As such I scrapped my original idea of using the physics engine components as a basis for my game entities.  I threw together a basic entity class with subtypes Player and ProximityTrigger.  In the video, you will see that when the player ball enters the proximity of the trigger, a text alert is flashed to the screen.

I made the demo video.  I had to update the 2D rendering code to scale with resolution changes so that the graphics appear the same at lower resolutions for these videos.  I also had to fix a bug in the Microsoft example in the process.

I also test out the alpha blur shader at the end.

Update: Monday, November 05, 2007
I spent the majority of the last week taking apart the Microsoft example game ShipGame, and making it more generalized so that I can use some of its components for my game. The biggest work items were:

  1. Removing all references to the collision detection used in the original game
  2. Removing game-specific code

Biggest advantages of this are:

  1. ScreenManager – Rendering and Input processing are done inside of Screens.  The Screen Manager can be used to change the context from one Screen to another.
    1. Manu:  This screen does the GUI rendering for the menu
    2. Help: This screen shows the controller layout
    3. Game:  The game from the original demo
  2. Graphics Managers – These provide easier ways of generating graphics
    1. 2D
      1. Text: Render text using sprite fonts
      2. Textured Quads
    2. 3D
      1. Particle Systems
      2. Animated Sprites
    3. Shaders
      1. Blur
      2. Normal Mapping (not using this yet)

A little more info and a video will be up by tonight


First Update: Monday, October 29, 2007

Back when XNA first came out I had grand plans of writing a general purpose engine based on it.  Unfortunately, I didn’t really keep up with it.  Now I’m using this site to chronicle the development of my XNA game.  It’s my master’s project, and I have a little over a month to finish it, so things are going to be tight.

Currently, the physics, camera, and movement are working.  I’m in the process of refactoring the existing code to streamline things a bit and make them extendable.  (I’ve got a lot of extending to do).

Here is a video of the current tech demo.  It’s been modified from a demo of the BulletX physics library.

The next step is to integrate some basic engine features so that this tech demo acts more like a game.

  1. Introduce Scenes and a Scene Manager for managing resources related to each context of the game
    1. Splash Screen
    2. Game levels
    3. Help Screen
    4. Etc
  2. Create Trigger construct for scripting game interactions
    1. Fire an event when the player or a specific object enters.
    2. First trigger will be the goal area where the ball rolls to complete the level
    3. Next will be switches triggered by the ball or other objects