Monday, June 20, 2011

XNA: Game Development - Creating Player Animation

Animating objects in your game requires setting them up right. In this video, David Thany walks you through creating a sprite strip that animates your player character. Watch, then follow along at http://create.msdn.com/education/tutorial/2dgame/animating_the_player.

We will be featuring a new XNA Game Development video each Monday for the next ten weeks.  If you simply can't wait and would love to jump ahead, here are the links to the videos for the entire series.

XNA: Game Development Intro
XNA: Game Development - Designing the Game
XNA: Game Development - The Game Loop
XNA: Game Development - Creating Player Animation
XNA: Game Development - Creating a Beautiful Background
XNA: Game Development - Introducing Debugging
XNA: Game Development - Making Games Respond with Collision
XNA: Game Development - Loading Content Into Your Game
XNA: Game Development - Playing Sounds
XNA: Game Development - Creating a User Interface
XNA: Game Development - You did it! Now what?

 

glee mocospace jersey shore kesha justin bieber

Naratte is a NFC alternative that uses sound waves for mobile payments

I would bet that with all the hubbub over wireless payments over the last year we are all familiar with near-field communications or NFC at this point. Many smartphones will eventually come with NFC technology built in that will allow the user to pay for things in stores by simply holding the phone near a [...]

kesha justin bieber nicki minaj katy perry avatar movie

West Bank Settlers Spread Propaganda Using Violent Video Games

Israeli Propaganda Games
Using video games as propaganda is nothing new. The U.S. has been doing it with 'America's Army' for some time, while Hezbollah has employed 'Special Force' to spread its message. But those games might seem quaint and diplomatic in the face of a series of games from Residents' Councils of Samaria and Binyamin, an advocacy group for Jewish settlers in the West Bank. The organization has released a trio of violent shoot-'em-ups with Biblical roots and a pro-Israeli bent. The first, 'Judah Maccabee,' puts players in the role of a Maccabee soldier (a rebel army that took control of Judea from the Greeks around 167 B.C.) as he infiltrates a Greek camp. The second, 'Ahab in Samaria,' has players defending Israel from invading soldiers. 'Ammunition Hill,' the most recent game, puts players in the boots of a soldier during the invasion of East Jerusalem during the Six-Day War.

The games are rough-looking by American standards, with simplistic play reminiscent of 'Doom.' They were developed by Virtual 3D, a company that primarily traffics in archaeological software, using Shockwave (a relative of Flash). The games aren't going to win any converts to the settlers' cause, and will probably further put off those who are already unsympathetic. But propaganda will always have its place, and in the digital age that place is online games.

West Bank Settlers Spread Propaganda Using Violent Video Games originally appeared on Switched on Mon, 11 Apr 2011 11:25:00 EST. Please see our terms for use of feeds.

Permalink | Email this | Comments

lindsay lohan immigration apple unemployment tiger woods

Sega confirms 1.3m hacked accounts: Names, emails & more

Sega has confirmed that 1.3m users of its Sega Pass online network have had their personal information stolen, after the service was hacked last week. “We are deeply sorry for causing trouble to our customers” spokesperson Yoko Nagasawa told Reuters,�”we want to work on strengthening security.” Although credit card information is not among the looted [...]

penn station apple store homes for sale yellowstone national park oil spill

Chicago Catholic Church Warns Parents About Facebook

facebook conversation
While some outlets may bash Chicago's St. John Cantius Roman Catholic church for warning its parishioners of Facebook's moral dangers, we won't. After all, the church's clergy didn't forbid Facebook; they just declared that it facilitates vanity and dishonesty (specifically in children), allowing them to concoct their own identities and social realities with less risk of real-world consequence. We're right there with the church. Maybe we should've given up Facebook for Lent...

Chicago Catholic Church Warns Parents About Facebook originally appeared on Switched on Thu, 07 Apr 2011 12:10:00 EST. Please see our terms for use of feeds.

Permalink | Email this | Comments

justin bieber nicki minaj katy perry avatar movie facebook

Remembering June 2009: "Something Is Happening In Iran"

It's two years to the day since the Green Movement met its moment of truth. In honor of the fallen and of those still languishing under the coup regime, we offer a few flashbacks and reflections on that extraordinary period....

mocospace jersey shore kesha justin bieber nicki minaj

Class War on Metro North

einstein bros bagels apartments for rent things to do penn station apple store

?Tis the season...9 Steps to a Bikini Body

A bikini worthy body is achievable and surprisingly perhaps, it isn't all about ab exercises. While good physical fitness and attention to a healthy lifestyle are part of the equation, other elements to a bikini worthy body include knowing your body type and knowing which types of bikini will make the most of your assets while disguising or deflecting from any flaws. So, get ready to join the crowds on the beach or poolside in your bikini this summer with a new attitude and approach to your bodily health.

haiti earthquake sandra bullock favre lindsay lohan

On Rep. Weiner and 'Fiduciary Duty' to the Staff

world cup justin bieber myxer facebook grooveshark

[Sponsor] The AppStorm Freelance Mac App Bundle

favre lindsay lohan immigration apple unemployment

Skype 5.5 beta for Windows goes social with Facebook

By Nick Peers

Deeper integration with Facebook should appeal to the 92% of online social networkers who use the service. There's even a dedicated FB tab.



Add to Twitter Add to digg Add to Google Add to Slashdot Add to Facebook Add to Technorati Email this Article

facebook iphone haiti earthquake ipad world cup

The Case for Stiff-Arming Congress on Libya

ipad world cup eiffel tower hearst castle einstein bros bagels

Backslapping as Waterloo Burns: Tough Times Ahead for RIM?s Co-CEOs

ipad air compressor air conditioner calculator windows 7

Apple Dropping the ?Mac? From ?Mac OS X??

apartments for rent things to do penn station apple store homes for sale

Skeletal Tracking Fundamentals

This video covers the basics of skeletal tracking using the Kinect sensor.  You may find it easier to follow along by downloading the Kinect for Windows SDK Quickstarts samples and slides.

  • [00:31] Skeleton Tracking API
  • [01:24] Understanding Skeleton Quality and Joint data
  • [03:27] Setup skeleton tracking
  • [03:44] Adding a basic hand tracked cursor
  • [09:12] Using TransformSmoothing to remove ?skeletal jitter?

Setup

The steps below assume you have setup your development environment as explained in the "Setting Up Your Development Environment" video.

Task: Setup skeleton tracking

Create the Window_Loaded event

Go to the properties window (F4), select the MainWindow, select the Events tab, and double click on the Loaded event to create the Window_Loaded event

image

 

Initializing the runtime

Create a new variable outside of the Window_Loaded event to reference the Kinect runtime.

C#

Runtime nui = new Runtime();

Visual Basic

Dim nui As New Runtime()

In the Window_Loaded event, initialize the runtime with the options you want to use. For this example, set RuntimeOptions.UseSkeletalTracking to receive skeletal data and register for the SkeletonFrameReady event.

C#

nui.Initialize(RuntimeOptions.UseSkeletalTracking);  nui.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(nui_SkeletonFrameReady);  void nui_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e) { }

Visual Basic

nui.Initialize(RuntimeOptions.UseSkeletalTracking)  AddHandler nui.SkeletonFrameReady, AddressOf nui_SkeletonFrameReady  Private Sub nui_SkeletonFrameReady(ByVal sender As Object, ByVal e As SkeletonFrameReadyEventArgs)  End Sub

Running the application

Add a breakpoint inside the SkeletonFrameReady event and run the application.

Note ? You will need to stand far enough away that the Kinect can see all or most of your skeleton for the SkeletonFrameReady event to fire.

image

 

When the breakpoint fires, a skeleton position is now being tracked. You can inspect the SkeletonFrameReadyEventArgs to see that the SkeletonFrame returns a collection of six skeletons as shown below.

 

image

Task: Add a basic hand tracked cursor

In this example, we're going to use the position of the tracked skeleton's, head, left hand, and right hand to move ellipse controls.

Designing your UI

Starting from the project above, switch to MainWindow.xaml and make sure you can see the XAML code. We will add three three ellipses of varying color onto a Canvas control named MainCanvas as shown in the XAML below.

XAML

<Canvas Name="MainCanvas">     <Ellipse Canvas.Left="0" Canvas.Top="0" Height="50" Name="headEllipse" Stroke="Black" Width="50" Fill="Orange" />     <Ellipse Canvas.Left="50" Canvas.Top="0" Height="50" Name="rightEllipse" Stroke="Black" Width="50" Fill="SlateGray" />     <Ellipse Canvas.Left="100" Canvas.Top="0" Fill="SpringGreen" Height="50" Name="leftEllipse" Stroke="Black" Width="50" /> </Canvas>

Get the Tracked Skeleton

In the SkeletonFrameReady event, we'll use a LINQ query to get the first tracked skeleton.

C#

 void nui_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e) {     SkeletonFrame allSkeletons = e.SkeletonFrame;      //get the first tracked skeleton     SkeletonData skeleton = (from s in allSkeletons.Skeletons                              where s.TrackingState == SkeletonTrackingState.Tracked                              select s).FirstOrDefault(); }

Visual Basic

Private Sub nui_SkeletonFrameReady(ByVal sender As Object, ByVal e As SkeletonFrameReadyEventArgs)     Dim allSkeletons As SkeletonFrame = e.SkeletonFrame      'get the first tracked skeleton     Dim skeleton As SkeletonData = ( _         From s In allSkeletons.Skeletons _         Where s.TrackingState = SkeletonTrackingState.Tracked _         Select s).FirstOrDefault() End Sub

Getting a Joint position

A Joint position returns X,Y,Z values as explained below

  • X = Horizontal position between ?1 and +1
  • Y = Vertical position between ?1 and +1
  • Z = Distance from Kinect measured in meters

Scaling a Joint value

Given that the X and Y positions are between ?1 and +1, we can use the Coding4Fun Kinect Toolkit ScaleTo method to scale the value to a maximum X and Y position as shown below.

C#

Joint HandRight =  skeleton.Joints[JointID.HandRight].ScaleTo(640, 480);

Visual Basic

Dim HandRight = skeleton.Joints(JointID.HandRight).ScaleTo(640, 480)

You can also constrain the maximum values for the skeletal joints to a range smaller than -1 to +1.  For example, if you were designing an application where the user can reach around the screen to touch things, you may not want them to have to step left or right to reach the edges.  By using the second version of the ScaleTo method, you can specify the range of the specified joint to someting smaller as shown:

C#

Joint HandRight =  skeleton.Joints[JointID.HandRight].ScaleTo(640, 480, .5f, .5f);

Visual Basic

Dim HandRight = skeleton.Joints(JointID.HandRight).ScaleTo(640, 480, .5f, .5f)

Essentially, this code will make the joint range of -0.5 to +0.5 map to the pixels at 0 to 640.

Also, as you can see above, you can get a particular Joint, like the HandRight Joint, by using the skeleton indexer for the Joints collection. 

Setting an Ellipse Position

To move the ellipses in our MainWindow  to the location of a Joint, we will use the method below that sets the Canvas.Left and Canvas.Top position to the X (Left) and Y (Top) value from the Joint parameter.

C#

private void SetEllipsePosition(FrameworkElement ellipse, Joint joint) {     var scaledJoint = joint.ScaleTo(640, 480, .5f, .5f);      Canvas.SetLeft(ellipse, scaledJoint.Position.X);     Canvas.SetTop(ellipse, scaledJoint.Position.Y); }

Visual Basic

Private Sub SetEllipsePosition(ByVal ellipse As FrameworkElement, ByVal joint As Joint)     Dim scaledJoint = joint.ScaleTo(640, 480,.5f,.5f)      Canvas.SetLeft(ellipse, scaledJoint.Position.X)     Canvas.SetTop(ellipse, scaledJoint.Position.Y) End Sub

 

Putting it all together

Finally, in the nui_SkeletonFrameReady event, call the SetEllipsePosition methods for the three joints as shown below:

C#

SetEllipsePosition(headEllipse, skeleton.Joints[JointID.Head]); SetEllipsePosition(leftEllipse, skeleton.Joints[JointID.HandLeft]); SetEllipsePosition(rightEllipse, skeleton.Joints[JointID.HandRight]);

Visual Basic

SetEllipsePosition(headEllipse, skeleton.Joints(JointID.Head)) SetEllipsePosition(leftEllipse, skeleton.Joints(JointID.HandLeft)) SetEllipsePosition(rightEllipse, skeleton.Joints(JointID.HandRight))

image

 

 

Task: Using TransformSmoothing to for less skeletal jitter

Using the same application as above, you may notice jitteriness in the hand positions as small changes between updates to the SkeletalFrameReady event change the location of the ellipses.

Using TransformSmoothParameters

To do this, set the TransformSmooth property of the SkeletonEngine to true.  This will use a default set of smoothing parameters to reduce jitter in the skeletal tracking engine.  If these defaults don't provide you with the result you're looking for, then you can build the set of TransformSmoothParameters yourself to meet the needs for your application.

You must set the TransformSmoothParameters after calling the nui.Initialize method.

Note: Since every application is different, you will need to experiment with the parameters to understand what's right for your application.

C#

private void Window_Loaded(object sender, RoutedEventArgs e) {                //Initialize to do skeletal tracking     nui.Initialize(RuntimeOptions.UseSkeletalTracking);      //Must set to true and set after call to Initialize     nui.SkeletonEngine.TransformSmooth = true;      //Use to transform and reduce jitter     var parameters = new TransformSmoothParameters     {         Smoothing = 0.75f,         Correction = 0.0f,         Prediction = 0.0f,         JitterRadius = 0.05f,         MaxDeviationRadius = 0.04f     };      nui.SkeletonEngine.SmoothParameters = parameters;

Visual Basic

Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)      'Initialize to do skeletal tracking     nui.Initialize(RuntimeOptions.UseSkeletalTracking)      'Must set to true and set after call to Initialize     nui.SkeletonEngine.TransformSmooth = True      'Use to transform and reduce jitter     Dim parameters = New TransformSmoothParameters With {.Smoothing = 0.75f, .Correction = 0.0f, .Prediction = 0.0f, .JitterRadius = 0.05f, .MaxDeviationRadius = 0.04f}      nui.SkeletonEngine.SmoothParameters = parameters      'add event to receive skeleton data     AddHandler nui.SkeletonFrameReady, AddressOf nui_SkeletonFrameReady  End Sub

windows 7 computer speakers running shoes nikon d5000 droid x

HTC EVO 3D hands-on and unboxing

It looks like today at SlashGear we have the big brother to the most popular HTC phones to date, that being the EVO series. We have the HTC EVO 3D for you and I’ve just finished unboxing this beast in all its glory. This device features most of those exciting new features of the HTC [...]

haiti earthquake sandra bullock favre lindsay lohan

A Poem For Saturday

A 20-year-old Bahraini student and poet named Ayat al-Qurmezi has been detained since March and was sentenced this week to one year in prison. From her poem "Khalifa": Hear me: You, the elder, the "good man", who "safeguards justice" (so...

earthquake sandra bullock favre lindsay lohan immigration

GameStop Unveils New Facebook Store

gamestop on facebook
GameStop opened a new store today on Facebook. The shop, accessible via GameStop's Facebook page, allows users to purchase games online, read product reviews, watch trailers and find nearby GameStop outlets. Fans of the retailer can also "like" and share specific games on Facebook, and earn points via GameStop's customer loyalty program.

Today's launch is just the latest in a series of recent moves from GameStop, which appears eager to expand its operations. Last year, the company bought social gaming site Kongregate, and, just a few days ago, it acquired game-streaming startup Spawn Labs. According to Technologizer, GameStop has even considered developing its own tablet, though details remain hazy.

GameStop Unveils New Facebook Store originally appeared on Switched on Thu, 07 Apr 2011 14:20:00 EST. Please see our terms for use of feeds.

Permalink | Email this | Comments

world cup justin bieber myxer facebook grooveshark

RIM Announces Layoffs, 500,000 PlayBooks Shipped

iphone 4 world cup justin bieber myxer facebook

Daniel Moth: Blazing-fast code using GPUs and more, with C++ AMP

Herb Sutter recently announced C++ AMP at the AMD Fusion Developer Summit as part of his keynote. Here, Daniel Moth, a program manager on Microsoft's Parallel Computing Platform Team, digs deeper into C++ AMP with code samples and more. Please download the slides from the link below as the recording of this session doesn't do them justice.

Big thanks to AMD for providing Channel 9 with this excellent content!

To get full performance out of mainstream hardware, high-performance code needs  to harness, not only multi-core CPUs, but also GPUs (whether discrete cards or integrated in the processor) and other compute accelerators to achieve orders-of-magnitude speed-up for data parallel algorithms. How can you as a C++ developer fully utilize all that heterogeneous hardware from your Visual Studio environment? How can your code benefit from this tremendous performance boost without sacrificing your developer productivity or the portability of your solution? The answers will be presented in this session that introduces a new technology from Microsoft.

Get the slides to this presentation here.

Learn more about C++ AMP:

sandra bullock favre lindsay lohan immigration apple

Class War on Metro North

running shoes nikon d5000 droid x iphone 4 cases ipad

RIM ships half million PlayBooks during first quarter

By Joe Wilcox, Betanews

Research in Motion seemingly took forever to ship its first BlackBerry tablet. None too soon. PlayBook was one of the few bright spots during a quarter that foreshadows a grim year ahead.



Add to Twitter Add to digg Add to Google Add to Slashdot Add to Facebook Add to Technorati Email this Article

nikon d5000 droid x iphone 4 cases ipad chatroulette

June 23: Embarrassment of Riches in DC

calculator windows 7 computer speakers running shoes nikon d5000

Face Of The Day

Marilyn Monroe, from a photo essay of famous people hanging out with their vinyl records. (Hat tip: Xeni Jardin)

nicki minaj katy perry avatar movie facebook iphone