Someone created a video on how to make a fish tank using myFishtank for the Xbox 360:
Showing posts with label XNA. Show all posts
Showing posts with label XNA. Show all posts
Friday, June 12, 2009
Community Uploaded Video
Tuesday, April 21, 2009
myFishtank
Here is a preview of what we will be releasing soon on Xbox Marketplace:
Wednesday, December 31, 2008
Top Community Games (by purchases)
This is the list of full versions purchased for the week of 22nd December:
Top Community Games
1 Golden Royal Blackjack (200 points) unchanged 3 weeks
2 Fireplace (400) new
3 Word Soup (400) down 1
4 Snowmans Dilemma (200) down 2
5 Weapon of Choice (400) down 1
6 CarneyVale Showtime (400) new
7 EZMuze Break and House edition (200) new
8 Johnny Platform's Biscuit Romp (200) new
9 sin(Surfing) (200) unchanged 3 weeks
10 Dr. Popper (200) new
Other stats:
- This week the 100th community game was added on Xbox live.
- Golden Royal Blackjack has been in no.1 purchased game 3 weeks running.
- Fireplace demo is currently no 1 downloaded CG (Community Game) for the last 7 days
Top Community Games
1 Golden Royal Blackjack (200 points) unchanged 3 weeks
2 Fireplace (400) new
3 Word Soup (400) down 1
4 Snowmans Dilemma (200) down 2
5 Weapon of Choice (400) down 1
6 CarneyVale Showtime (400) new
7 EZMuze Break and House edition (200) new
8 Johnny Platform's Biscuit Romp (200) new
9 sin(Surfing) (200) unchanged 3 weeks
10 Dr. Popper (200) new
Other stats:
- This week the 100th community game was added on Xbox live.
- Golden Royal Blackjack has been in no.1 purchased game 3 weeks running.
- Fireplace demo is currently no 1 downloaded CG (Community Game) for the last 7 days
Sunday, December 21, 2008
XBox 360 Fireplace
Enjoy the awesome ambiance of a crackling fireplace in your living room. With realistic smoldering embers and flickering flames it sets the perfect backdrop for a relaxing evening.
Turn your TV into a virtual fireplace.
You can try the free demo by downloading it from here directly to your Xbox 360, or you can find it on the NXE dashboard under Community Games.

XBox 360 Fireplace
Turn your TV into a virtual fireplace.
You can try the free demo by downloading it from here directly to your Xbox 360, or you can find it on the NXE dashboard under Community Games.
XBox 360 Fireplace
Tuesday, September 23, 2008
inDuna
Here is a quick preview of the game we submitted for this years Dream Build and Play competition:
Tuesday, July 22, 2008
Sell your games on XBox 360 Community Games!
Finally, Microsoft has announced that this year they will be launching the ability for anyone with a Creators Club Membership to upload and sell there games on XBox 360.
Microsoft will give you up to 70% of the revenues and send you a cheque every quarter.
Fur more detailed info and a list of FAQ check out the creators club website over here.
Microsoft will give you up to 70% of the revenues and send you a cheque every quarter.
Fur more detailed info and a list of FAQ check out the creators club website over here.
Tuesday, May 20, 2008
New XNA Creators Club Online almost here
Looks like we can expect the new XNA Creators Club website to be launched sometime in the next few days.
Currently the website is "closed for a while" you can check out the message here.
In other news....
Blender 2.46 (also known as the Bunny release) has just been released.
"This version supports a new particle system with hair and fur combing tools, fast and optimal fur rendering, a mesh deformation system for advanced character rigging, cloth simulation, fast Ambient Occlusion, a new Image browser, and that's just the beginning."
Check the extensive list of features here.
Currently the website is "closed for a while" you can check out the message here.
In other news....
Blender 2.46 (also known as the Bunny release) has just been released.
"This version supports a new particle system with hair and fur combing tools, fast and optimal fur rendering, a mesh deformation system for advanced character rigging, cloth simulation, fast Ambient Occlusion, a new Image browser, and that's just the beginning."
Check the extensive list of features here.
Sunday, March 30, 2008
X-File exporter support for 3D Studio Max 2008 and Max R9
Version 1.3 of the kW X-port has been released, this allows you to export models from Max in X file format, as well as Animations.
Probably the best tool to use at the moment. Also has the ability to name and set your animation when exporting which is really handy.
You can get the release from here.
Probably the best tool to use at the moment. Also has the ability to name and set your animation when exporting which is really handy.
You can get the release from here.
Wednesday, March 12, 2008
XNA Game Engine Development
Found a pretty good series of articles all about building an Engine using the Microsoft XNA Framework.
Here are the links:
# Part I: Basic engine skeleton
# Part II: An FPS counter GameComponent
# Part III: Applying TDD (Test Driven Development)
# Part IV: ShaderManager GameComponent
# Part V: TextureManager GameComponent
# Part VI: Input GameComponent
# Part VII: ScreenManager GameComponent (game state + GUI)
# Part VIII: Adding multithreading to GameComponents
# Part IX: SceneGraphManager GameComponent
# Part X: CameraManager GameComponent
# Part XI: Static meshes
# Part XII: Culling and chase camera
# Part XIII: Oclussion & Frustum culling
# Part XIV: Adding Physics
# Part XV: Adding WinForm Support, step 1 to World Builder
# Part XVI: Skydome
# Part XVII: Hoffman Atmosphere
Here are the links:
# Part I: Basic engine skeleton
# Part II: An FPS counter GameComponent
# Part III: Applying TDD (Test Driven Development)
# Part IV: ShaderManager GameComponent
# Part V: TextureManager GameComponent
# Part VI: Input GameComponent
# Part VII: ScreenManager GameComponent (game state + GUI)
# Part VIII: Adding multithreading to GameComponents
# Part IX: SceneGraphManager GameComponent
# Part X: CameraManager GameComponent
# Part XI: Static meshes
# Part XII: Culling and chase camera
# Part XIII: Oclussion & Frustum culling
# Part XIV: Adding Physics
# Part XV: Adding WinForm Support, step 1 to World Builder
# Part XVI: Skydome
# Part XVII: Hoffman Atmosphere
Friday, March 7, 2008
XNA WinForms Physics Editor Tool
Recently I put together a WinForms XNA Physics Editor for a project I was working on.
Not all the buttons work yet... and there are bugs all over, the animation section doesn't work at all, its currently a work in progress. If there is anything you really want fixed or changed, drop a comment. Let me know if its of use to you.
The tool can be used to test your Physics ideas as it allows you to experiment quickly with Joints and Springs.

Included is a sample jeep file to load (As seen above).
You can download it from here.
If you hit F11 it hides the physics helpers.
To create an new object just Right Click and select the option.
The editor also builds your images into xnb files for you.
Note!
The Custom objects are a bit dodge, use the mouse to place vertices down, and use SPACEBAR to complete the object. It may take a few seconds once SPACEBAR is pressed before the editor completes the building process, the Custom objects is still buggy, but does work.
The "Multi-Part Object" button is buggy, so dont use it.
The following is fully functional:
- Revolute Joint
- Fixed Revolute Joint
- Angle Joint
- Angle Limit Joint
- Fixed Angle Joint
- Fixed Angle Limit Joint
- Angle Spring
- Linear Spring
- Fixed Angle Spring
- Fixed Linear Spring
Not all the buttons work yet... and there are bugs all over, the animation section doesn't work at all, its currently a work in progress. If there is anything you really want fixed or changed, drop a comment. Let me know if its of use to you.
The tool can be used to test your Physics ideas as it allows you to experiment quickly with Joints and Springs.

Included is a sample jeep file to load (As seen above).
You can download it from here.
If you hit F11 it hides the physics helpers.
To create an new object just Right Click and select the option.
The editor also builds your images into xnb files for you.
Note!
The Custom objects are a bit dodge, use the mouse to place vertices down, and use SPACEBAR to complete the object. It may take a few seconds once SPACEBAR is pressed before the editor completes the building process, the Custom objects is still buggy, but does work.
The "Multi-Part Object" button is buggy, so dont use it.
The following is fully functional:
- Revolute Joint
- Fixed Revolute Joint
- Angle Joint
- Angle Limit Joint
- Fixed Angle Joint
- Fixed Angle Limit Joint
- Angle Spring
- Linear Spring
- Fixed Angle Spring
- Fixed Linear Spring
Wednesday, February 20, 2008
Latest news from GDC
Microsofts GDC Keynote !
This is the bit I like most about the Keynote:
"It's changing today. For the first time, community games will be distributed through Xbox Live."
'Xbox Live Community Games' will give creators a huge audience to share their creativity with. Game distribution will be democritized, allowing the community to control the content. Create, Submit, Peer Review, Play are the four key steps." "We want creativity to flow through this pipeline,"
"Your creator identity is not too different from a gamertag -- it has a history of your developed games. You'll inform users what's in your game, using descriptive sliders. On a scale, how violent is it? What sort of game is it? There's prohibited content, of course, but ti's up to peer reviewers to evaluate the game. "now, 10 million people on Xbox Live get to play your game."
This is the bit I like most about the Keynote:
"It's changing today. For the first time, community games will be distributed through Xbox Live."
'Xbox Live Community Games' will give creators a huge audience to share their creativity with. Game distribution will be democritized, allowing the community to control the content. Create, Submit, Peer Review, Play are the four key steps." "We want creativity to flow through this pipeline,"
"Your creator identity is not too different from a gamertag -- it has a history of your developed games. You'll inform users what's in your game, using descriptive sliders. On a scale, how violent is it? What sort of game is it? There's prohibited content, of course, but ti's up to peer reviewers to evaluate the game. "now, 10 million people on Xbox Live get to play your game."
Monday, February 18, 2008
The 2008 Dream-Build-Play Warmup Challenge finalists
The 2008 Dream Build and Play Warmup Challenge finalists are here, the links will take you to the site with a download for each game:
Conquerator 1.0 Released

Hive
iSheep

Orblast

Specimen
Conquerator 1.0 Released

Hive
iSheep
Orblast
Specimen
Tuesday, February 12, 2008
XNA and NVidia PerfHUD 5.2
To get NVidia's PerfHUD to work with XNA you will need to create the event in your game constructor:
and add the following:
Then build the game, and drag and drop the exe onto the NVIDIA PerfHUD 5 Launcher icon.
To see more about what NVidia PerfHud is all about watch this video:
this.graphics.PreparingDeviceSettings += new EventHandler(graphics_PreparingDeviceSettings);
and add the following:
void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
{
foreach (GraphicsAdapter curAdapter in GraphicsAdapter.Adapters)
{
if (curAdapter.Description.Contains("NVIDIA PerfHUD"))
{
e.GraphicsDeviceInformation.Adapter = curAdapter;
e.GraphicsDeviceInformation.DeviceType = DeviceType.Reference;
break;
}
}
}
Then build the game, and drag and drop the exe onto the NVIDIA PerfHUD 5 Launcher icon.
To see more about what NVidia PerfHud is all about watch this video:
Monday, December 24, 2007
2D Deformable Level
Today I'm going to give you a quick overview on how to create deformable 2D level (similar to what is seen in games like Worms and Lemmings)
First I will create a new XNA 2.0 project, next I'm going to create a level using Paint.Net.
I'll create the new image with a size 800 (w) x 600 (h) as this is the default size a XNA 2.0 project uses. Now we are ready to start drawing the level, select the Paintbrush tool and change the Antialiased button to Antialiasing Disabled, then draw your outline of your level (preferably in black).
You should now have something similar to this, from here select the top section (above the black line) with the Magic Wand tool, and press the delete key. The top section should now change to grey and white checkered boxes, this represents the alpha layer.
Choose your desired level colour and then select the Paint Bucket tool and click on the bottom sectin of your level.
You should now have something along the lines of the following:
From here you are ready to save, click Save As and select the "Save as type:" to "PNG (*.png)" and call it "level"
(click here to download a copy of my level)
So thats our level done, now lets create our deform image, we do this in a very similar way as the level so I wont go threw it step by step.
Im going to make the deform image 128(w) x 128(h), basically its going to be an circle (so i'll draw it using the Ellipse tool using the same Brush width and Anti-Aliasing options as I used for the leve.
Because we are going to be using this image as the image that will deform the level we need to specify that the iniside of the level is white (we will replace this in code with alpha pixels) and the outside of te ellipse will be transparent / alpha like this. Then save this as a PNG file as well and call it "deform". Or you can download my copy here.
Finally lets create a nice sky background, create a new image 800x600, then select a nice blue colour for your Primary color and make leave your secondary colour white. Then simply select from the Effects menu "Effects -> Render -> Clouds" and click the OK button. Save this image as sky.jpg (Note! We don't need to save this as a PNG file as the sky image contains no alpha layer, so by using a JPG format we can save a little on disk space)
Right, now we are ready to begin coding.
Drag & Drop the above two png files and the sky.jpg you created into you content folder in your project.
Now open the Game1.cs file and lets add the following below the following line:

Not bad for just 11 lines of new code!
Moving the deform sprite around
Too move the deform sprite we are going to use the mouse. So if you run the game now you will notice that the mouse cursor is hidden over the game window. Lets change that to make is visible.
In the Initialize function replace the // TODO comment with the following line of code:
Deforming the Level
In order to visually deform the level we need to grab the texture data of the level and put it into an array, this will then hold the uint value for each co-ordinate of the texture, we then modify the array values of the section of the level where the user "pastes" the deform image down, by setting the level array to equal the deform sprites texture array. And finally we update the level texture with the new array of values.
So lets first load the deform pixel array, so below where you declared the currentMouseState add the following line:
So to add mouse click support we will need to call currentMouseState.LeftButton == ButtonState.Pressed, the problem with this is that it would then call the UpdateMouse function every frame whilst the mouse button is pressed down. We only want to call it just once per click.
To do this we need to update the "UpdateMouse" function to keep a history of the previous mouse state, and then check that the previous mouse state is set pressed and the current mouse state is set to released (which would represent a click).
Here is the updated function with the call to DeformLevel():
protected void UpdateMouse()
{
Now you can fire up the game and give it a try... (Note! we haven't done any error checking when deforming the terrain, so make sure you only click in valid areas on the level and not too close to any of the edges, else you may go outside the bounds of the array)
You will probably end up with something like this when you click near the level:
So all we have done now is updated the texture of the level with a copy of the deform level, now lets test the colour of the pixel in the deform array to see if its an alpha pixel, if it is then we don't need to update the level pixel colour, that will prevent the square alpha layer shown above around the deform sprite. We can do the same pixel test on the level array as well, this will then prevent the deform sprite from being drawn where ever the cloud is visible.
put the pixelLevelData within and if statement like so:
// Here we check that the current co-ordinate of the deform texture is not an alpha value
// And that the current level texture co-ordinate is not an alpha value
if (pixelDeformData[x + y * textureDeform.Width] != 16777215
&& pixelLevelData[((int)mousePosition.X + x) +
((int)mousePosition.Y + y) * textureLevel.Width] != 16777215)
{
pixelLevelData[((int)mousePosition.X + x) + ((int)mousePosition.Y + y)
* textureLevel.Width] = pixelDeformData[x + y * textureDeform.Width];
}
Now if you run the game it will look something like this when you click around, which is much closer to the desired effect:
The last step is to make any pixel that is white in the deform array to alpha. And to make it a more robust we need to do some error checking to avoid any issues when deforming the level too close to the borders.
Here is the final function:
/// <summary>
/// 16777215 = Alpha
/// 4294967295 = White
/// </summary>
protected void DeformLevel()
{
Now it should look like this (note how where the deforms occur there is still a nice black outline):
You could apply the same principles to add to the level as well, for example you could paste the dead body of a player to the terrain or a tombstone where the player died.
Here is the project source to download.
For pixel perfect collision detection you have two options, you could get the current colour value of the pixel each frame from the texture and check if it's an alpha or not (I think this would be pretty slow), or preferably you could create a bool collision array at the start of the level that sets all alpha pixels to false and level pixels to true. Then just update the collision array in the deform function where you set the level pixel to alpha.
First I will create a new XNA 2.0 project, next I'm going to create a level using Paint.Net.
I'll create the new image with a size 800 (w) x 600 (h) as this is the default size a XNA 2.0 project uses. Now we are ready to start drawing the level, select the Paintbrush tool and change the Antialiased button to Antialiasing Disabled, then draw your outline of your level (preferably in black).
You should now have something similar to this, from here select the top section (above the black line) with the Magic Wand tool, and press the delete key. The top section should now change to grey and white checkered boxes, this represents the alpha layer.Choose your desired level colour and then select the Paint Bucket tool and click on the bottom sectin of your level.
You should now have something along the lines of the following:

From here you are ready to save, click Save As and select the "Save as type:" to "PNG (*.png)" and call it "level"
(click here to download a copy of my level)
So thats our level done, now lets create our deform image, we do this in a very similar way as the level so I wont go threw it step by step.
Im going to make the deform image 128(w) x 128(h), basically its going to be an circle (so i'll draw it using the Ellipse tool using the same Brush width and Anti-Aliasing options as I used for the leve.
Because we are going to be using this image as the image that will deform the level we need to specify that the iniside of the level is white (we will replace this in code with alpha pixels) and the outside of te ellipse will be transparent / alpha like this. Then save this as a PNG file as well and call it "deform". Or you can download my copy here.
Finally lets create a nice sky background, create a new image 800x600, then select a nice blue colour for your Primary color and make leave your secondary colour white. Then simply select from the Effects menu "Effects -> Render -> Clouds" and click the OK button. Save this image as sky.jpg (Note! We don't need to save this as a PNG file as the sky image contains no alpha layer, so by using a JPG format we can save a little on disk space)Right, now we are ready to begin coding.
Drag & Drop the above two png files and the sky.jpg you created into you content folder in your project.
Now open the Game1.cs file and lets add the following below the following line:
SpriteBatch spriteBatch;We need to declare the sky, level, and deform sprites:
private Texture2D textureSky;Then in the LoadContent class lets replace the // TODO comment by loading our content:
private Texture2D textureLevel;
private Texture2D textureDeform;
textureSky = Content.Load<Texture2D>("sky");We are already ready to start on the draw class, so lets replace the // TODO comment in the Draw function with the following:
textureLevel = Content.Load<Texture2D>("level");
textureDeform = Content.Load<Texture2D>("deform");
spriteBatch.Begin();Right, already we are ready to build the game and see our level, it should look something like this:
spriteBatch.Draw(textureSky, new Vector2(0, 0), Color.White);
spriteBatch.Draw(textureLevel, new Vector2(0, 0), Color.White);
spriteBatch.Draw(textureDeform, new Vector2(100, 100), Color.White);
spriteBatch.End();

Not bad for just 11 lines of new code!
Moving the deform sprite around
Too move the deform sprite we are going to use the mouse. So if you run the game now you will notice that the mouse cursor is hidden over the game window. Lets change that to make is visible.
In the Initialize function replace the // TODO comment with the following line of code:
this.IsMouseVisible = true;Next we declare the Vector2 variable to store the mouse position (add this below the where we added the Texture2D declarations) and also declare the current mouse state:
private Vector2 mousePosition;Now we need to update the mousePosition, so lets create a new function do this for us:
private MouseState currentMouseState;
protected void UpdateMouse()We then replace the // TODO: comment line in the Update function with a call to the UpdateMouse function we just created.
{
currentMouseState = Mouse.GetState();
// This gets the mouse co-ordinates
// relative to the upper left of the game window
mousePosition = new Vector2(currentMouseState.X, currentMouseState.Y);
}
UpdateMouse();And finally modify the draw call for the textureDeform sprite to use the mouse position:
spriteBatch.Draw(textureDeform, mousePosition, Color.White);Hit F5 and try it out.
Deforming the Level
In order to visually deform the level we need to grab the texture data of the level and put it into an array, this will then hold the uint value for each co-ordinate of the texture, we then modify the array values of the section of the level where the user "pastes" the deform image down, by setting the level array to equal the deform sprites texture array. And finally we update the level texture with the new array of values.
So lets first load the deform pixel array, so below where you declared the currentMouseState add the following line:
private uint[] pixelDeformData;Then in the LoadContent function add the following after you load the textureDeform:
// Declare an array to hold the pixel dataRemember because we can deform the level an endless amount of times we need to load the pixel array each time you try deform the level, so lets do that in a separate function which we can call when the mouse is clicked.
pixelDeformData = new uint[textureDeform.Width * textureDeform.Height];
// Populate the array
textureDeform.GetData(pixelDeformData, 0, textureDeform.Width * textureDeform.Height);
protected void DeformLevel()Before we can test it we need to actually call the function by left clicking with the mouse.
{// Declare an array to hold the pixel data}
uint[] pixelLevelData = new uint[textureLevel.Width * textureLevel.Height];
// Populate the array
textureLevel.GetData(pixelLevelData, 0, textureLevel.Width * textureLevel.Height);
for (int x = 0; x < textureDeform.Width; x++)
{for (int y = 0; y < textureDeform.Height; y++)}
{pixelLevelData[((int)mousePosition.X + x) + ((int)mousePosition.Y + y)}
* textureLevel.Width] = pixelDeformData[x + y * textureDeform.Width];
// Update the texture with the changes made above
textureLevel.SetData(pixelLevelData);
So to add mouse click support we will need to call currentMouseState.LeftButton == ButtonState.Pressed, the problem with this is that it would then call the UpdateMouse function every frame whilst the mouse button is pressed down. We only want to call it just once per click.
To do this we need to update the "UpdateMouse" function to keep a history of the previous mouse state, and then check that the previous mouse state is set pressed and the current mouse state is set to released (which would represent a click).
Here is the updated function with the call to DeformLevel():
protected void UpdateMouse()
{
MouseState previousMouseState = currentMouseState;
currentMouseState = Mouse.GetState();
// This gets the mouse co-ordinates
// relative to the upper left of the game window
mousePosition = new Vector2(currentMouseState.X, currentMouseState.Y);
// Here we make sure that we only call the deform level function
// when the left mouse button is released
if (previousMouseState.LeftButton == ButtonState.Pressed &&
currentMouseState.LeftButton == ButtonState.Released)
{
}currentMouseState = Mouse.GetState();
// This gets the mouse co-ordinates
// relative to the upper left of the game window
mousePosition = new Vector2(currentMouseState.X, currentMouseState.Y);
// Here we make sure that we only call the deform level function
// when the left mouse button is released
if (previousMouseState.LeftButton == ButtonState.Pressed &&
currentMouseState.LeftButton == ButtonState.Released)
{
DeformLevel();
}Now you can fire up the game and give it a try... (Note! we haven't done any error checking when deforming the terrain, so make sure you only click in valid areas on the level and not too close to any of the edges, else you may go outside the bounds of the array)
You will probably end up with something like this when you click near the level:
So all we have done now is updated the texture of the level with a copy of the deform level, now lets test the colour of the pixel in the deform array to see if its an alpha pixel, if it is then we don't need to update the level pixel colour, that will prevent the square alpha layer shown above around the deform sprite. We can do the same pixel test on the level array as well, this will then prevent the deform sprite from being drawn where ever the cloud is visible.put the pixelLevelData within and if statement like so:
// Here we check that the current co-ordinate of the deform texture is not an alpha value
// And that the current level texture co-ordinate is not an alpha value
if (pixelDeformData[x + y * textureDeform.Width] != 16777215
&& pixelLevelData[((int)mousePosition.X + x) +
((int)mousePosition.Y + y) * textureLevel.Width] != 16777215)
{
pixelLevelData[((int)mousePosition.X + x) + ((int)mousePosition.Y + y)
* textureLevel.Width] = pixelDeformData[x + y * textureDeform.Width];
Now if you run the game it will look something like this when you click around, which is much closer to the desired effect:The last step is to make any pixel that is white in the deform array to alpha. And to make it a more robust we need to do some error checking to avoid any issues when deforming the level too close to the borders.
Here is the final function:
/// <summary>
/// 16777215 = Alpha
/// 4294967295 = White
/// </summary>
protected void DeformLevel()
{
// Declare an array to hold the pixel data
uint[] pixelLevelData = new uint[textureLevel.Width * textureLevel.Height];
// Populate the array
textureLevel.GetData(pixelLevelData, 0, textureLevel.Width * textureLevel.Height);
for (int x = 0; x < textureDeform.Width; x++)
{
// Update the texture with the changes made above
textureLevel.SetData(pixelLevelData);
}uint[] pixelLevelData = new uint[textureLevel.Width * textureLevel.Height];
// Populate the array
textureLevel.GetData(pixelLevelData, 0, textureLevel.Width * textureLevel.Height);
for (int x = 0; x < textureDeform.Width; x++)
{
for (int y = 0; y < textureDeform.Height; y++)
{
}{
// Do some error checking so we dont draw out of bounds of the array etc..
if (((mousePosition.X + x) < (textureLevel.Width)) &&
((mousePosition.Y + y) < (textureLevel.Height)))
{
}if (((mousePosition.X + x) < (textureLevel.Width)) &&
((mousePosition.Y + y) < (textureLevel.Height)))
{
if ((mousePosition.X + x) >= 0 && (mousePosition.Y + y) >= 0)
{
}{
// Here we check that the current co-ordinate of the deform texture is not an alpha value
// And that the current level texture co-ordinate is not an alpha value
if (pixelDeformData[x + y * textureDeform.Width] != 16777215
&& pixelLevelData[((int)mousePosition.X + x) +
((int)mousePosition.Y + y) * textureLevel.Width] != 16777215)
{
}// And that the current level texture co-ordinate is not an alpha value
if (pixelDeformData[x + y * textureDeform.Width] != 16777215
&& pixelLevelData[((int)mousePosition.X + x) +
((int)mousePosition.Y + y) * textureLevel.Width] != 16777215)
{
// We then check to see if the deform texture's current pixel is white (4294967295)
if (pixelDeformData[x + y * textureDeform.Width] == 4294967295)
{
else
{
}if (pixelDeformData[x + y * textureDeform.Width] == 4294967295)
{
// It's white so we replace it with an Alpha pixel
pixelLevelData[((int)mousePosition.X + x) + ((int)mousePosition.Y + y)
* textureLevel.Width] = 16777215;
}pixelLevelData[((int)mousePosition.X + x) + ((int)mousePosition.Y + y)
* textureLevel.Width] = 16777215;
else
{
// Its not white so just set the level texture pixel to the deform texture pixel
pixelLevelData[((int)mousePosition.X + x) + ((int)mousePosition.Y + y)
* textureLevel.Width] = pixelDeformData[x + y * textureDeform.Width];
}pixelLevelData[((int)mousePosition.X + x) + ((int)mousePosition.Y + y)
* textureLevel.Width] = pixelDeformData[x + y * textureDeform.Width];
// Update the texture with the changes made above
textureLevel.SetData(pixelLevelData);
Now it should look like this (note how where the deforms occur there is still a nice black outline):
You could apply the same principles to add to the level as well, for example you could paste the dead body of a player to the terrain or a tombstone where the player died.Here is the project source to download.
For pixel perfect collision detection you have two options, you could get the current colour value of the pixel each frame from the texture and check if it's an alpha or not (I think this would be pretty slow), or preferably you could create a bool collision array at the start of the level that sets all alpha pixels to false and level pixels to true. Then just update the collision array in the deform function where you set the level pixel to alpha.
Thursday, December 13, 2007
XNA Game Studio Connect for XBox 360
The Game Studio Connect has now also been released.
It can be found under:
Marketplace -> Game Store -> More... -> Genres -> Other -> XNA Creators Club -> XNA Game Studio Connect
It can be found under:
Marketplace -> Game Store -> More... -> Genres -> Other -> XNA Creators Club -> XNA Game Studio Connect
XNA Game Studio 2 Finally Released
Well its finally here... which means I can almost continue start testing the networking.. now just waiting for the release of XNA Game Studio Connect which should be available on Xbox LIVE Marketplace shortly.
In the meantime im downloading the final release of XNA Game Studio 2.
Here is the link.
In the meantime im downloading the final release of XNA Game Studio 2.
Here is the link.
Tuesday, December 4, 2007
Searching for a Session
Hmm, so after trying out the search it's pretty obvious that its lacking any feedback to the user.
So lets update the SearchScreen.cs to display a bit more info like "Searching..." and "Unable to find a Session" and a "Back" link etc..
Lets move out the searching of a session from the Constructor into its own function so that we can call it from the menu when a user clicks search:
public SearchScreen(NetworkSessionType networkSessionType)
{
/// <summary>
/// Searches for available network sessions
/// </summary>
private void Search()
{
/// <summary>
/// Responds to user menu selections.
/// </summary>
protected override void OnSelectEntry(int entryIndex)
{
}
Modify the SessionFound callback function to re-enable the menu movement and also display menu entries if the available sessions is zero:
public void SessionsFound(IAsyncResult result)
{
Give it a try, im still unable to test with available sessions so let me know if you have a problem with that bit. We still need to make it that if you select an available session it will try join the session.
So lets update the SearchScreen.cs to display a bit more info like "Searching..." and "Unable to find a Session" and a "Back" link etc..
Lets move out the searching of a session from the Constructor into its own function so that we can call it from the menu when a user clicks search:
public SearchScreen(NetworkSessionType networkSessionType)
{
this.networkSessionType = networkSessionType;
Search();
}Search();
/// <summary>
/// Searches for available network sessions
/// </summary>
private void Search()
{
MenuEntries.Clear();
MenuEntries.Add("Searching...");
// Disable movement
this.isEnabled = false;
NetworkSessionProperties searchProperties = new NetworkSessionProperties();
if (this.networkSessionType == NetworkSessionType.PlayerMatch)
{
if (this.networkSessionType == NetworkSessionType.SystemLink)
{
}MenuEntries.Add("Searching...");
// Disable movement
this.isEnabled = false;
NetworkSessionProperties searchProperties = new NetworkSessionProperties();
if (this.networkSessionType == NetworkSessionType.PlayerMatch)
{
LIVESearch = NetworkSession.BeginFind(NetworkSessionType.PlayerMatch, maxLocalPlayers, searchProperties,
new AsyncCallback(SessionsFound), null);
}new AsyncCallback(SessionsFound), null);
if (this.networkSessionType == NetworkSessionType.SystemLink)
{
LIVESearch = NetworkSession.BeginFind(NetworkSessionType.SystemLink, maxLocalPlayers, searchProperties,
new AsyncCallback(SessionsFound), null);
}new AsyncCallback(SessionsFound), null);
/// <summary>
/// Responds to user menu selections.
/// </summary>
protected override void OnSelectEntry(int entryIndex)
{
switch (entryIndex)
{ case 0:
Search();
break;
case 1:
}{ case 0:
Search();
break;
// Exit
ScreenManager.AddScreen(new XboxLiveScreen(this.networkSessionType));
break;
ScreenManager.AddScreen(new XboxLiveScreen(this.networkSessionType));
break;
}
Modify the SessionFound callback function to re-enable the menu movement and also display menu entries if the available sessions is zero:
public void SessionsFound(IAsyncResult result)
{
// Re-enable movement in the menu
this.isEnabled = true;
if ((LIVESearch != null) && LIVESearch.IsCompleted)
{
}this.isEnabled = true;
if ((LIVESearch != null) && LIVESearch.IsCompleted)
{
availableSessions = NetworkSession.EndFind(result);
MenuEntries.Clear();
if (availableSessions != null)
{
LIVESearch = null;
}MenuEntries.Clear();
if (availableSessions != null)
{
foreach (AvailableNetworkSession availableSession in availableSessions)
{
// Check if no sessions were found
if (availableSessions.Count == 0)
{
}{
// Only show sessions where there are available slots
if (availableSession.CurrentGamerCount < 8)
{
// Limit the number of results to return
if (MenuEntries.Count >= 5)
{
}if (availableSession.CurrentGamerCount < 8)
{
MenuEntries.Add(availableSession.HostGamertag + " (" +
availableSession.CurrentGamerCount.ToString() + "/8)");
}availableSession.CurrentGamerCount.ToString() + "/8)");
// Limit the number of results to return
if (MenuEntries.Count >= 5)
{
break;
}// Check if no sessions were found
if (availableSessions.Count == 0)
{
MenuEntries.Add("No results found, try again?");
MenuEntries.Add("Back");
}MenuEntries.Add("Back");
LIVESearch = null;
Give it a try, im still unable to test with available sessions so let me know if you have a problem with that bit. We still need to make it that if you select an available session it will try join the session.
System Link Support - Phase 2: Searching for session
To support both types of network modes is easy, all we have to do is modify the SearchScreen.cs constructor to allow passing in of NetworkSessionType, and then check which type of network session has been passed in and search depending on that:
NetworkSessionType networkSessionType;
public SearchScreen(NetworkSessionType networkSessionType)
{
Finally go back to the XboxLiveScreen.cs and edit the OnSelectEntry function and modify this line under case 1:
Other good news is that the new Dashboard Update released today will now be able to show your XNA 2.0 games amongst your other games (so you can fire it up without having to first open the XNA Game Launcher like before) here is the official link.
NetworkSessionType networkSessionType;
public SearchScreen(NetworkSessionType networkSessionType)
{
this.networkSessionType = networkSessionType;
NetworkSessionProperties searchProperties = new NetworkSessionProperties();
if (this.networkSessionType == NetworkSessionType.PlayerMatch)
{
if (this.networkSessionType == NetworkSessionType.SystemLink)
{
}NetworkSessionProperties searchProperties = new NetworkSessionProperties();
if (this.networkSessionType == NetworkSessionType.PlayerMatch)
{
LIVESearch = NetworkSession.BeginFind(NetworkSessionType.PlayerMatch, maxLocalPlayers, searchProperties,
new AsyncCallback(SessionsFound), null);
}new AsyncCallback(SessionsFound), null);
if (this.networkSessionType == NetworkSessionType.SystemLink)
{
LIVESearch = NetworkSession.BeginFind(NetworkSessionType.SystemLink, maxLocalPlayers, searchProperties,
new AsyncCallback(SessionsFound), null);
}new AsyncCallback(SessionsFound), null);
Finally go back to the XboxLiveScreen.cs and edit the OnSelectEntry function and modify this line under case 1:
ScreenManager.AddScreen();to:
ScreenManager.AddScreen(new SearchScreen(networkSessionType));And thats it.
Other good news is that the new Dashboard Update released today will now be able to show your XNA 2.0 games amongst your other games (so you can fire it up without having to first open the XNA Game Launcher like before) here is the official link.
Monday, December 3, 2007
System Link Support
Well because it's pretty difficult to test LIVE Networking in the beta i've decided it's time to add System Link support, so lets go back to our XBoxLiveScreen class and modify the Constructor to pass in the NetworkSessionType and display the appropriate menu items for the selected network type:
NetworkSessionType networkSessionType;
public XboxLiveScreen(NetworkSessionType networkSessionType)
{
Now we will need to go back to the LiveOptionMenuScreen and modify the line:
"A signed in gamer profile is required to perform this operation. A Live profile may also be required. There are no profiles currently signed in, or the profile is not signed in to Live."
Basically what this means is that you need to first login with a normal gamer profile or a Silver LIVE gamer profile, so lets do a check to see if we have at least got a normal gamer profile loaded before trying to move into the next screen:
[LiveOptionsMenuScreen.cs]
case 2:
So now we support Creating a Session for both LIVE and System Link network types.
Next we will implement the Searching of a System Link session similar to how we just did the above.
NetworkSessionType networkSessionType;
public XboxLiveScreen(NetworkSessionType networkSessionType)
{
this.networkSessionType = networkSessionType;
if (this.networkSessionType == NetworkSessionType.PlayerMatch)
{
if (this.networkSessionType == NetworkSessionType.SystemLink)
{
MenuEntries.Add("Back");
}if (this.networkSessionType == NetworkSessionType.PlayerMatch)
{
MenuEntries.Add("Create XBox LIVE Session");
MenuEntries.Add("Join XBox LIVE Session");
}MenuEntries.Add("Join XBox LIVE Session");
if (this.networkSessionType == NetworkSessionType.SystemLink)
{
MenuEntries.Add("Create System Link Session");
MenuEntries.Add("Join System Link Session");
}MenuEntries.Add("Join System Link Session");
MenuEntries.Add("Back");
Now we will need to go back to the LiveOptionMenuScreen and modify the line:
ScreenManager.AddScreen(new XboxLiveScreen());to pass in the session type, you will also need to add Microsoft.Xna.Framework.Net to the using statements :
ScreenManager.AddScreen(new XboxLiveScreen(NetworkSessionType.PlayerMatch));And under case 2: lets add the following line:
ScreenManager.AddScreen(new XboxLiveScreen(NetworkSessionType.SystemLink));You will also need to the LobbyScreen.cs file and modify this line and move it to above where we checking if the networkSession is null:
ScreenManager.AddScreen(new XboxLiveScreen();To the following (here we passing in the current network session type so that it goes back to the correct menu):
ScreenManager.AddScreen(new XboxLiveScreen(networkSession.SessionType));Ok, so if we had to run the following and tried to login to System Link (without signing into LIVE first) we would get this error:
"A signed in gamer profile is required to perform this operation. A Live profile may also be required. There are no profiles currently signed in, or the profile is not signed in to Live."
Basically what this means is that you need to first login with a normal gamer profile or a Silver LIVE gamer profile, so lets do a check to see if we have at least got a normal gamer profile loaded before trying to move into the next screen:
[LiveOptionsMenuScreen.cs]
case 2:
// System Link
if (Gamer.SignedInGamers.Count < 1)
{
else
{
break;
if (Gamer.SignedInGamers.Count < 1)
{
if (!Guide.IsVisible)
{
}{
Guide.ShowSignIn(1, true);
}else
{
ScreenManager.AddScreen(new XboxLiveScreen(NetworkSessionType.SystemLink));
}break;
So now we support Creating a Session for both LIVE and System Link network types.
Next we will implement the Searching of a System Link session similar to how we just did the above.
Subscribe to:
Posts (Atom)