C# is a multiparadigm, managed, garbage-collected, object-oriented programming language created by Microsoft in conjunction with the .NET platform.

learn more… | top users | synonyms

2
votes
2answers
900 views

Problems using easing equations in C# XNA

I'm having some trouble using the easing equations suggested by Robert Penner for ActionScript (http://www.robertpenner.com/easing/, and a Flash demo here) in my C# XNA game. Firstly, what is the ...
0
votes
1answer
1k views

XNA - Error while rendering a texture to a 2D render target via SpriteBatch

I've got this simple code that uses SpriteBatch to draw a texture onto a RenderTarget2D: private void drawScene(GameTime g) { GraphicsDevice.Clear(skyColor); ...
0
votes
1answer
277 views

Error X3650 when compiling shader in XNA

I'm attempting to convert the XBDEV.NET Mosaic Shader for use in my XNA project and having trouble. The compiler errors out because of the half globals. At first I tried replacing the globals and ...
11
votes
4answers
3k views

Calculate random points (pixel) within a circle (image)

I have an image that contains a circles at a specific location, and of a specific diameter. What I need to do is to be able to calculate random points within the circle, and then manipulate the pixels ...
1
vote
2answers
342 views

What is the most efficient way to convert to binary and back in C#?

I'm trying to write a general purpose socket server for a game I'm working on. I know I could very well use already built servers like SmartFox and Photon, but I wan't to go through the pain of ...
0
votes
3answers
509 views

Xna Equivalent of Viewport.Unproject in a draw call as a matrix transformation

I am making a 2D sidescroller and I would like to draw my sprite to world space instead of client space so I do not have to lock it to the center of the screen and when the camera stops the sprite ...
2
votes
3answers
1k views

How to make a ball fall faster on a ramp?

So, I'm making a ball game. Where you pick up the ball, drop it on a ramp, and it flies off in to blocks. The only problem right now is it falls at a normal speed, then lightly falls off, not nearly ...
3
votes
2answers
2k views

Using XNA's XML content pipeline to read arrays of objects with different subtypes

Using XNA's XML content importer, is it possible to read in an array of objects with different subtypes? For instance, assume these are my class definitions: public abstract class MyBaseClass { ...
3
votes
2answers
760 views

AABB > AABB collision response?

I'm really confused about how to fix this in 3d? I want it so that I can slide along cubes but without getting caught if there's 2 adjacent cubes. I've gotten it so that I can do x collision, with ...
0
votes
1answer
772 views

E_FAIL: An undetermined error occurred (-2147467259) when loading a cube texture

I'm trying to implement a skybox into my engine, and I'm having some trouble loading the image as a cube map. Everything works (but it doesn't look right) if I don't load using an ...
2
votes
1answer
580 views

Getting a sphere to roll down a .FBX object Unity3D/C#

I'm working on a little ramp and ball game in Unity, I modeled the ramp outside Unity and exported it to a .FBX file, then I imported the ramp in to Unity. I set up the ball and ramp, both have ...
1
vote
1answer
1k views

Circle to Circle collision, checking each circle against all others

I'm currently coding a little circle to circle collision demo but I've got a little stuck. I think I currently have the code to detect collision but I'm not sure how to loop through my list of circles ...
2
votes
5answers
2k views

Xna Loading Screens

I'm making a 2D XNA game. I'd like to implement loading screens when stuff has to load for a while. Like when I login to an account, connect to the server, and generate worlds. I'm pretty sure it ...
4
votes
1answer
929 views

2D Camera Acceleration/Lag

I have a nice camera set up for my 2D xna game. Im wondering how I should make the camera have 'acceleration' or 'lag' so it smoothly follows the player, instead of 'exactly' like mine does now. Im ...
1
vote
1answer
140 views

Finding furthermost point in game world

I am attempting to find the furthermost point in my game world given the player's current location and a normalized direction vector in screen space. My current algorithm is: convert player world ...
1
vote
5answers
4k views

How to pause and resume a game in XNA using the same key?

I'm attempting to implement a really simple game state system, this is my first game - trying to make a Tetris clone. I'd consider myself a novice programmer at best. I've been testing it out by ...
3
votes
1answer
807 views

Where can I find a free SDK for C#? [closed]

I need a free and recent SDK for use with C#. I will work first in 2D games with visual effects. Thanks for now. Can anyone help me?
7
votes
1answer
884 views

Problem with Update(GameTime) Methods and Pause implementation

I have the pause function implemented and it works correctly in that it dims the player screen and stops updating the gameplay. The problem is that GameTime continues to increase while it is paused, ...
6
votes
1answer
871 views

Questions about XNA [closed]

I've read tons of different threads about XNA, but I still have some questions. First of all: I have 2 years of experience programming and C# is my main language, so XNA would fit perfectly for me, ...
1
vote
2answers
217 views

When should I be implementing XML documents

I often struggle with the question of when to use XML docs. Does anyone have a good rule of thumb when it comes to deciding to use them or deciding not to use them. At the moment I am working on a ...
4
votes
1answer
1k views

Minecraft style XNA game collision?

I've been trying to get this working for ages now, I can detect if there's a solid block at any place on the map and I can check how far something is inside of it, but I don't understand how to fix ...
4
votes
1answer
590 views

Per-vertex position/normal and per-index texture coordinate

In my game, I have a mesh with a vertex buffer and index buffer up and running. The vertex buffer stores a Vector3 for the position and a Vector2 for the UV coordinate for each vertex. The index ...
5
votes
1answer
974 views

Skeletal Animation - Automatically apply skeleton to model

Looking at websites such as mixamo.com or some game's development systems such as the animation editor for Overgrowth (http://www.youtube.com/watch?v=-RpqbC5-Z0E), i see that the skeleton in these ...
3
votes
2answers
600 views

Passing an objects rotation down through its children

In my topdown 2d game you have a player with a sword, like an old Zelda game. The sword is a seperate entity, and its collision box "rotates" around the player like an orbit, but always follows the ...
10
votes
1answer
2k views

Screen space to world space

I am writing a 2D game where my game world has x axis running left to right, y axis running top to bottom, and z axis out of the screen: Whilst my game world is top-down, the game is rendered on a ...
1
vote
2answers
954 views

XNA 4.0 Point Vertex Rendering

I have a buffer of about 134 million particles and a very powerful computer to render them smoothly, but I am getting an error when trying to render them as primitive lines. It says that I cannot ...
1
vote
1answer
1k views

Why doesn't my texture display with this GLSL shader?

I am trying to display a DXT1 compressed texture on a quad using a VBO and shaders, but I have been unable to get it working. All I get is a black square. I know my texture is uploaded properly ...
1
vote
2answers
2k views

Switching songs - MediaPlayer lags the game

When the player encounters a boss in the game I'm working on, I want to have the music change. It seems simple enough with the MediaPlayer class to fade out the current song, switch to another, and ...
2
votes
1answer
625 views

Loading SpriteFont through a different class than Game.cs

I am trying to load up a single SpriteFont to print some debug information. In our current game, we load up both Textures and Music through a ResourceManager. They are both loaded with a filestream, ...
2
votes
2answers
3k views

Creating natural environments that can run on lower end computers in Unity3D/C#

So, I'm starting work on a project soon that will require me to create realistic environments that can preferably run on PC's besides high quality ones. The goal is to get as real an environment as ...
5
votes
3answers
278 views

Accessing managers from game entities/components

I'm designing an entity-component engine in C# right now, and all components need to have access to the global event manager, which sends off inter-entity events (every entity also has a local event ...
1
vote
0answers
130 views

C# Collision test of a ship and asteriod, angle confusion

We are trying to to do a collision detection for the ship and asteroid. If success than it should detect the collision before N turns. However it is confused between angle 350 and 15 and it is not ...
4
votes
1answer
2k views

How to create a 3D world with 2D sprites similar to Ragnorak online?

As far as I know Ragnorak Online is a 3D game world with 2D sprites overlayed. I would like to use this style in a game I am making in Unity, so I would like the player to be able to select little ...
20
votes
2answers
1k views

Making entire scene fade to grayscale

When the player loses all of their lives, I want the entire game screen to go grayscale, but not stop updating immediately. I'd also prefer it fade to grayscale instead of suddenly lose all color. ...
0
votes
3answers
2k views

Parent variable inheritance methods Unity3D/C#

I'm creating a system where there is a base "Hero" class and each hero inherits from that with their own stats and abilities. What I'm wondering is, how could I call a variable from one of the child ...
1
vote
2answers
3k views

Breakout collision using 2D Rectangles?

Here is my code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Xna.Framework; namespace BreakOut { class Field { public static ...
2
votes
1answer
826 views

XNA 4.0 and Lidgren Library, How do I create a server/client hybrid?

My use of terminology may be off a little bit. I have been playing around with the Lidgren XNA sample for how the library works, and it is simple to implement it looks like. I am curious on the logic ...
6
votes
1answer
320 views

Should I call the garbage collector during loading screen?

SO, I read a bit on Garbage Collection lately, out of curiosity, and there is something that is repeated quite often: garbage collection can lead to sudden slow down of the program, depending of the ...
6
votes
5answers
840 views

Need some advice regarding collision detection with the sprite changing its width and height

So I'm messing around with collision detection in my tile-based game and everything works fine and dandy using this method. However, now I am trying to implement sprite sheets so my character can have ...
0
votes
4answers
3k views

XNA spritebatch drawing to the centre of screen

I have bit of a silly problem. Is is possible to use SpriteBatch.Draw() method to draw to the centre of screen using coords from the beginning of window (So resolution 800x600 would use 400;300) ...
2
votes
0answers
2k views

XNA Screen Manager problem with transitions

I'm having issues using the game statemanagement example in the game I am developing. I have no issues with my first three screens transitioning between one another. I have a main menu screen, a ...
4
votes
1answer
682 views

Character jittering with this tile based collision code

I have been trying to get my collision code working for hours now but with every resource I have tried my character still jitters. First I tried using the platformer sample but my character still ...
3
votes
1answer
2k views

Orbiting a specific point - Orbiting Camera

How would I create a camera that with the mouse, it allows you to orbit around a specifc position, with the camera always facing that point? I would also like it to be able to always be at a constant ...
5
votes
2answers
2k views

How do I resolve a collision with two tiles at once?

I am having some problems with collision detection. I have 2 types of objects excluding the player. Tiles and what I call MapObjects. The tiles are all 16x16, where the MapObjects can be any size, but ...
2
votes
1answer
272 views

2D Object 'Targeting' / 'Selecting'

I'm currently working with C# with the XNA framework. I'm trying to create a list of objects that are individually target-able after they are created and set in a list and displayed on a tile map. ...
3
votes
1answer
560 views

Making particle bounce off a line with friction

So I'm making a game and I need a particle to bounce off a line. I've got this so far: public static Vector2f Reflect(this Vector2f vec, Vector2f axis) //vec is velocity { Vector2f result ...
4
votes
4answers
2k views

Still confused about timesteps in XNA

I have been reading many different posts and articles about timesteps and while I now understand that fixed timesteps are generally considered superior, I'm having a bit of difficulty implementing one ...
1
vote
2answers
729 views

What basic windows form games should I build as a newbie in game development? [closed]

I am a complete newbie in game development. I want to know about some basic games that I can start building with simple algorithms and basic knowledge. I have already made few basic games like ...
2
votes
3answers
858 views

Stuck in an infinite recursion in Minesweeper

I am trying to build a simple minesweeper game. The game gets stuck in an infinite recursion whenever a user clicks on a tile which is not a mine... I have used the following function code for the ...
1
vote
1answer
509 views

Collision detection not working

I realized I put this in the wrong forum, so here it is: I made a collision detection in the Update() section, and this is the code: if (player.playerRect.Intersects(turtleRect)) { ...