XNA Game Studio 4.0 is a programming environment that allows you to use Visual Studio to create games for Windows Phone, the Xbox 360 console, and Windows-based computers.

learn more… | top users | synonyms (1)

3
votes
1answer
1k views

How to resize an image loaded using ContentManager in XNA

I am new to XNA programming and I loaded the background image using ContentManager as a Texture2D object. The background image which I have is of size 480*320. I have kept the minimum game window ...
12
votes
3answers
2k views

Why are there lines in between my tiles?

I'm making a top down XNA game. The maps are created by tiles. A problem I recently noticed is a 'grid' of lines between the tiles. It only shows up sometimes and only depending on the camera ...
2
votes
2answers
548 views

How to store “chunks” of tiles or How to make my implementation work

I asked a previous question about the loading and unload of chunk data and people noted that my way of storing chunks is weird and I was wondering how I would go about doing it properly. @Byte56 ...
2
votes
2answers
3k views

Loading and unloading “chunks” of tiles in a 2d tile engine with 2d camera

I am making a 2d tile based game in C# and XNA 4.0. I am having trouble loading and unloading "chunks" of tiles(blocks). The whole world is randomly generated and is infinate on both axis. How would I ...
0
votes
1answer
322 views

flicker when drawing 4 models for the first time

i have some models that i only draw at a certain moment in the game (after some seconds since the game has started). The problem is that in that first second when i start to draw the models, i see a ...
1
vote
1answer
2k views

How do I reset a game level

I have managed to implement a screen state system which I use to access the game. When the the character has collided with an enemy tile the game ends by going to a seperate game over screen. After ...
1
vote
1answer
284 views

How can I get a set of raw samples from an audio file in XNA 4.0?

In particular, I'd like to know how to get a set of audio samples that are compatible with the XNA's Sound API classes, such as the DynamicSoundEffectInstance class. I've used the ...
0
votes
2answers
916 views

XNA Framework HiDef profile does not support alpha blending

I am getting the following error, even though the code runs through the Draw could twice and then it errors: XNA Framework HiDef profile does not support alpha blending or ColorWriteChannels ...
1
vote
2answers
339 views

expand section of a texture 2D (zoom)

I have a texture2d loaded and wish at a certain moment to make a sort of zoom on the texture2d. As you can see in the image i would like to expand my red square to the resolution of the black ...
3
votes
1answer
2k views

Why isn't my sprite being drawn in the correct position in XNA?

Sorry if this has been asked before, but I can't seem to find it here. I'm trying to make an asteroids clone in XNA. I took the Game State Management project and am making new classes for things like ...
0
votes
0answers
77 views

Any way to optimize testing each bullet for each enemy in shoot em' ups? [duplicate]

Possible Duplicate: Is there a way to increase the collision check efficiency of a system of n objects? Lately I have been making a shoot em' up, and for collision detection I would use ...
1
vote
1answer
2k views

How does Terrain following work on height map?

I'm writing a 3D world game which consists of a terrain map (generated by brownian motion algorithm) and a simple avatar. My goal is to make the avatar move smoothly between points of different ...
1
vote
2answers
910 views

Reference a single 2d Rectangle in an array

What I am attempting to do probably has a very simple answer but I can't make heads or tails of it no matter how hard I try. Provided I'm a newb. What I am trying to do is after I create a grid of ...
2
votes
1answer
700 views

2D Point Light XNA , Why my point light radius is Oval?

I friend of mine , taught me how to make a simple 2d point light with shader, so i follow his steps and finally done it ! but something happend , the light shape is like an oval and not like a ...
0
votes
1answer
465 views

XNA Sprites Not Drawing Correctly

I have a problem through out my current code where certain Texture2D's are not drawing correctly over each other. For example, at the start I have sprite font being drawn over a background image and ...
0
votes
2answers
641 views

XNA Subtract blending function doesn't work

I wanted to subtract a white image with black circle background from a picture to get a lighting circle here is the white image So I wrote this code spriteBatch.Begin(SpriteSortMode.Deferred, new ...
1
vote
1answer
1k views

SpriteBatch Draw Using Floats with the Destination Rectangle

So I created a nice little isometric tile engine and I have it so that when you scroll with the mouse it changes a variable called scale. Scale is a float and gets passed through the ...
12
votes
1answer
2k views

How can I create gradiented Fog of War?

I'm creating a top down 2D RTS game for educational purposes. Currently, I'm really just copying Starcraft's design/ideas. I've decided I should probably implement Fog Of War too. My expectations: ...
11
votes
2answers
1k views

Projective texture and deferred lighting

In my previous question, I asked whether it is possible to do projective texturing with deferred lighting. Now (more than half a year later) I have a problem with my implementation of the same thing. ...
1
vote
1answer
717 views

Farseer DebugViewXNA: scaling problem

I'm trying to get into Farseer and XNA. Before I do any real graphics, I want to use the Farseer debug view only. The problem ist, that I don't really know which matrix to use and the other thing is ...
2
votes
1answer
2k views

2D layerDepth not working XNA 4.0

I'm struggling with getting the depth layer to work properly. No matter what I do, the line is drawn over the top of the circle texture. public void Draw(SpriteBatch spriteBatch) { ...
0
votes
2answers
2k views

How to move a 3d object in 3d coordinate space

How can I move a 3d object in a 3d coordinate space? I have a coordinate output from a text file like this: -0.420 , -0.329 , 2.953 -0.296 , -0.314 , 3.136 -0.296 , -0.314 , 3.136 -0.296 , -0.314 , ...
1
vote
2answers
197 views

How (if possible) would I change the BasicEffect Matrix mid draw

Say, for example, I have a list of enemies. Each enemy is a textured quad which is the stored in a singular shared VertexBuffer and IndexBuffer with the buffer usage set to BufferUsage.WriteOnly ...
2
votes
2answers
414 views

How often to SendData() in my peer-ro-peer XNA game?

Currently I call myLocalNetworkGamer.SendData(myPacketWriter, ...) every Update(). 60 times a second sounds too much. Is there an inbuilt way to only send less often? How often should network ...
2
votes
2answers
2k views

Creating 2D billiard game with realistic movement

I'm new to XNA and game programming. I'm creating a 2D billiard game and I want to add balls with realistic movement (like 3D). Is it possible to achieve this without using 3D models? I only want to ...
9
votes
5answers
4k views

45° Slopes in a Tile based 2D platformer

I want to have simple 45° slopes in my tile based platformer, however I just cant seem to get the algorithm down. Please take a look at the code and video, maybe I'm missing the obvious? ...
4
votes
2answers
321 views

Box-box contact information

I have two colliding boxes, How i can calculate contact information like (contact normal, contact point and penetration) . Is there any simple algorithm . Note: i'm using XNA .
3
votes
1answer
1k views

XNA mouse position in windows forms

I am using this code in Update method in XNA RenderControl in Windows Forms: ... Mouse.WindowHandle = renderControl1.Handle; MouseState stat=Mouse.GetState(); ... Everything works fine but when I ...
2
votes
1answer
1k views

How to get window size from within another class?

I have found this post explaining about how to get the size of the Window, but for whatever reason I'm having issues getting it to work inside of a Singleton class that I'm made to manage a set of ...
3
votes
1answer
245 views

Does ContentManager.Load<T>() re-read an asset if I have loaded it before?

Or is it smart enough to know I have asked for it before and return an in memory copy created from the first call? For example if I have a projectile's texture: Texture2D projectile; If then I ...
0
votes
1answer
335 views

NullReferenceException problem when loading savegame in XNA 4.0

I want to enable my program to load "savegames", and I followed the tutorial on MSDN, but when I run my code, I get the NullReferenceException error. I use an xml file as my savegame data container, ...
4
votes
1answer
1k views

Creating a Model out of Math primitives

Here is a litte sample that I drew in Blender to visualize what I am planing to create: Cone with spheres sample I already have the code to generate the cone and the spheres as mentioned in my ...
4
votes
2answers
929 views

Setting variable values in XNA 4.0 from an XML file

I made a program that simulates an assembly line using the XNA 4.0. I made a 3D model, and divided it into 5 positions - start, 3 workstations, and end. These positions represent the places on the ...
2
votes
1answer
285 views

When animating sprites, why subtract frametime when switching between sprites instead of resetting elapsed time to zero?

I am currently on chapter 3 of the book "Learning XNA 4.0". At the end of this chapter is a section on changing the animation speed of sprites. timeSinceLastFrame += ...
6
votes
1answer
538 views

How can I embed music in my XNA .exe?

I'm trying to embed music in my XNA game's .exe (with resources) but compiling them as a sound effect stores the music in uncompressed form, which results in a 16 MB .exe. I can compress my music ...
3
votes
2answers
1k views

Depth buffer and render target

When I use this RenderTarget: renderTarget = new RenderTarget2D(GraphicsDevice, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.Depth24); ...
2
votes
3answers
2k views

Problem loading content in WinForms using XNA

I'm currently having trouble implementing loading content with the content pipeline into my WinForm application. I'm using the "WinForms Series 1: Graphics Device" sample provided by microsoft. By ...
1
vote
1answer
2k views

XNA 4.0 - Mixing 3D and 2D - SpriteBatch putting weird alpha texture over whole scene

I am working on a game in XNA 4.0 that has been entirely in 3D so far but now I want to incorporate a HUD. I have tried doing a simple test using spriteBatch as such: spriteBatch.Begin(); ...
2
votes
1answer
1k views

How can I draw multiple vertexbuffers with indices?

I'm using to types of vertices. For the triangles: 0 Vector3 Position, 12 Color Color, 16 Vector3 Normal For the lines: 0 Vector3 Position, 12 Color Color I setup a vertex buffer for each ...
2
votes
2answers
415 views

Rotating a planet around a ships axis

I have a planet rotating around its own axis (like regular planets, and Pluto) and a spaceship that can fly around in space. The idea is to lock the player (ship) in a deadzone "above" the planet and ...
2
votes
1answer
2k views

Simple WP7 pong game with real time multiplayer using sockets

I'm making a pong clone for Windows Phone 7 and I'd love to add a multiplayer option. I've been trying to use this Ricky Tan's tutorial: ...
3
votes
1answer
525 views

How can I use orientation to compute position in Windows Phone 7? [closed]

I'm using the motion API and I'm trying to figure out a control scheme for the game I'm currently developing. What I'm trying to achive is for an orienation of the device to correlate directly to a ...
2
votes
1answer
893 views

Combine 3D objects in XNA 4

Currently I am writing on my thesis for university, the theme I am working on is 3D Visualization of hierarchical structures using cone trees. I want to do is to draw a cone and arrange a number of ...
4
votes
1answer
736 views

How can I achieve a zoom-like camera effect?

I have a top down 3D camera: view = Matrix.CreateLookAt(new Vector3(0,0,20), Vector3.Zero, Vector3.Up); Now I want to achieve the effect like when I zoom in the scene and only show a section at the ...
6
votes
1answer
2k views

Fixing Slow XNA Game

I'm kind of new to XNA (and games in general). I'm trying to make a young relative of mine (10yo) a simple fun game where he is the main character. I'm down to the wire (I have to get it to him by ...
2
votes
1answer
450 views

Is there a technique to creating a “black hole” background in XNA?

I'm creating application in XNA 4.0 and am trying to create a specialized background. I'm familiar with the creation of a parallax scrolling background but I'd like to create a background image that ...
2
votes
3answers
3k views

Depth Buffer not working in XNA?

I'm stumped. I have been fighting this for about 2 hours now. Here are the interesting parts of my code: protected override void Update(GameTime gameTime) { // Allows the game to exit if ...
3
votes
3answers
3k views

Alpha blending not rendering properly XNA 4.0

I'm trying to render a tree made out of 2 rectangles intersecting in the center at a 90degree angle. The texture has an alpha channel but which ever rectangle gets rendered second causes a weird ...
0
votes
1answer
329 views

XNA and C# Draw method question

If I missed the answer to this question being already posted I apologize but I was unable to find it. I'm new to C# and XNA and converting a VB game I created into them. Im finding a problem I'm not ...
0
votes
1answer
151 views

I want to split the texture width

Simple question: I have this image that is 200x200. I want to change it to 100x200 inside the HSLS, making it thin. Anyone have idea? I tried to do something like output *= ...