Tagged Questions

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
1k views

How can I achieve smooth animation of sprites between discrete tiles?

I'm currently learning game development with C# and XNA and my current assignment is to create a Pac-Man clone. The game is partially tile based, which means that the level itself is built out of an ...
3
votes
3answers
680 views

Why large builder classes rather than separate clases in component-based entity systems?

I was reading about component-based entity systems and I was wondering why there is usually a large EntityBuilder class with methods like CreatePlayer(), CreateEnemySpaceship(), and CreatePowerup(), ...
4
votes
2answers
1k views

Which pathfinding algorithm should I use for multiple enemies and tower placement?

I am new to game development and I am developing my first "Tower Defense"-type game. I need a pathfinding algorithm to place my towers and to move enemies. For tower placement case: I want the ...
9
votes
2answers
2k views

Getting rid of dead objects in a game effectively?

I'm using a for loop or foreach loop (doesn't matter) to loop through all my objects when they need to be updated or drawn. However, when an object gets killed, I want it to get removed from the ...
7
votes
5answers
1k views

How to make sure there's always a walkable path for enemies in a tower-defense game?

I am making a 2D tower defense game. So far I have a 2d array which acts as a grid for my game. I'm able to place towers on it, run enemies and some dragging and tower firing stuff. Now I am facing a ...
10
votes
5answers
3k views

How to properly handle collision in a component-based game?

Trying to wrap my head around the ways to properly handle collision in a game designed around components. I see many examples have some sort of PhysicsComponent that gets added to the entity's list ...
2
votes
1answer
629 views

Image spinning in c#

I'm currently in the process of making a top-down shooter for my programming class, and one idea I had, but don't exactly know how to implement is image rotation in order to spin the object ...
4
votes
2answers
830 views

XNA Rotation results in a pixelated image

I have a "problem" with XNA 4 and spriteBatch. When I draw a rectangle and rotate it, the sides get quite pixelated and look bad: example: What do I need to do to make the edges look smooth? ...
1
vote
2answers
715 views

Should game services be global? (XNA)

If one wants to use services, they can use the ones built in to XNA (Game.Services) and pass around the Game object to everything that needs to either query for a service or add a service. ...
9
votes
2answers
2k views

What's the difference between XNA Game Services and glorified global variables?

The Microsoft.Xna.Framework.Game class has a Services property that allows the programmer to add a service to their game by providing the type of the class and an instance of the class to the Add ...
6
votes
3answers
2k views

How do I organize my game into multiple classes in C#?

I've made two simple 2D games while following tutorials for the XNA libraries, and I wanted to make something myself, with only the knowledge I gained from these tutorials. This will be my first ...
9
votes
4answers
2k views

What technique should I use to facilitate communication between XNA GameComponents (or between components of any type in a game)?

I'm starting out on my first 'proper' game project, and I've inevitably hit a block trying to decide how game components in XNA should communicate. From previous (Java) GUI programming events, ...
1
vote
1answer
776 views

Clipping polygons in XNA with stencil (not using spritebatch)

The problem... i'm drawing polygons, in this case boxes, and i want clip children polygons with its parent's client area. // Class Region public void Render(GraphicsDevice Device, Camera ...
1
vote
1answer
837 views

Model not rendering correctly XNA

Basically i am trying to render a model yet it seems to draw polygons that should be behind something, in front of it. So i end up seeing some faces that should be behind something, totally covering ...
1
vote
1answer
1k views

Line segment / circle intersection - X value seems wrong?

Major Edit I'm making a Breakout clone, and having difficulty with collision detection between a circle and line segment. Apologies, my earlier question was a result of frustration and no sleep :) ...
8
votes
1answer
7k views

Get position of point on circumference of circle, given an angle?

I would like to know how to get a specific point on the circumference of a circle, given an angle. The diameter of the circle is 1, and the center point of the circle is { X: 0.5, Y: 0.5 }.
3
votes
1answer
2k views

2D circle / rectangle collision detection issue - brief overlap

I'm currently trying to build a Breakout clone as a first step into game development. I'm using the following collision detection code (adapted from ...
2
votes
1answer
440 views

tiled map - changing textures? (XNA HLSL)

I have successfully created a tiled map of various textures. Right now, i had a Vector4 in my own custom Vertex declaration deciding what texture each of the tiles should be. This is working ...
4
votes
1answer
2k views

How do I create a CPU read/write buffer in SlimDX (what are the legal combinations of Usage and CPUAccess flags)?

Currently, I create a vertex buffer in SlimDX like so: SlimDX.Direct3D11.BufferDescription Description = new SlimDX.Direct3D11.BufferDescription(); Description.BindFlags = ...
1
vote
1answer
697 views

Rendering fancy particles?

I'm making a tower-defense game for Windows (not phone) in XNA. I've seen this video of another tower-defense game for Windows Phone that uses particle effects, which I really like. They change ...
9
votes
1answer
3k views

Wave ripple effect?

I've been working on a tower-defense game for some time now, and so far I am really satisfied with the results. However, there's one thing I'd like to add. I've seen a video of GeoDefense for Windows ...
0
votes
2answers
201 views

In XNA, is there an issue with copying/pasting the using statements to each .cs file?

When I'm working on a project in XNA I copy the using statements from file to file. However, on tutorials I've seen for various games, they show files that only have specific using statements used. Do ...
4
votes
1answer
647 views

C# 2D Game Design/Architecture Question

I am developing a 2D game for windows phone using C# and XNA. I have a list of screens managed by an engine. each screen has a list of components like 'camera', 'skyBackground', 'landBackground', ...
2
votes
2answers
868 views

How to get started in Card Games

My end goal is to play a card game with my friends from other locations over the internet. I am going to start with a card game like blackjack and want people to be able to play in real time or close ...
1
vote
1answer
966 views

How to make a platformer character go DOWN a 315 degree slope?

Alright, so I got this code I'm trying to write, but the player won't go down the slope, it goes down and up perfectly on the 45 degree slope, but the 315 degree one is a mess. it goes "up" the ...
3
votes
3answers
2k views

is it possible to use c# GUI toolbox in an XNA app?

I need both reach GUI features of c# toolboxes and fast rendering features of XNA, is there any way to merge these two into one app? or is there any other way? for example some equivalent to c# ...
6
votes
9answers
2k views

Is it essential that I learn Try/Catch and Finally statements for Game Programming, or is it something I can come back to? [closed]

Doesn't seem like something that would be an essential part of GAME Programming.
2
votes
1answer
530 views

C# different resolutions compatible application

Can you give me a quick tour for an application which has to work in different resolutions. It's a game, with lot's of graphics and images and effects. We are using C#. The game is simple 2D, looking ...
1
vote
3answers
826 views

create an event for every enum value (game action handeling)

I'm currently working on creating an input-action system for my game. I simply wanted an easy way to map an ingame action to a certain key. I've managed to do so with the following method: Create a ...
3
votes
2answers
2k views

Raycasting in Unity3D?

I have a game object on screen represented by a cube (but say it was a quad or something else all the same). How do I raycast to check intersections? Keeping in mind I may not be raycasting fora ...
3
votes
2answers
2k views

What is the “DirectX for Managed Code Update”?

I came upon this site while looking for information about working with DX in managed code and saw that MS released something containing a 'DirectX for Managed Code Update'. This sounds promising but ...
4
votes
3answers
1k views

Rendering tiles on 3/4 perspective

Using a 3/4th perspective, I'm trying to create a way to render cliffs where nothing is overlapped, and it creates an accurate representation of the elevation. This is a rough mockup of how it might ...
3
votes
2answers
958 views

XNA C#: How can I prevent blurring when drawing from a RenderTarget2D?

I'm making a game and I want the end graphics to look chunky and pixellated, so I'm drawing from the spritebatch onto a RenderTarget2D which is 1/4th the size of the actual backbuffer, and then ...
1
vote
1answer
113 views

Issue With Image Rendereing

I'm pretty New to the XNA Side of things, I have built in PhotoShop a Set of frame by Frame images side by side to go through an animation class to display them frame by frame. With this my images ...
3
votes
1answer
2k views

How do I implement SkyBox in xna 4.0 Reach Profile (for Windows Phone 7)?

I'm trying to Implement SkyBox in my phone game. Most of the samples in the web are for HiDef profile, and they are using custom effects (that not supported on Windows Phone). I've tried to follow ...
6
votes
4answers
2k views

How do I add Different Screens to my C#/XNA Game?

I'm working on a Pong clone in XNA. Gameplay-wise, I have it where I want it to be. I want to add a title screen and some other screens to it like a menu, as well as a screen for the Winning/Losing ...
3
votes
2answers
1k views

XNA game randomly drops to 40fps

I have a fairly straight forward 2D game written in XNA. I'm finding that it arbitrarily drops from 60fps to 40fps. I've tested this drop extensively and have concluded it's not related to graphics ...
6
votes
1answer
568 views

Linking nodes algoritm for Visual Design

I'm developing an editor for my game, and now it's time to make a visual scripting system to let designer modify behaviours. This video shows what i have done and the problem to resolve the link ...
5
votes
4answers
664 views

Debugging tips? [closed]

I'm new to games programming and I'm working on a C#/XNA project. Something I'm spending a lot of time on is debugging. Obviously as games run in a loop finding the exact iteration that a bad ...
3
votes
3answers
4k views

Getting the angle between two objects?

I have a set of boxes which create a sort of path, they don't intersect very smoothy and to help that process I'm trying ot find a way to get an angle between them that can make it easier to generate ...
0
votes
1answer
180 views

Is it possible (from the vertex shader) to always draw at specific pixels?

I am wondering if I can (if possible) make a vertex shader that will always make the pixel shader draw everything in 1 pixel, at position 0,0. I know this sounds crazy, but it's needed in the ...
3
votes
2answers
560 views

Crafting recipes: storage and quering

Consider following situation. In a game you can perform crafting: i.e. create new items from existing ones (like in Minecraft). I have following game entities (simplified): item: atomic part; ...
4
votes
1answer
679 views

C# Top down movement limitation

I'm using C# and Visual Studios 2010 with XNA 4.0+lua, and my teacher has asked us to make a 2D RPG game similar to zelda(top down). I was aiming to use just one image for each map region, instead of ...
0
votes
2answers
534 views

DirectX 10 - determining if hardware device is available

I am writing an offline renderer using SlimDX and Direct3D 10 that will need to be run on machines without graphics cards (servers). On these machines, I'll be using the WARP software renderer. Is it ...
12
votes
2answers
3k views

Inheritance vs Composition

I make my money in C# Generally in that language I like to decouple everything to the high heavens using interfaces. This has served me well in enterprise code but in writing games in C# I find myself ...
4
votes
1answer
360 views

How do I check if a key is down in XNA when I'm only given a string that has the key's name?

I'm trying to get access to the keyboard state in XNA from an embedded JavaScript runtime. I'd like to do something similar to the following, but I can't seem to figure out how to get from "Left" to ...
-1
votes
3answers
424 views

Move camera on X and Z only

How would you implement movement on a camera in order to always move it on X and Z coordinates, and if the camera has pitch yaw or roll it still moves only in those coordinates and doesn't fly up?
0
votes
1answer
632 views

Heuristic Calculation for pathfinder

I've been modifying a pathfinding example from XNA Pathfinding example as described in my previous question Link to question here I had an issue where the character moved kept moving back and forth ...
5
votes
2answers
4k views

Direct2d off-screen rendering and hardware acceleration

I'm trying to use direct2d to render images off-screen using WindowsAPICodePack. This is easily achieved using WicBitmapRenderTarget but sadly it's not hardware accelerated. So I'm trying this route: ...
1
vote
2answers
2k views

Create a body of an irregular 2D sprite in Farseer

I'm trying to create a body of a irregular 2D sprite Farseer 3.3.1. The regular shapes that BodyFactory provides are not that I want. Is there a way that one can create irregular objects? Could it be ...