xna

Fastest Type Comparison?

The following event can possibly get called hundreds of times a frame. public bool OnCollision(Body body1, Body body2) { if(body2.Tag is Dog) ((Dog)body2.Tag).Bark(); } I understand that using "is" causes a cast to be made and then when i want to do something with it, cast it a second time. Is there a more efficient way to chec...

Managed Direct3D or XNA for non-game related 3D graphics programming?

Which is the preferred approach for doing .NET 3D graphics programming: Direct3D or XNA seem to be the current technologies, but which is best for non-game related programming? Also, has Managed Direct 3D been discontinued? XNA doesn't really seem to be appropriate for non-game development. ...

MouseMove event too slow for painting

I'm using C# WinForms to create a level builder for my XNA game. I have a tile grid that you can paint with a Pencil tool, like in MSPaint. The problem is that when you drag the mouse fast(ish) to paint a line tiles get skipped. I've tried using one approach i saw on Google saying to spawn a thread to do the painting, but that didn't se...

How do I project lines dynamically on to 3D terrain?

I'm working on a game in XNA for Xbox 360. The game has 3D terrain with a collection of static objects that are connected by a graph of links. I want to draw the links connecting the objects as lines projected on to the terrain. I also want to be able to change the colors etc. of links as players move their selection around, though I ...

XNA on graphics card.

How can I program graphics on a graphics card with XNA? (How do I move the workload onto the graphics card) ...

Xna Camera placing

Hi, Im trying to do a 3D viewer into Xna GameStudio. At this moment i know how to move the camera Vector position and the CameraView vector position, but my problem is about rotation (how to move the camera when i use the mouse). Like on 3d shooter games. Any idea, Url or code with some help? Thanks a lot. Kind Regards. Josema. ...

Moving objects inside arrays

Hello! I'm trying to make a Tetris-like game in XNA, and currently I'm thinking of what way would be the best to handle it. This is what I have so far: I have a class called Block, which has for example texture and color tint. Then I was planning on having everything in a double array, like: Block[,] blocks = new Block[10,20]; which...

Xna debugging

I use the console.out.writeline() to print the coordinates belonging to the different sprites in a XNA game. But after a few seconds, the game starts to go really slow, and almost stop. (When not writing to the console, there are no problems with performance). (The sprite's positions are written in every update method) Is there a way to...

Comparison between XNA and DirectX (C#)

In terms of PC development (excluding Xbox and Zune), What is the difference between XNA and C# DirectX? Does C# DirectX have a significant advantage over XNA (in terms of speed, royalties, etc)? How are the two compared to the speed unmanaged C++ DirectX? Where is the industry moving in terms of game programming? ...

Personal Project Planning

I want to design a 2D game idea with C#/XNA. Between school, project inexperience, limited resources, and other things that may cause me to bail on the project I am going to try to plan it out before I jump in: What are some key aspects you've noticed in a successful personal project? How did you (successfully) draw revenue the project...

Does XNA provide audio input (line in)?

Does XNA provide a means of audio input from the line-in? I looked at the MSDNA website but can't find anything on audio input. If it is indeed possible, a snippet of code or a tutorial website would be great. Edit: I need to do buffered reads from the audio-line in. I'm not so much interested in the implementation but rather if it has ...

WPF, Silverlight or XNA: Choosing a platform for game development

Which .Net technology is best suitable for which kind of game? What the criteria for choosing between WPF, Silverlight or XNA? ...

How to use an enumeration in an XNA ContentReader?

For instance, I was thinking of replacing this: var.StringAttribute = input.ReadString(); With something like this: var.EnumAttribute = input.ReadExternalReference<EnumName>(); However this doesn't work quite right. And ideas on how to get input to read a custom enumeration? ...

Serializing an array of integers using XmlSerializer

I'm encountering a problem while trying to serialize a multi-dimensioned array of integers via XmlSerializer for an XNA project I'm working on. I'm able to serialize all of my other data (booleans, strings, even Colors, etc) without a hitch. I've also seen plenty of people claim that XmlSerializer will natively handle (single-dimension...

Declare, Instantiate, and Use a Delegate in C# XNA

I am trying to do as the title suggests, however I am getting confused. I get the idea of how the delegate is supposed to work, but Visual Studio is telling me i'm wrong. Microsoft documentation that says how to do this contains a convoluted example that uses a bookstore program that contains templates and a bunch of logic code that mak...

Algorithm for finding the difference between two arrays

Given two arrays, is there a fast algorithm for finding all elements in the two that are different? For example, consider two arrays of Keys (as in keyboard keys) structs. One represents the currently depressed keys, and the other represents the keys depressed in the last timestep. Keys[] oldKeys = LastKeyboardState.GetPressedKeys(); Ke...

How to calculate bounce angle?

I played around with it for a while, but i simply cant figure it out. I made a tank that fires missiles, and when the missiles hit the walls, i want them to bounce off, but i want them to bounce off to the right angle. Right now i havent got any obstacles, the missiles just bounce off when they get outside the viewportRectangle i made....

XNA: Which single book should a beginner start with?

I have tried searching for a similar post on SO, but apparently only found posts that suggest following online tutorials, and I'm ok with that. But I'm big on reading, and prefer having a book in my hand, even for referential purposes. Searching on amazon returns about 4 pages of books related to XNA Game Programming. I am very new to...

XNA - Embed DirectX control in a form?

I want to render DirectX (well, XNA) stuff to a system.windows.forms control rather than the whole window (so I can pair it with buttons and stuff). Is this possible? Which control would I use? How would I do it? I've searched the documentation but I don't know which terms I'm meant to use! ...

XNA, direct X , OpenGL

Hi, I have been wanting to give game programming ago for a long while and never got round to it, and i have finally decided to give it ago. I have decided to try and create a simple to 2D platform game. I have had a quick play with XNA and I do like it. What i am looking for tho is a comparison between XNA,directx,OpenGL. mainly the stre...