Samuel's profileTech ChallengeBlogListsGuestbookMore Tools Help

Tech Challenge

Information about the Tech Challenge

Samuel Stokes

No list items have been added yet.

Feed

The owner hasn't specified a feed for this module yet.
September 19

Tech challenge Rules

 
Here is a reading of the rules, please feel free to comment to my email at sstokes@microsoft.com
 
 

Tech Challenge

 

Here is a description of the Tech Challenge

 

  

 

September 08

Game

February 03

Pong in 5 Minutes

Work along with the video, use the code snippets below to follow along, along with the simple graphics:

 

This video, along with the code snippet file that you can find at my sky drive:

>>Pong in 5 minutes code snippets and image files<<

 

Investigating the Point concept in XNA and Pong

What is the Point in XNA?  Take a look at this video, and use the code snippets below to follow along, the simple graphic is included.

 

 

 

>>Code Snippet zipped file<<

December 28

PONG: The Adventure begins! Adding graphics to XNA Express!


Speaking Notes


Steps to Reproduce


"Now let's add graphics to our game. First, I'll create a folder called media and in it, I will now add a new ball and paddle. As you can see, the paddle and ball are the same as in the classic game."

First let's add a folder to hold the media material for the content pipeline.

 

  • Right-click on Pong project in Solution
    Explorer
  • Click Add > New Folder
  • Call the folder Media

Now we will add the two media files:

Ball.png and paddle.png

  • Right-click on Media folder
  • Select Add Existing Item
  • Using the Ctrl key: Select ball.png and paddle.png from your "DevelopMental XNA Files" folder on your desktop
  • Click Add button


"Now I'm going to change the properties of the images to copy if newer. This specifies if the image will be copied to the output directory when I'm building my solution. I want to make sure that if I decide to make changes to my graphics, that they are reflected in the build."

  • Click on ball.png
  • Go to the Properties window
  • Select the Copy to Output Directory property
  • Set the property to Copy if newer
  • Click on ball.png
  • Go to the Properties window
  • Select the Copy to Output Directory property
  • Set the property to Copy if newer
  • Repeat for paddle.png

 


"Now we will create a class called Paddle. In order to do this, we'll create a new class file called Paddle.cs. Then, we have to add the Xna namespace and our implementation code. We have two variables to set the position of the paddle, one defining the coordinates and the other defining the speed. Next, we have a constructor to set the paddles properties. "


1. Right-click on the Pong project in
Solution Explorer
2. Click Add > New Item
3. Select a C# Class
4. Call the class Paddle.cs
5. Edit the file
6. Add using Microsoft.Xna.Framework;
namespace to the namespaces
7. Highlight the class code inside Paddle class
8. Right-click and select Insert Snippet
9. Add the Paddle code snippet, titled:

Demo 2-Step 6 (Paddle Class)

 

 


"Then, we'll create a class called Ball and reproduce the same steps. The difference here is that instead of a constant speed, the horizontal and vertical speed is randomized."

<<Adding the code is similar to the paddle.cs component, refer to that for instructions, this is the previous demo component.>>


1. Right-click on the Pong project in
Solution Explorer
2. Click Add > New Item
3. Select a C# Class
4. Call the class Ball.cs
5. Edit the file
6. Add using Microsoft.Xna.Framework;
namespace to the namespaces
7. Highlight the class code inside Ball class
8. Right-click and select Insert Snippet
9. Add the Ball code snippet, titled

Demo 2- Step 6 (Ball Class)


"The next thing we need to do is add the variables. Let's open the main class and add variables to initialize graphics in our game."

 

 


1. Edit Game1.cs
2. Scroll to right after the ContentManager
variable declaration in the Game1 class
3. Right-click and select Insert Snippet
4. Add the variables code snippet, titled

Demo 2- Step 7 (Variables)

 


"Next, we'll add a ResetGame method to initialize the elements in the game."

 

  1. Scroll right after the variable declarations in the Game1 constructor
  2. Right-click and select Insert Snippet
  3. Add the ResetGame code snippet, titled
    1. Demo 2 –Step 9 (Reset Method)
  4. Go to the Intialize method and add ResetGame(); after the TODO comment.


"We need to load the textures and initialize the sprites that we are using in the game. As you can see, the textures are 2D and are referenced from our Media folder."


1. Scroll to the LoadGraphicsContent
method
2. Right-click inside the loadAllContent
conditional block
3. Right-click and select Insert Snippet
4. Select Code Snippet
5. Insert the code to load the Textures
and initialize the SpriteBatch


"Finally, we need to add some code to our Draw method. This will draw the graphics on the screen from the SpriteBatch including the two paddles and the ball. "

  1. Scroll to the Draw method after the TODO comment.
  2. Right-click inside the Draw constructor
  3. Right-click and select Insert Snippet
  4. Select Code Snippet
  5. Insert the snippet titled:
  • Demo 2 – Step 11(Code for Draw Method)


"The last step is to build and launch our game. As you can see, the graphics now appear."

(Remember the game doesn't move, you have only loaded the graphics.)


1. Click on the F5 function key to launch
the application

December 27

Creating Games with the XNA Framework - Part 1 (starting over again, hang in there)

GETTING READY TO Build Pong

 

Before you get going make sure you have done these steps:

  1. Install Visual C# Express.
  2. Install XNA Game Studio Express
  3. Extract the files from the Develop Mental Game kit.
  4. Copy the Develop Mental XNA Files folder to your desktop.
  5. Open Game Studio Express and install the snippet file.
    1. Select the Tools Menu.
    2. Select Code Snippet Manager.
    3. Click Add.
    4. Navigate to the Develop Mental XNA Files folder and then the Code Snippets folder.
    5. Click Open. (You will not see any files listed.)

XNA Game Studio Express
“Creating Games with the XNA Framework - Part 1”
Working with the XNA Framework, no code attached to this one,


Steps to Reproduce

“In this session, I will be showing you how to build a game step by step using XNA Game Studio Express. The game we will be building is Pong - a game that should be quite familiar to you. Let’s start by launching XNA Game Studio Express and creating a brand new project.”

1. Launch XNA Game Studio Express
2. Create a new Windows Game using the XNA templates
3. Call the game PongClassic

“All XNA games have a standard template and format. First, you’ll notice that we are leveraging the XNA namespaces within our application, which provides support for audio, content, graphics, input controls and storage.”

1. Expand the Using Statements region
2. These are the XNA Namespaces, which are located in special files that are referenced automatically when you use the template.  Go to http://msdn.microsoft.com and search for more information about Using statements in C#.

“Notice that Game1 inherits from the Microsoft.Xna.Framework.Game interface which helps you easily manage the game’s logic and rendering code. We also define the GraphicDeviceManager object which handles the configuration and management of your graphic device. The ContentManager object is a run-time component that loads in managed objects from the binary files produced by the design time content pipeline.”

1. Scroll to the Game1 class
2. Show the code as per the speaking
notes

“The Initialize() method sets up the initialization of the game. This is where you set up your game elements such as the sound effects.”

1. Scroll to the Initialize() method
2. Show the code as per the speaking
notes

“LoadGraphicsContent() loads your games’ graphical content into the Resource Management Mode pools. You can use this method to load in the individual bitmap graphics for your game.”

1. Scroll to the LoadGraphicsContent()
method
2. Show the code as per the speaking
notes

“UnloadGraphicsContent() is self-explanatory. It unloads your graphics contents and empties the pool. It will be called once the game screen is shut down.

1. Scroll to the UnloadLoadGraphicsContent()
method
2. Show the code as per the speaking
notes

“Let’s now compile and run the game and take a look at the output. The result is simply a blank pale blue window. In case you are wondering, the exact color is CornflowerBlue.”

1. Hit F5 to compile and launch the
solution
2. A pale blue window will appear
on the screen

“As you know, the classic version of Pong does not have a blue background, it has a black background. So let’s make the first change to our application and change the color to black.”

1. Go to the Draw() method in your code
2. Change:

graphics.GraphicsDevice.Clear(Color.CornflowerBlue) to

graphics.GraphicsDevice.Clear(Color.Black).

All of the color options should appear in Intellisense

“Now we’ll recompile and launch – now the game is starting to look more like the Pong we all know and love. In the next demo, I’ll show you how to implement the graphics within the game.”

1. Click F5 to compile and launch the
solution
2. The background of the game window
should now be black

 

More to follow, hang in there!

October 21

Another excellent blog about pong, with solid explanations

This blog: http://eterragame.spaces.live.com/blog/cns!3FEF01FB0C7C77C7!144.entry is an excellent discussion about the nature of how the ball bounces in pong!
 
Thanks for visiting!
Please wait...
Sorry, the comment you entered is too long. Please shorten it.
You didn't enter anything. Please try again.
Sorry, we can't add your comment right now. Please try again later.
To add a comment, you need permission from your parent. Ask for permission
Your parent has turned off comments.
Sorry, we can't delete your comment right now. Please try again later.
You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
Complete the security check below to finish leaving your comment.
The characters you type in the security check must match the characters in the picture or audio.
Mar. 2
cheap shoeswrote:

air Jordan Shoes,Nike Air Jordans, Air Force Ones,Retro Air Jordan ...

air Jordan Shoes,Nike Air Jordans, Air Force Ones,Retro Air Jordan, Bape Hoodies,Bape shoes-Tencent Traveler|Jordan Shoes,Nike Air Jordans, Air Force Ones ...

Nike Shoes,Jordan Shoes,Air Jordan are so cheap at Jordanshoesstore.com

Cheap Nike Shoes, Air Jordan Shoes are on sale now, our Air Jordan, Nike Shoes are exclusive and we offer original box of jordan shoes, we have new nike ...

Jordan Shoes,Adidas Shoes,Gucci Shoes,Timberlands boots,Prada Shoes

Buy Jordan Shoes and Adidas Shoes are on sale here today.Nike Shoes you are looking for are available.Shoes include: Gucci Shoes,Timberlands boots,Prada Shoes wholesale ...

Jordan Shoes, Nike Shoes, Air Jordan, Air Jordans are cheap to buy ...

Nike Shoes:Air Jordan Shoes are on sale in this online store, you can buy Air Jordan for cheap here and we have new Air Jordans every weeks, our Air Jordan.

Mar. 2
Hey Professor Stokes,
 
Just wondering how your summer is going.  It's cool that you're able to come back next semester for 386.  I wanted to let you know that I landed an IT job part time with the Garden Grove school district.  It will be a good job while I wait for something better and finish up school.  If any kind of awesome position becomes available with microsoft just let me know.  I've been doing research here and there on different .net technologies and such, found out about silverlight, that looks pretty interesting, also found out about the MS Milan project.  That is really awesome technology, I hope to see it soon.  Anyway, I thought i'd let you know about a really cool program about the history of various gaming companies, and industry specific events like the crash in the '80's, the rise of nintendo, the development of microsoft in the game console market, etc.  You should get your hands on G4TV's Icons Seasons 1 & 2.  I think they could potentially be a great addition to your introduction to the game industry in your 386 class.  Check out the episodes if you're able to get your hands on them.  The episode about the Xbox, in particular, is pretty interesting.  Later for now.
 
-James
July 10
Kumar Roshanwrote:
Reallly nice documented information .....
 
Thanks
 
May 8

Windows Media Player

No list items have been added yet.