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)

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
554 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
17k 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
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?
1
vote
1answer
546 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
448 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
419 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
339 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
343 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
908 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
401 views

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

The XBLIG submission check-list says to ensure that all important stuff critical to game-play be visible in the 'TitleSafeArea'. I've received a bug report during play-test of my game (Crazy Balloon ...
2
votes
1answer
572 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
1k 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
6k 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
3k 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
325 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
264 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
951 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
408 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
375 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
861 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
749 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
882 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
516 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
785 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
609 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 ...
5
votes
2answers
518 views

Efficiency of the SpriteBatch

Does SpriteBatch in XNA draw to the screen only when a sprite would appear on the screen? Say I have 5 identical sprites placed exactly on top of each other, is SpriteBatch able to determine that ...
3
votes
4answers
1k views

using odd number of sprites in multi-row spriteSheet?

Using XNA it's pretty easier to loop through a sprite sheet, I tell it how many rows and how many columns it has and I have a method that loops through the whole set. I usually use this method in my ...
2
votes
1answer
3k views

Custom effects on Model in XNA

If I have a Model that is drawn with a different effect occasionally, what is the typical approach to this? Models have effects stored in each of their meshes, and you seem to be forced to use those. ...
3
votes
2answers
3k views

XNA - Am I screwing up the LoadContent for Texture2D?

I've read forum threads and questions and I done just about everything. I need to know what am I screwing up here. Here's the code in the constructor. Content.RootDirectory = "GameStateContent"; ...
2
votes
1answer
1k views

Create shadow for SkinnedEffect model

I've followed a tutorial that uses the XNA 4 SkinnedEffect for my animation on that model . How can i also make a shadow for my SkinnedEffect model ? Thanks !
3
votes
1answer
4k views

Including Microsoft.XNA.Framework.Input.Touch in a project?

So after running through tutorials by both Microsoft and www.xnadevelopment.com I feel very confident in my ability to get to work on my first game using the XNA Framework. I've manipulated sprites, ...
3
votes
2answers
2k views

How do I import my first sprites?

Continuing from this question (new question - now unrelated) So I have a thorough background in programming already (algorithms, math, logic, graphing problems, etc.) however I've never attempted to ...
5
votes
3answers
4k views

When should a bullet texture be loaded in XNA?

I'm making a SpaceWar!-esque game using XNA. I want to limit my ships to 5 active bullets at any time. I have a Bullet DrawableGameComponent and a Ship DrawableGameComponent. My Ship has an array of 5 ...