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)

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
704 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
194 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
409 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 ...
1
vote
2answers
1k 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
318 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
242 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
331 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, ...
3
votes
1answer
987 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
901 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
527 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
986 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
401 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
520 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
855 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
733 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
430 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
327 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 *= ...
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 ...
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 ...
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 ...
1
vote
3answers
1k views

XNA: How to make particles face the camera but not alter the pitch

I'm using the particles sample from create.msdn.com/en-US/education/catalog/sample/particle_3d which by default, has all the particles look straight at the camera. I'm trying to modify it so that the ...
1
vote
1answer
471 views

XNA objects not occluding properly

I have got simple 1x1x1 cube model. I draw 3 of them. They are located at: 1,0,0 2,0,0 3,0,0 I draw them in the same order every time. When I move the camera and look at them from one end everything ...
4
votes
3answers
3k views

2D XNA Tile Based Lighting. Ideas and Methods [closed]

I am currently working on developing a 2D tile based game, similar to the game 'Terraria'. We have the base tile and chunk engine working and are now looking to implement lighting. Instead of the tile ...
1
vote
2answers
484 views

How can I orient a projectile along its flight path?

I have a projectile that is moving around the world (in a ballistics trajectory right now). I am currently keeping track of its position and velocity. I want to draw it oriented to its velocity, so ...
2
votes
2answers
329 views

Can XNA's content pipeline be used to load C# source files?

I am wondering if its possible to use the XNA Content Pipeline to load C# files? I'm working on a game and am currently writing a FSM. I would like to be able to load states from the content ...
0
votes
1answer
668 views

Some help understanding and modifying a 2D shader

I have a similar question as the one posed here, except that I don't wish to use a 1D Color Palette. I simply wish to have it display 1 color of my choosing (red, for example). I plan to use this ...
2
votes
1answer
662 views

How to create projection/view matrix for hole in the monitor effect

Lets say I have my XNA app window that is sized at 640 x 480 pixels. Now lets say I have a cube model with its poly's facing in to make a room. This cube is sized 640 units wide by 480 units high by ...
2
votes
1answer
1k views

Why is a fully transparent pixel still rendered?

I am trying to make a pixel shader that achieves an effect similar to this video http://www.youtube.com/watch?v=f1uZvurrhig&feature=related My basic idea is render the scene to a temp render ...
4
votes
1answer
450 views

3D models overlapping each other

I have a problem at the moment when I draw some models to teach me more about 3D game programming. The models at the moment overlaps each other from some angles witch makes sense since the game at the ...
8
votes
2answers
3k views

Eliminate delay between looping XNA songs?

I'm making a game with XNA and trying to get some background music to loop correctly. Because the file is an MP3 of about 30 seconds in length, I instantiated it as a Song. I want it to loop ...
2
votes
1answer
456 views

Xna GS 4 Animation Sample bone transforms not copying correctly

I have a person model that is animated and a suitcase model that is not. The person can pick up the suitcase and it should move to the location of the hand bone of the person model. Unfortunately the ...
2
votes
1answer
818 views

Inaccurate 3D model collision using XNA

I am creating a classic game in 3D that deals with asteriods and you have to shoot them and avoid being hit from them. I can generate the asteroids just fine and the ship can shoot bullets just fine. ...
0
votes
1answer
410 views

Rotate player to face direction it's moving in 3D space

I'm making a 3D game in XNA4.0. How do I rotate a model to face the direction that the user is pressing. I assume I need to set its look at to the direction being pressed, but can't figure out how to ...
2
votes
1answer
633 views

Collision with half of a semi-circle

I am trying to port a game I made using Flash/AS3, to the Windows Phone using C#/XNA 4.0. You can see it here: http://goo.gl/gzFiE In the flash version I used a pixel-perfect collision between ...
2
votes
1answer
528 views

Smooth Camera Rotation around 90 degrees

I'm developing a third person 3D platformer in XNA. My problem is when I try to rotate the camera around the player. I would like to rotate (and animate) the camera 90 degrees around the player. So ...