xna

What are the performance implications of passing structs in an array by reference in C#

I'm working on a piece of code in C# / XNA where I'm highly concerned with performance. Part of this is passing several structs that are stored in arrays to various functions. Before this is asked, these are indeed supposed to be structs, not classes. They're essentially value types, and they need to (basically) live on the stack. Th...

Translating screen coordinates to sprite coordinates in XNA

I have a sprite object in XNA. It has a size, position and rotation. How to translate a point from the screen coordinates to the sprite coordinates ? Thanks, SW ...

How to drag a Farseer body with the mouse, without springiness ?

Hello everyone. I am using Farseer and XNA. I'm trying to drag an body with the mouse, but I don't want a spring behavior, like in the demos.I want the object to follow the mouse very closely and without springiness, but still be able to rotate. I tried using another invisible body attached with a RevoluteJoint and moving that, but that...

How to resize a Farseer body, along with it's joints and connected bodies ?

I'm using FarSeer and XNA. Is there an easy way to resize or scale a FarSeer body ? Thanks. ...

C# Marshal class available on Xbox?

does anyone know if the Marshal class is available on the xbox360, specifically the AllocHGlobal method. Unfortunately I don't have access to an xbox right now, otherwise I would test it myself! Basically I want to be able to allocate unmanaged memory myself, ie. this piece of code should work: IntPtr ptr = Marshal.AllocHGlobal(10000)...

Optimize color manipulation on XNA

I am profiling my simple 2D XNA game. I found that 4% of entire running time is taken by simple operarion of adding together two Colors , one of them multiplied first by float. I need to call this method rogulthy 2000 times per frame (for each tile on map), which gave me 120000 times per second for XNA's 60 fps. Even minimal boosting of...

Multithreading in XNA game

Where can I use multithreading in a simple 2D XNA game? Any suggestions would be appreciated ...

Using 3D Studio Max DirectX shader in XNA problem

UPDATE 2: It now appears this is more of a modelling issue than a programming one. Whoops. I'm new to XNA development, and despite my C# experience, I've been stuck at one spot for going on two days now. The situation: I've created a model in 3D Studio Max 2010 which uses two materials, both are of type DirectX Shader. The model export...

How to load a video from file in XNA ? (PC Only)

I want to show a video texture in my application with the video file being supplied by the user. Texture2d has a FromFile method, but Video doesn't. Any ideas? (I only need PC support) Thanks. ...

Unable to cast a class implementing and interface to this interface in IronPython and C#

I'm trying to write a scripting engine to my C#/XNA game using IronPython and came across a problem. public class Game1 : Game, IGFXEnabledGame { //stuff } In the Game1 constructor I do necessary initialization for script and then run it to create the Camera object. I try to move the following hard-coded Camera initialization to ...

How to use PhysX™ Candy Wrapper in XNA

Hello all I need some basic tutorial or guide on how to use "PhysX™ Candy Wrapper". On their website I couldn't find anything useful what so ever. It has been a long time since I touched 3D programming and I would like to start learning the new stuff that is currently going on. I would appreciate your help. Thank you. ...

How to multiply two sprites in SpriteBatch Draw XNA (2D)

I am writing simple hex engine for action-rpg in XNA 3.1. I want to light ground near hero and torches just as they were lighted in Diablo II. I though the best way to do so was to calculate field-of-view, hide any tiles and their's content that player can't see and draw special "Light" texture on top of any light source: Texture that is...

Jint + XNA (C#)

Hi :) Would it be possible use jint to manipulate a 3D environment created using XNA (C#), and add functionality to this envrionemnt (again using jint)? Thanks Q ...

How to use jint with XNA to build a game engine?

Hi. I want to create a game engine in XNA that has scripting abilities (Jint). How do I go about doing this? (General idea of the direction to proceed - not necessarrily deatils). Thanks Q ...

How to create Mortal Kombat game in c#?

Where do I start for this game? I do have xna studio. But I do not know the flow to create such a good game. EDIT:: I do have a good hands on c#/asp.net development. I am totally new for game development. Ok, i appreciate your answers/comments, but can you tell me which studio is the best for c# game development, or where do i start ...

Camera flip problem

I'm programming a game in C# using the XNA3.1 engine. However I'm having a small issue with my camera, basically my camera tends to "flip" when it rotates more than 180 degrees on its roll (when the camera reaches 180 degrees, it seems to flip back to 0 degrees). The code for obtaining the view matrix is as follows: Globals.g_GameProces...

ClickOnce & XNA issues

I essentially have a blank XNA project built using the XNA 3.1 wizard, i'm testing whether a game i make can be "installed" on another computer without having to make them install everything manually to make it work. The only additional code in the game is: Components.Add(new GamerServicesComponent(this)); After going through the Cli...

Worms style destructible terrain

Hi, I want to prototype an idea for a game I have. The idea for this game is that the player will dig through the ground, creating tunnels and finding treasure. I'm looking to create 'worms style' terrain, with collision detection for the player wandering and jumping around the tunnels. Examples of this type of dynamic terrain can be se...

XNA rendering on GDI HDC

I am integrating with an application that uses plugins. I have my own plugin that is provided an HDC to draw on, this works fine using C# Graphics gfx = Graphics.FromHdc(hdc); I can then draw using GDI without issue. I would like to start experimenting with XNA, I've loaded a few sample projects and had a look through the code. It...

XNA mouse coords vs objects problem

Hi all, I'm having a problem with the xna framework, I have a stripped down version of my code here to demonstrate. When the mouse is clicked an object is created at that mouse click point and the object is displayed via it's own draw method. What happens is that the first object is created at the correct position (current mouse coords...