The Case of the Unexplained Sharing Violation

November 24, 2010

(pardon to Mark Russinovich for the title “The case of…”). This seemingly innocent code caused a sharing violation error (32) after a few iterations:    for(int i = 0; i < 10000; i++) {       sprintf_s(text, "Text from process %d\r\n", GetCurrentProcessId());         HANDLE hFile = CreateFile(_T("c:\\temp\\test.txt"), GENERIC_WRITE, 0, 0, OPEN_ALWAYS, 0, 0);       if(hFile == INVALID_HANDLE_VALUE) {          DWORD err = ::GetLastError();          printf("Error opening file %d (%d)\n", err, i);          break;...
no comments

My TechEd 2010 Session

November 19, 2010

TechEd 2010 in Eilat is approaching fast. My session is about what MEF (from .NET 4)and Unity (from the Enterprise Library, but does not depend on it) can do for you and your code. If you’re new to MEF and wonder what that is and what it can do (and you’re not on your plane back to Israel center at that time), you might want to stop by. If you’re using the dependency injection idea with Unity, I’ll show some of the things Unity can do. It’s gonna be fun, mostly demos, and hey – it’s the last session...

XNA 2D Game Tutorial (Part 11)

November 17, 2010

Previous posts in this series: Part 1: Getting started Part 2: Drawing something Part 3: Input handling Part 4: Game Components Part 5: Animation and Sprites Part 6: Handling Projectiles Part 7: Sound Effects Part 8: Setting Up Data Part 9: Creating Aliens Part 10: Collision Detection In the previous part we did some collision detection...
4 comments

XNA 2D Game Tutorial (Part 10)

November 16, 2010

Previous posts in this series: Part 1: Getting started Part 2: Drawing something Part 3: Input handling Part 4: Game Components Part 5: Animation and Sprites Part 6: Handling Projectiles Part 7: Sound Effects Part 8: Setting Up Data Part 9: Creating Aliens In the previous part we created a bunch of alien enemies that are moving down the screen. Currently,...
tags: , , , ,
no comments

XNA 2D Game Tutorial (Part 9)

November 14, 2010

Previous posts in this series: Part 1: Getting started Part 2: Drawing something Part 3: Input handling Part 4: Game Components Part 5: Animation and Sprites Part 6: Handling Projectiles Part 7: Sound Effects Part 8: Setting Up Data In the previous post we prepared the data for the aliens and for the game levels. In this post, we’ll put that data to action....
tags: , , , , ,
no comments

XNA 2D Game Tutorial (Part 8)

November 13, 2010

Previous posts in this series: Part 1: Getting started Part 2: Drawing something Part 3: Input handling Part 4: Game Components Part 5: Animation and Sprites Part 6: Handling Projectiles Part 7: Sound Effects   What do we have so far? A player controlling a ship capable of firing missiles (with sound), flying through space with a backdrop of passing stars. Clearly, no real challenge for the player...
5 comments

XNA 2D Game Tutorial (Part 7)

November 11, 2010

Previous posts in this series: Part 1: Getting started Part 2: Drawing something Part 3: Input handling Part 4: Game Components Part 5: Animation and Sprites Part 6: Handling Projectiles The game as it is now is not yet challenging – there are no enemies to threaten the player – she simply flies through space, shooting at nothing. We’ll deal with some enemies in the next part, but first let’s consider sound....
tags: , , , , ,
no comments

XNA 2D Game Tutorial (Part 6)

November 9, 2010

Previous parts in this series: Part 1: Getting started Part 2: Drawing something Part 3: Input handling Part 4: Game Components Part 5: Animation and Sprites In the previous part, we added animation capabilities to a general Sprite class. Our next step is to add firing capabilities to the player. The first thing we’ll do is move the player logic to its own component. This would make it flexible (allowing us to disable it in a title screen, for example)...
tags: , , , , ,
2 comments

XNA 2D Game Tutorial (Part 5)

November 7, 2010

Previous parts in this series: Part 1 (Getting Started), Part 2 (Showing Something), Part 3 (Input Handling), Part 4 (Game Components). What do we have at the moment? A ship we can control with keyboard and stars flying by, implemented as a DrawableGameComponent for flexibility and modularity. Although the ship seems to move, it’s still too static. Its engines are not changing. What we want is some animation. Perhaps toggling between two images such that the engine would seem to fluctuate? Animation (in the 2D world, at least) means changing the shape of a sprite with respect...
tags: , , , , ,
9 comments

XNA 2D Game Tutorial (Part 4)

November 6, 2010

Previous posts in this series: Part 1, Part 2, Part 3. Our sprite ship is moving with the help of the arrow keys. But it doesn’t seem to be travelling through space. Perhaps we should add some starts going by, as the ship travels forward at incredible speeds… We could continue with the same basic idea we use with the player’s ship: Add appropriate variables, update stars position in the Update method and draw them all in the Draw method. This will cause some bloating of Update and Draw, not to mention the alien enemies we’ll add...
tags: , , , , ,
2 comments