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)

45
votes
3answers
10k views

Optimizing an XNA 2D game

Does it make sense to implement the logic to skip rendering objects outside the viewport or should I not care about it and let the Framework do it?
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 ...
35
votes
8answers
16k views

How'd they do it: Millions of tiles in Terraria

I've been working up a game engine similar to Terraria, mostly as a challenge, and while I've figured out most of it, I can't really seem to wrap my head around how they handle the millions of ...
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 ...
12
votes
1answer
3k views

Disposing only certain resources in XNA?

The ContentManager in XNA 4.0 only has one Unload() method that Unloads all Assets. I want to have some "global" Assets that are always loaded, but then I want per-Level Assets which should be ...
11
votes
2answers
6k views

How do I disable texture filtering for sprite scaling in XNA 4.0?

I have a sprite that I'm trying to scale up in XNA, but XNA is applying some sort of texture filtering that smooths it and makes it look ugly. I'd like it to just do pixel doubling instead of ...
4
votes
3answers
7k views

2D Tile-based Collision Detection

I've been planning an indie game project for a while now. I'll summarise it for you so I can get right to the question. It's done entirely using the latest version of XNA through Visual Studio. ...
6
votes
1answer
2k views

Sidescroller variable terrain heightmap for walking/collision

I've been fooling around with moving on sloped tiles in XNA and it is semi-working but not completely satisfactory. I also have been thinking that having sets of predetermined slopes might not give me ...
4
votes
1answer
2k views

XNA Platformer Sample: Supporting multiple resolutions?

I have been looking at the XNA Platformer Sample and noticed that, when you change the resolution, the game world still renders at 800x480 and not the new width and height of the display. Can anyone ...
4
votes
1answer
1k views

Friction in 2D game

I'm developing a 2D platformer, although this question could probably apply to just about any 2D type physics; What is the equation for friction? I have sort of a hacky type of friction set up in my ...
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? ...
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); ...
14
votes
2answers
3k views

Creating an electricity/lighting/tesla coil effect in a 2D XNA game?

I'd like to create beams of electricity between two points very similar to this video: http://www.youtube.com/watch?v=eMJ8-56L3Lc. The effect is so dynamic, with varying lengths and pseudo-random ...
7
votes
1answer
629 views

How To Approach 360 Degree Snake

I've recently gotten into XNA and must say I love it. As sort of a hello world game I decided to create the classic game "Snake". The 90 degree version was very simple and easy to implement. But as I ...
3
votes
3answers
2k views

How to make multiple levels game in XNA game studio 4.0?

I am doing 2D game using XNA framework 4.0. I'd like the game to have multiple levels. Where do I store the levels and how do I implement a scoring system for the game? Can I use XML for storing data ...
3
votes
1answer
314 views

How to access the nth element in a 2d texture from a pixel shader in XNA

How can I access the nth element in a texture2d from a pixel shader? For example if I wanted to get the 5th vector4 from 10 x 10 texture2d
1
vote
1answer
322 views

Pixel Shader - apply a mask (XNA)

I'd like to apply a simple few masks to few images. The first mask I'd like to implement is mask like: XXXOOO I mean, that on the right everything is masked (to black), and on the left everything ...
0
votes
1answer
145 views

Mouse input not updating in custom XNA/Winforms panel

I have a custom Panel residing within my WinForm. the custom Panel holds the XNA rendering. So far, I've rendered an 3D test model. What I'm doing now is trying to handle the input.Using a camera from ...
0
votes
2answers
478 views

XNA change a specific color of a model to another

Is it possible to change a specific color of a model to another? Example: Everything that's blue should be red or something like that. And is it possible to do this without the use of effects? I ...
12
votes
1answer
1k 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
1answer
770 views

How do I prevent XNA from pausing Updates while the window is being resized/moved?

XNA stops calling Update and Draw while the game window is being resized or moved. Why? Is there a way to prevent this behaviour? (It causes my network code to desynchronise, because network ...
5
votes
2answers
2k views

Sloped tiles in Platformer

I'm extreme new to game development and this is my second project. I’m working on a platform game that expands on the Platformer example provided at the app hub, so far I’ve got parallax scrolling ...
7
votes
5answers
3k views

2D Procedural Terrain Generation - Guaranteeing connectedness?

I'm working on a 2D platformer in XNA. One of things I'd like to be a main design characteristic is procedural content generation. The first step of that is to procedurally generate the terrain. So, ...
14
votes
1answer
3k views

How do you add equipment to a 3D character model using XNA/Blender?

I've watched quite a few Blender tutorials, but I have yet to see examples of how to swap out sub-models. So my question is, how do you swap out equipment on a character model? Specifically I’d like ...
4
votes
1answer
211 views

Creating rectangles from the inner part of a texture2D

Ok, this may be hard to understand, but I'll do my best. You will see that the first image is a normal mario, and the other is the result I am looking for. I'm trying to find a way to extract ...
7
votes
1answer
4k views

Resolution Independent 2D Rendering in XNA

I am trying to figure out the best way to render a 2d game at any resolution. I am currently rendering the game at 1920x1200. I am trying scale the game to any user selected resolution without ...
6
votes
3answers
607 views

How do I make a moving object stop smoothly at the end of a path?

There are a dozen ways I could word this question, but to keep my thoughts in line, I'm phrasing it in line with my problem at hand. So I'm creating a floating platform that I would like to be able ...
2
votes
2answers
1k views

What's efficient way to draw a lot of textured cubes in XNA4?

Title says it all. What's efficient way to draw a lot of textured cubes in XNA4?
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. ...
7
votes
2answers
3k views

The true cost to get my XNA game on XBox?

There seem to be many hurdles to get ones game onto Xbox, so far I have uncovered: You need Visual Studio (once your game becomes commercial you cannot use Express - but have to pay for ...
6
votes
2answers
2k views

How do I align the matrix used in SpriteBatch and the matrix used in BasicEffect?

I'm writing a Windows tool that uses XNA and allows the user to place textures on the screen. I'm using a 'camera' for the SpriteBatch used to draw the textures, e.g: Matrix matrixForSpriteBatch = ...
5
votes
1answer
403 views

2D Magnet-like repelling behavior

If somebody wanted to develop a system between two intersecting rectangles so that the rectangles would, in a gradual process, push eachother away from one another until no longer intersecting, with ...
5
votes
5answers
934 views

Glass shatter simulation

I need to make a simulation with stone thrown on the glass window. Could you please help me choose the tools to make it quickest and easiest? And maybe some tips how to do it :). I mean, I was ...
4
votes
2answers
3k views

Drawing a texture line between two vectors in XNA WP7

I want to create a simple graph maker in WP7. The goal is to draw a texture line between two vectors what the user defines with touch. I already made the rotation, and it is working, but not ...
4
votes
2answers
425 views

Does XNA support 1 dimensional textures

Does XNA support 1 dimensional textures. And by 1 dimension texture I mean something like Texture1d not a Texture2d where one dimension is 1 (because of the 4096 limit)
3
votes
4answers
575 views

Some advice for settling on a map format for a tile game?

I am using XNA 4.0 and am currently working on a simple tile game to pass the time. Basically, I'm using the tried and true method of having numbers refer to tile types, where in 0 would be an empty ...
2
votes
2answers
1k views

XNA Camera 2D confusion

I have followed the tutorial at http://www.david-amador.com/2009/10/xna-camera-2d-with-zoom-and-rotation/ to implement my 2D camera and everything works just fine. However this leaves me confused. ...
1
vote
2answers
186 views

How can I project a vector on another vector?

I have a generic not normalized Vector3 v1 and I want to calculate its component along another Vector3 v2. I used to normalize the vector I want to be the direction and then multiplying the other ...
1
vote
2answers
97 views

margin of error trying to check if a point lays on line

Working with floating point values it is as easy as breathing to run on approximation errors by comparing quantities which should be the same. I want to know if there is a way built in some MSDN (or ...
1
vote
2answers
2k views

Create a body of an irregular 2D sprite in Farseer

I'm trying to create a body of a irregular 2D sprite Farseer 3.3.1. The regular shapes that BodyFactory provides are not that I want. Is there a way that one can create irregular objects? Could it be ...
16
votes
2answers
24k views

Error on new XNA 4.0 game project - No suitable graphics card found

Any ideas on how to fix this? According to what I remember about XNA 3 was that when running the application from scratch, I would get a blue colored windows with nothing rendered. Any suggestions? ...
6
votes
2answers
502 views

How does one specify raster operations in XNA?

I'm looking for a way to add a sprite using a particular logic operation (like XOR). I can't find anything on Google and I'm not sure where to look in the documentation. I've looked into ...
5
votes
1answer
496 views

How to attach two XNA models together?

I go back on unsolved question I asked about attaching two models together, could you give me some help on this ? For example, If I want to attach together Model1 (= Main model) & Model2 ? I ...
3
votes
1answer
457 views

Importing 3d model with multiple skeletons

I have created an animated butterfly in 3ds Max and try to export it in ".fbx" format to use in XNA, however as soon as I compile, i get the following Errors: Warning 1 Multiple skeletons were ...
3
votes
2answers
401 views

Cutting out smaller rectangles from a larger rectangle

The world is initially a rectangle. The player can move on the world border and then "cut" the world via orthogonal paths (not oblique). When the player reaches the border again I have a list of path ...
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 ...
3
votes
1answer
986 views

2D platformer corner collision

Repost from my question on stack overflow, didnt know this site existed. I have a 2d platformer and I need help with collision. To show you my current collision system, here is picture: Top picture ...
2
votes
1answer
216 views

XNA Framework Reach profile does not support separate alpha blend

Yesterday I released my app 'Pic Words' to the windows phone store. It is an Silverlight/XNA app that runs on Windows Phone 7.1 & 8. I have BugSense incorporated into my app. Today I started ...
2
votes
2answers
709 views

Background blur in 2D game?

In an XNA 2D game, I am thinking about blurring the background slightly to increase the feeling of depth? I am already using parallax scrolling which works pretty well in terms of enhancing depth ...
2
votes
1answer
2k views

How to get file paths in XNA 4.0?

Is it possible to use OpenFileDialog in XNA 4.0 to get the file path? If not, what is the alternative? I'm using XNA 4.0 to create a graphic display (not a game) and I have a file that contains ...