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)

6
votes
3answers
543 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 ...
1
vote
0answers
70 views

Using obj file in an XNA game [closed]

Sorry if this is a bit novice but I am far more into engineering than game development but I just want to make a small 3D game for fun with XNA (well actually MonoGame). The thing is that I don't have ...
-1
votes
1answer
67 views

Why doesn't my XNA model render at all? [closed]

I am trying to draw a 3D Model in XNA 4.0, but it doesn't show up. I think I made it correctly, but maybe not. My code follows: Here is the LoadContent and Draw method of my Main class. Spaceship is ...
35
votes
8answers
15k 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 ...
0
votes
1answer
51 views

Height map renders upside down and/or backwards

After following the tutorial found here:http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series1/VertexBuffer_and_IndexBuffer.php The code at the bottom of this page is what I am using. (I have ...
1
vote
2answers
92 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 ...
5
votes
1answer
198 views

How can I draw a perspective-correct quad?

I'm trying to draw a quad in 2D (in SharpDX, but that is basically XNA). But texture correction is not working, and I'm getting only an affine textured quad. I'm using BasicEffect to render it. ...
0
votes
1answer
78 views

XNA DepthBias increases performance even when EarlyZ is turned off. Why?

My 3d scene consists of three main polygons: The first and the second polygons overlap each other (have the same World matrix and use the same geometry), the third one is perpendicular to the first ...
0
votes
3answers
135 views

Why I am I told “Color0 is missing” when I run the following code?

In the code below, I want to draw a box on my screen. But when I run it, there is an error message: The current vertex declaration does not include all the elements required by the current ...
1
vote
1answer
334 views

Unable to create suitable graphics device?

I've been following the Eye of the Dragon tutorial, which is basicly a guide to making a 2D RPG game, obviously. I recently finished the tutorial about making pop up screens in the menu and changed ...
2
votes
1answer
103 views

How do I check if a surface is sloping?

I'm implementing gravity over a 3D terrain and I'm struggling with how to check if surface "under your feet" is flat or sloping. I read some tutorials but gravity is always considered along a single ...
3
votes
1answer
872 views

Deferred rendering with VSM - Scaling light depth loses moments

I'm calculating my shadow term using a VSM method. This works correctly when using forward rendered lights but fails with deferred lights. // Shadow term (1 = no shadow) float shadow = 1; // [Light ...
1
vote
1answer
230 views

World to Pixel Transformation

My objects have a location in world coordinates (basically 1.0f is a meter). If I simply draw my objects using their world coordinates, each meter will correspond to a pixel. Obviously that's not what ...
43
votes
3answers
9k 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?
1
vote
2answers
1k views

Load Texture From Image Content In Runtime

Basically I wrote a world editor for a game I'm working on. Looking ahead, I was brainstorming ways to save the created world including the tile-sets (this game will rely on a tile engine). I was ...
0
votes
2answers
280 views

Add a “fake” Loading Screen

I'm working on a 2D game for WPF8 using XNA 4.0. Everything goes great, but it's too fast. I was just wondering, what could I do between the end of the game and the score screen, and before the game ...
3
votes
1answer
506 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 ...
4
votes
1answer
956 views

Compiling a Monogame Game into a single .exe

Is it possible to compile a monogame game into a single .exe? I know if you go in the debug or release bin, there is in fact a .exe your game, except you move this .exe's file location or try to run ...
0
votes
1answer
110 views

Where does XNA 4.0 takes memory from to perform operations?

I found this question which talks around the question I'm interested in. In particular I focused on the line where the guys says that GraphicsDevice object is literally a representation of the ...
6
votes
1answer
138 views

How should I attenuate sound in a 2D game where you can zoom in and out?

In my 2D game, I have some ambient sounds like the noise of a waterfall or the humming of a generator. However, it is not practical to play these sound all the time at full volume as in a large level ...
9
votes
1answer
575 views

Portable buffered keyboard input for XNA / MonoGame?

As a preliminary solution, I am currently using the Nuclex framework in an C#/XNA game project for buffered keyboard input. Sadly, nuclex relies on SlimDX.Directinput.dll and therefore to my knowledge ...
8
votes
2answers
365 views

What are some ways to texture map a terrain?

I'm working with XNA on a 3D Game, and I'm trying to have a proper and nice environnement. I actually followed a tutorial to create a terrain from a heightmap. To texture it, I just apply a grass ...
0
votes
1answer
200 views

Rope Colliding with a Rectangle

I have my rope, and I have my rectangles. The rope is similar to the implementation found here: http://nehe.gamedev.net/tutorial/rope_physics/17006/ Now, I want to make the rope properly collide ...
0
votes
0answers
26 views

Skip the first RenderTarget when writing to MRT with Opaque blending

I am writing to three rendertargets and whant to know how to tell a GPU not to write to the first RT. When you write a shader you can simply output less data than you have RTs (like output a single ...
1
vote
2answers
368 views

SpriteFont Exception, no such character?

I have such spriteFont: <?xml version="1.0" encoding="utf-8"?> <!-- This file contains an xml description of a font, and will be read by the XNA Framework Content Pipeline. Follow the ...
1
vote
1answer
185 views

Get screen bounds of 3D object

I'm trying to draw a 2D plane that has minimum dimensions to contain a 3D model (a sphere). How do I calculate the minimum size and position of the rectangle to completely cover a 3D model on screen?
4
votes
2answers
114 views

XNA Transparency depending on drawing order?

I am drawing two 3D objects, both of them can fade from opaque to transparent independently, and they can intersect between them (so you cannot say when one of them is before the other one). Look at ...
2
votes
2answers
1k views

XNA 2D line-of-sight check

I'm working on a top-down shooter in XNA, and I need to implement line-of-sight checking. I've come up with a solution that seems to work, but I get the nagging feeling that it won't be efficient ...
0
votes
0answers
79 views

Avoiding lag when rendering Texture2D for first time

I have found a similar question here, but it is about playing sounds. I am using 2048 x 2048 textures for sprite sheets and every time I call spriteBatch.Draw using a sheet for the first time in game ...
2
votes
3answers
702 views

Creating Rectangle-based buttons with OnClick events

As the title implies, I want a Button class with an OnClick event handler. It should fire off connected events when it is clicked. This is as far as I've made it: public class Button { public ...
0
votes
1answer
102 views

Changing enum in a different class for screen

I'm trying to make a start menu for my game and my code uses Enum's to moniter the screen state. Now i want to change the screenstate declared in the main class, in my Background class Screen screen ...
0
votes
1answer
132 views

Obtain rectangle indicating 2D world space camera can see

I have a 2D tile based game in XNA, with a moveable camera that can scroll around and zoom. I'm trying to obtain a rectangle which indicates the area, in world space, that my camera is looking at, so ...
4
votes
4answers
304 views

The physics equation for a perpetual seesaw

I am trying to create a game that involves two or more people jumping on a seesaw and propelling each other in the air. I need help with the physics equations Assume no friction and no air ...
1
vote
1answer
230 views

Best way to load texture2d tiles in xna?

I am making a test xna game as a learning exercise and I have a small question about using 2d textures. Basically the game is a grid of different 'tiles' which are taken from a text map file. I ...
-1
votes
1answer
415 views

How do I make a health bar that drains when the player takes damage? C#/XNA

I've drawn a Health Bar before and had it drain/refill on a button press using if statements and rectangles. First I loaded the image, then I set a new rectangle to be equal to the image's height and ...
1
vote
1answer
169 views

XNA - Where should I start playing a song?

I am just wondering where is the best place to start playing the background song for a game. In the loadContent() method, Draw(), or Update() methods or when I initialize it? I am trying to make it ...
0
votes
0answers
41 views

I am getting zero in my int x() when using Mouse.getstate().X?

Ok I have a Function int x(), which is used in new Rectangle(x(),a,a,a); in DrawMethod in XNA but when I use it I get x() = 0 as as the answer.Here is my CODE: int x() { int px ...
1
vote
1answer
192 views

Complex Models using bounding boxes in xna 4

I'm new to XNA, and have just started looking into collision detection. I've managed to get a bounding sphere around my first person camera object and i want to check the collision between that and ...
0
votes
1answer
222 views

XNA Arcball and moving model - the model is altered instead of the camera

I'm trying to implement an arcball type camera, I've got all controls working very nicely. I can rotate the X/Y axis with my mouse and zoom in and out with the Z/X keys. The problem is, that the ...
1
vote
1answer
354 views

Parallax scrolling with 2D camera [duplicate]

I'm developing a 2D Platform game, I have a 2D camera, some backgrounds, and everything is working good. Now I want to implement parallax scrolling to give the illusion of depth in my game, but i ...
0
votes
0answers
272 views

XNA 4.0 - stretch full screen window?

I have an issue with resolution in XNA 4.0. I'm running fullscreen. The game runs standard at 1920x1080, and can be scaled down to 1280x720. The resolutions are both 16:9 (1920/1,5 = 1280, 1080/1,5 ...
6
votes
4answers
3k views

How do you manage your game resources in XNA?

In the past I have used Content.Load<type>("filename"); all over the place. This quickly becomes a nightmare to manage and worse you start having multiple copies of the same asset loaded in ...
2
votes
1answer
203 views

Resize texture in code

I need to change texture size from for example 800x600 to 80x60. I have two ideas of how to do that, but i have problems with both approaches. 1) changre render target then draw and save resized. the ...
0
votes
1answer
174 views

render sprites with a transparent background (XNA)

For my game I want to make a map of the world. Per country I made a file with the border of the country and the rest of background is transparent. This way all my files have the same width and height. ...
0
votes
0answers
49 views

What's the function to Stretch a sprite?

My goal is to find the function to stretch a sprite like my example below, and then get it to animate during a certain time. It is like an interpolation, where the starting point is the original ...
-1
votes
1answer
282 views

XNA - 2D Rotation of an object to a selected direction

I'm trying to figure out the best way of rotating an object towards the directional input of the user. I'm attempting to mimic making turns on ice skates. For instance, if the player is moving right ...
1
vote
1answer
108 views

What does Rectangle.Intersect means/do?

Ok I have two rectangles one is the ball and other is the paddle. 1. if(ball.rectangle.intersects(paddle.rectangle)) y = -Math.Abs(y); and 2. ...
2
votes
1answer
243 views

How to use elapsed game time for timing

I want that my ship shoots beam after every 2 seconds. How do I make that happen? and also I want that after 50 shots I want to give 10 seconds to reload the gun. I know both of my problems can be ...
1
vote
1answer
55 views

Shared Texture2D in XNA

I am trying to define texture2d objects as shared. The reason of why I am trying to do is, I made an xna user control and my project loads unlimited (as much as the user wants) my XNA User Control. ...
2
votes
0answers
175 views

Monogame working with Krypton

I am trying to make a simple 2D game engine using Monogame and the Krypton 2.0 lighting engine. So far I have succeeded in rendering a light but I am unable to generate any shadows from any hull's. ...