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)

1
vote
2answers
353 views

XNA 4.0: Animating a moving 2D sprite (not via user input)

I see a lot of tutorials explaining how to do 2D Sprite Animation with sprite sheets, based on the user's input (i.e. Move Left, Move Right ) etc.. etc.. I have already incorporated an ...
12
votes
2answers
863 views

XNA: Questions regarding games architecture

So I've finally got around to playing around with XNA and have been toying around with making a 2D game (I have a bunch of art assets from a friend who developed it on iOS) A lot of things seem to be ...
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 ...
8
votes
3answers
6k views

How do I make objects move along a path?

I'm trying to get something like the below image. As you can see, there's a highway and inside of it, there'll be some objects moving (millisecond). I guess the street behavior is like a pipeline. ...
1
vote
3answers
1k views

XNA Entity Component Design: Lost on how to include Sprite Animation

I've been reading about Entity Component design and thought it's pretty neat. I've been trying to write a quick 2D engine in XNA. I think I've laid the proper groundwork for registering and updating ...
6
votes
3answers
2k views

XNA 4.0: 2D Camera Y and X are going in wrong direction

I asked this question on stackoverflow but assumed this might be a better area to ask it as well for a more informed answer. My problem is that I am trying to create a camera class and have it so ...
7
votes
2answers
5k views

How do I enable higher FPS in XNA 4.0?

I created a FpsCounter DrawableGameComponent (linked to code, it's longish). It works great: It displays 60.0 fps normally. If I artificially slow down the game loop, it drops. My 'game' at the ...
2
votes
1answer
802 views

How to track position on a map vs position on screen with XNA 4.0?

I'm working on my first XNA 2D game (overhead view), and I'm pondering how to manage the difference in position on screen vs. the position of a sprite on a global map. The solution I'm currently ...
0
votes
1answer
2k views

How does one do alpha transparency testing in XNA 4.0?

I've read a lot of tutorials, but it just doesn't seem to work. Here's the code as suggested by a tutorial, using the built-in AlphaTestEffect class: Matrix projection = ...
3
votes
2answers
562 views

Problem with bounding box in model space and intersection with ray

I have a bounding box in model space and I want to intersect it with a ray. I have tried to transform the ray like this. Rotating and scaling works well, but transition does not. Here is my code: ...
35
votes
8answers
19k 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 ...
2
votes
2answers
2k 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?
1
vote
1answer
551 views

with XNA 4.0, How can I combine 2 models to make one?

I want to animate Model1 (an aicraft) and I want an object, Model2 (a sphere), to follow it in translation and rotation, as it is a part of this aircraft. With the following code (I use one or two ...
3
votes
1answer
458 views

Problems making my basketball bounce around horizontally

This is probably a very easy question, but I can't seem to understand why it's not working. I want the basketball to bounce horizontally when it touches the borders on the right and left, but when it ...
2
votes
2answers
2k views

How do I get access to the SpriteBatch service in my Sprite class using XNA?

I have the following Sprite class (leaving out everything that doesn't pertain to my question): public class Sprite { public Texture2D Texture { get; set; } public Vector2 Position { get; ...
6
votes
2answers
3k views

How do I access variables in the Game1 class from another class in XNA?

I'm trying to write a SpriteManager class in XNA, but I need access to the Game variables. For example, the Game.Content property would be very helpful in loading textures, and ...
2
votes
0answers
425 views

Rotating camera changes directional light depth map, and changes PCSS penumbras

I am implementing PCSS and I am using a directional light. The directional light volume is clamped to the camera frustum (as is typical with directional lights). So when the camera rotates, the ...
3
votes
1answer
340 views

Problem drawing text in a for loop

for (int i = -5; i < 5; i++) { Rectangle screenRectangle = new Rectangle(0, 0, screenWidth, screenHeight); spriteBatch.Draw(foregroundTexture, screenRectangle, Color.White); Rectangle ...
4
votes
1answer
347 views

XNA 4.0 keeping fonts/sprites without the use of a content project

Note: The actual title of my question does not really reflect my problem but is actually one of the possible solutions to my problem. I couldn't find a proper way to express my question so feel free ...
1
vote
2answers
1k views

in XNA 4.0, How to get the matrix or Vector3 of a model?

I'm trying, for many days, to get the Matrix or the Vector3 of my 3D model, I don't want to use the World matrix because I need first to idenfy the axes of my object for animation (= rotation of a ...
1
vote
2answers
913 views

Using a shader messes up my alpha in XNA

I'm making a 2D game that ends up being too dark on some laptops, so I figured I'd use a shader so people could brighten it up if need be. Unfortunately, once I got it in there nothing would fade in ...
7
votes
4answers
410 views

How can I test different TV display types for my XBLIG game?

The XBLIG submission check-list asks to ensure all gameplay-critical graphics be visible in the 'TitleSafeArea'. I've received a bug report during play-testing that says parts of my scrolling 2D map ...
2
votes
1answer
579 views

Triangle accuracy picking for animated models in XNA

I can do picking with triangle-accuracy for non-animated models, but I also have animated models in my game. How do I do picking on animated models? I use code based on this project for animation. ...
2
votes
1answer
2k views

Multiplayer XNA without a LIVE account? (PC)

I decided it was time to stick in a bit of multiplayer into my game, but came across my first hurdle when i quickly downloaded an example from the XNA website. It prompted me with a login to live. ...
8
votes
3answers
3k views

Load all content from folder

I want to ask, is there way to load in xna all content from folder ? For example in my content I have: Images/hero Images/car Images/tree I want to make something like this ...
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 ...
1
vote
1answer
1k views

What is wrong with my vertex declaration?

What is wrong with my vertex declaration below? I am using it with instancing. After adding TextureInformation to it, it renders weird and has an epileptical seizure. public struct VertexInstance ...
2
votes
2answers
2k views

Alpha in model XNA

OK been googling nonstop for ages... My problem is, i need transparent models in my game. After a lot of annoying fiddling around with my code, i changed the blendstate to alphablend. This allowed ...
7
votes
2answers
2k views

Learning XNA 3.1 Vs XNA 4.0

I am starting out learning XNA and its going smoothly. However I wonder if I am shooting myself in the foot by learning 3.1 not 4.0? I am also aware Microsoft obviously has a conflict on interest in ...
10
votes
1answer
7k views

Ultimate beginner's tutorial to 3d game dev using XNA Framework?

I'm looking for a tutorial that starts at square 1 for game development and moves up through intermediate/expert levels of 3D game development. I really want to get into 3D game dev and I've been ...
8
votes
4answers
4k views

Should I use Events in a XNA Game?

I created a button class which draw a button on the screen. When I click on it, I want to see something happening. In WinForm, I would simply use the event OnClick of the button. What about XNA? ...
1
vote
2answers
2k views

Rotate the camera around the model in XNA?

How can I rotate my view around a model? My model has a rotation. If this rotation changed, my view should also change. The camera should be behind the model everytime. Thank you very much!
3
votes
1answer
2k views

Reusing a render target to create multiple Texture2D's (XNA)

i want to be able to loop through a hole bunch of textures, and render them on an object. I then want the rendered image to be placed onto a texture2D. The point? well hopefully i will end up with an ...
7
votes
3answers
4k views

A cool way of doing Z-index for XNA components?

I am trying to render some elements in my game. First, I render the textures (the textures of the textboxes themselves etc). Then I render the primitives (borders around controls etc). Then I render ...
2
votes
1answer
326 views

XNA Framework and looking around relative to the world instead of camera?

So I've been toying around with creating a game in the XNA framework. A great place to start is simply being able to move and walk around. I kinda have looking around... I start off with the camera ...
3
votes
1answer
265 views

Write to one channel of R16G16 texture on Xbox

I was going to draw my shadow map into one channel of a 16 bit texture and then draw a different shadow map into another channel of the same texture. I realized that this might not be possible to do ...
2
votes
1answer
246 views

JiglibX addition to existing project questions

Got a very simple existing project, that basically contains a lot of cubes. Now I am wanting to add a physics system to it and JiglibX seemed like the simplest one with some tutorials out there. My ...
4
votes
2answers
973 views

Execute code at specific intervals, only once?

I am having an issue with XNA, where I want to execute some code in my Update method, but only at a given interval, and only once. I would like to avoid booleans to check if I've already called it ...
1
vote
2answers
1k views

How to make animated 2D texture on 3D cube with XNA 4

I'm looking for how to make 3D gauge on Windows Phone 7, that's mean a 3D object (a watch for example) with a basic 2D texture (= Numbers of my watch) and a rotating 2D texture (=neddle of my watch). ...
3
votes
2answers
409 views

Render only some of graphics?

In XNA I am building my own textbox, and listbox. For the textbox, I want it to render all text it can, and then cut off at the end of the textbox. But I don't want it to cut whole letters. I want it ...
2
votes
2answers
2k views

Fastest way to get all adjacent tiles?

What is the fastest way to get all adjacent tiles in a two-dimensional array of tiles, converted into a single-dimensional array? If you don't know the answer, then the fastest way to do it in a ...
2
votes
2answers
1k views

When applying Bloom postprocess, error: “XNA…requires TextureFilter to be Point when using texture format Single.”

I have an almost unmodified copy of the bloom sample in my project. I pass it a texture to apply the bloom post process on. The only modification is that, instead of calling BeginDraw() (to set a ...
3
votes
1answer
377 views

Skin Editing/Overlaying bullet holes

You see, especially in FPS games, when a bullet hits a wall or a character, etc. You end up with the bullet hole. Is this usually done with the actual skin temporarily changing, or just an overlay of ...
8
votes
4answers
872 views

Which is better, one big level model or multiple smaller level models?

I am writing a game in XNA 4 and I want to have something like a corridor. Do you think that is better to use one big and solid model, or to use multiple small parts (window, stairs, door...)?
4
votes
1answer
764 views

Drawing a texture of arbitrary size in XNA

I wish to know if there is a way to load a texture which is not in powers of 2, for example 100 X 56 in dimension, in XNA 4.0 and draw it using VertexPositionColorTexture.
3
votes
1answer
894 views

Configuration management in XNA

I come from a .net web background so I am accustomed to using xml .config files. What is the XNA equivalent? It seems to me that using the same practice of a xml config leaves your game open to easy ...
2
votes
1answer
518 views

Model in Blender GLSL to XNA HLSL

Is it possible to make model in Blender, with enabled GLSL, add multiple textures, etc, and then just load it in XNA, where's own HLSL? Will it work?
4
votes
3answers
1k views

XNA VertexBuffer.SetData performance suggestions

I have a 3d world in a grid layout where each grid cell contains its separate vertex and index buffer for the mesh/terrain of that cell. When the player moves outside the boundaries of his cell, i ...
3
votes
1answer
791 views

XNA Video Playback on XBOX “Invalid operation exception”

I am able to play a video in windows in my project, but the same code fails on the XBOX at the _player.Play(_logo) line. The error message is: "An unhandled exception of type ...
6
votes
2answers
616 views

XNA Sprite mouse selection with layered/overlapping sprites

If I use mouse coordinates to select a sprite does XNA provide a built in way to return the top-most sprite on the screen at a coordinate? I am trying to highlight the selected sprite, but when ...