Thursday, January 24, 2008

XNA Programming Basics I

Commonly used classes and structures

1. The Game Class
Namespace: Microsoft.Xna.Framework.Game
Initializes a new instance of this class, which provides basic graphics device initialization, game logic, rendering code, and a game loop.
Members
http://msdn2.microsoft.com/en-us/library/microsoft.xna.framework.game_members.aspx

2. The GraphicsDeviceManger Class
Namespace: Microsoft.Xna.Framework.GraphicsDeviceManager
Creates a new GraphicsDeviceManager and registers it to handle the configuration and management of the graphics device for the specified Game.
Members
http://msdn2.microsoft.com/en-us/library/microsoft.xna.framework.graphicsdevicemanager_members.aspx

3. The SpriteBatch Class
Namespace: Microsoft.Xna.Framework.Graphics.SpriteBatch
Initializes a new instance of the class, which enables a group of sprites to be drawn using the same settings.
Members
http://msdn2.microsoft.com/en-us/library/microsoft.xna.framework.graphics.spritebatch_members.aspx

4.The Model Class
Namespace: Microsoft.Xna.Framework.Graphics.Model
Represents a 3D model composed of multiple ModelMesh objects which may be moved independently.
Members
http://msdn2.microsoft.com/en-us/library/microsoft.xna.framework.graphics.model_members.aspx


5. The GameTime Class
Namespace: Microsoft.Xna.Framework.GameTime
Snapshot of the game timing state expressed in values that can be used by variable-step (real time) or fixed-step (game time) games.
Members
http://msdn2.microsoft.com/en-us/library/microsoft.xna.framework.gametime_members.aspx

6.The GamePad Class
Namespace: Microsoft.Xna.Framework.Input.GamePad
Allows retrieval of user interaction with an Xbox 360 Controller and setting of controller vibration motors.
Members
http://msdn2.microsoft.com/en-us/library/microsoft.xna.framework.input.gamepad_members.aspx

7.The Keyboard class
Namespace: Microsoft.Xna.Framework.Input.Keyboard
Allows retrieval of keystrokes from a keyboard input device.
Members
http://msdn2.microsoft.com/en-us/library/microsoft.xna.framework.input.keyboard_members.aspx

8.The Mouse Class
Namespace: Microsoft.Xna.Framework.Input.Mouse
Allows retrieval of position and button clicks from a mouse input device.
Members
http://msdn2.microsoft.com/en-us/library/microsoft.xna.framework.input.mouse_methods.aspx

9.The Vector3 Structure
Namespace: Microsoft.Xna.Framework.Vector3(struct)
http://msdn2.microsoft.com/en-us/library/microsoft.xna.framework.vector3_methods.aspx

10.The Matrix Structure
Namespace: Microsoft.Xna.Framework.Matrix(struct)
Defines a matrix.
http://msdn2.microsoft.com/en-us/library/microsoft.xna.framework.matrix_methods.aspx

11.The ModelMesh Class
Namespace: Microsoft.Xna.Framework.Graphics.ModelMesh
Represents a mesh that is part of a Model.
http://msdn2.microsoft.com/en-us/library/microsoft.xna.framework.graphics.modelmesh_members.aspx

12. The BasicEffect Class
Namespace: Microsoft.Xna.Framework.Graphics.BasicEffect
Represents shader model 1.1 Effect that has optional support for vertex colors, texturing, and lighting.
Members
http://msdn2.microsoft.com/en-us/library/microsoft.xna.framework.graphics.basiceffect_members.aspx

13.The MathHelper Class
Namespace: Microsoft.Xna.Framework.MathHelper
Contains commonly used precalculated values.
http://msdn2.microsoft.com/en-us/library/microsoft.xna.framework.mathhelper_members.aspx


Commonly used Methods in the Game Class

1. protected override void Initialize()

Allows the game to perform any initialization it needs to before starting to run.This is where it can query for any required services and load any non-graphic related content. Calling base.Initialize will enumerate through any components and initialize them as well.




2.public Game1()
Constructor for the Game Class

3. protected override void LoadContent()

LoadContent will be called once per game and is the place to load all of your content.

4. protected override void UnloadContent()

UnloadContent will be called once per game and is the place to unload all content.

5. protected override void Update(GameTime gameTime)

Allows the game to run logic such as updating the world,checking for collisions, gathering input, and playing audio.


6. protected override void Draw(GameTime gameTime)

This is called when the game should draw itself.


UML depiction of a simple Program written using these methods to load a and Manipulate a 3D content in windows in full screen mode



Friday, January 18, 2008

Gaming tools for interactive, collaborative .NET Applications

XNA GS 2.0, SlimDX and OGRE,Managed ORGE(MOGRE)

What is Microsoft XNA Game Studio 2.0?

Microsoft XNA Game Studio 2.0 is a set of tools based on supported versions of Microsoft Visual Studio tools that allow students and hobbyists to build games for both Microsoft Windows and Xbox 360. XNA Game Studio also includes the XNA Framework, which is a set of managed libraries based on the Microsoft .NET Framework 2.0 that are designed for game development.

Cross-Platform Game Project Converter
XNA Game Studio 2.0 provides a simple way to convert projects between Windows and Xbox 360 formats.

Source :http://msdn2.microsoft.com/en-us/library/bb200104.aspx
Visit the link for more info
What is SlimDX?
SlimDX is a library originally prototyped by Promit Roy which allows .NET 2.0 applications to use Microsoft's DirectX APIs, as well as several related Microsoft APIs that share similar goals. This role was previously filled for .NET 1.1 applications by Microsoft's own Managed DirectX (MDX) library. However, the age of .NET 1.1, plus Microsoft's lack of interest in continuing MDX has made it necessary to build a new library. Thanks to enthusiastic community support and the invaluable contributions of several other developers who have worked on and with SlimDX, the library has made immense strides towards being a fully viable platform on which to build DirectX based applications.
In addition, SlimDX is open source software, and the complete source code is available to anybody under the MIT/X11 license. Right now downloadable archive of the source code is not available, but you can use a Subversion client to download the source.

What is the current status of SlimDX?
SlimDX was first publically revealed on June 30, 2007. It has grown explosively since then, with a number of new developers signing up to develop and test. It is currently beta software.

The core Direct3D 9 is almost 100% complete, with only a handful of functions missing. Nearly all of the D3DX components that are used regularly by developers are available, including fonts, sprites, meshes, and more. Direct3D 10 is under construction, although it's still somewhat new. XInput support is considered complete, and DirectInput is very well supported. There is no workable sound support right now, but sound is in active development and should be ready to use extremely soon. DirectSound will probably become usable first, followed closely by XAudio2
DirectShow is currently not supported.
Source:http://slimdx.mdxinfo.com/wiki/index.php?title=Main_Page
for more info on slimdx visit the above link.

What Is OGRE?
OGRE (Object-Oriented Graphics Rendering Engine) is a scene-oriented, flexible 3D engine written in C++ designed to make it easier and more intuitive for developers to produce applications utilizing hardware-accelerated 3D graphics. The class library abstracts all the details of using the underlying system libraries like Direct3D and OpenGL and provides an interface based on world objects and other intuitive classes.
Capabilities
Platform & 3D API support
Material / Shader support
Meshes
Animation
Scene Features
Special Effects
and More
source: http://www.ogre3d.org/index.php?option=com_content&task=blogcategory&id=0&Itemid=98
browse through for more info

What is MOGRE?
MOGRE (Managed OGRE) is an advanced .NET 2.0 wrapper for OGRE, hosted on sourceforge. The "glue" code between C++ and .NET is developed using C++/CLI, which offers great flexibility and low-level control of how the wrapping should work.

MOGRE goes beyond a plain wrapper; the OGRE classes are integrated into the .NET framework seamlessly


OGRE-MOGRE interconnection
Normally a wrapper (like OgreDotNet) will create a new .NET object each time you need access to a native object, and the class type of the .NET object will be that of the method's return type (the wrapper cannot know which subclass the native object actually is). To address this issue the OGRE's source is modified and the OGRE classes are interconnected to the MOGRE classes. Instead of MOGRE creating a new .NET object each time you need to access an OGRE object, the OGRE object itself creates the appropriate .NET object the first time it is requested and returns it in subsequent requests.

Reference : http://www.ogre3d.org/wiki/index.php/MOGRE_Introduction