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

7
votes
3answers
339 views

Slerping rotation mirrors

I rotate my game character to watch at the target using the following code: transform.rotation = Quaternion.Slerp(startQuaternion, lookQuaternion, turningNormalizer*turningSpeed/10f) ...
7
votes
1answer
3k views

Elapsed game time differs from total game time in XNA

I was trying three different ways of using ElapsedGameTime and TotalGameTime, because I want an exact match, so everything is updated/drawn accordingly. As I was experimenting, I learned that the ...
7
votes
1answer
942 views

How do I communicate with an IronPython component in a C#/XNA game?

My XNA game is component-oriented, and has various components for position, physics representation, rendering, etc, all of which extend a base Component class. The player and enemies also have ...
7
votes
3answers
256 views

How can I handle versioning changes when saving assets?

I've been working on an RPG now for a while and I use two of different serialization techniques. Enemies, Weapons, items are as saved as XML. Maps and events are saved as "controlled binary" (every ...
7
votes
2answers
1k views

Calculating a quaternion so a bone points in a specified direction

In an attempt to solve this question, I decided to figure out the absolute (world space) directions of each joint in the source pose (as normalized unit vectors), and then rotate the joints of the ...
7
votes
2answers
1k views

Managing game state / 'what to update' within an XNA game 'screen'

I'm trying to figure out how best to manage state within my game screens - please bare with me though! At the moment I'm using a heavily modified version of the fantastic game state management example ...
7
votes
2answers
603 views

Is there a limit to Gametime.TotalMilliseconds?

Gametime should always be increasing, and totalmilliseconds is going to be the largest value. So if the game is hypothetically run for 1 day, this value should 86 400 000. This probably isn't a ...
7
votes
1answer
240 views

XNA 4 game for both profiles

I am writing game in XNA 4 and this version have two profiles hi-def and reach. My problem is that I need to have my game code for each of these profiles and is very uncomfortable to have two projects ...
7
votes
2answers
903 views

How to deal with variable size font in XNA 4.0

After searching for a while, I found no way to draw vector/scalable fonts in XNA 4.0 (which would be perfect...) and I am currently in a bind about how to render fonts for my game. In the game I use ...
7
votes
3answers
307 views

Sort Polygons in order - not working?

I'm fairly new to programming in a 3d world. I'm trying to create a canvas where all the objects are drawn in order of furthest-to-closest and from bottom to top - so they don't overlap each other, ...
7
votes
4answers
825 views

How can I create NPCs and scenes?

How would I go about creating NPC Events/Scenes? For example, any RPG will have a ton of different in-game cut scenes where you can express a story line. What I have thought of so far is having ...
7
votes
1answer
2k views

XNA Quadtree with LOD

I'm looking to create a fairly large environment, and as such would like to implement a quadtree and use LOD on it. I've looked through numerous examples and I get the basic idea of a quadtree. Start ...
7
votes
1answer
492 views

Spritebatch drawing sprite with jagged borders

Alright, I've been on the making of a sprite class and a sprite sheet manager, but have come across this problem. Pretty much, the project is acting like so; for example: Let's take this .png ...
7
votes
1answer
810 views

Scrolling a WriteableBitmap

I need to simulate my background scrolling but I want to avoid moving my actual image control. Instead, I'd like to use a WriteableBitmap and use a blitting method. What would be the way to simulate ...
7
votes
1answer
1k views

Tile-based 2D collision detection problems

I'm trying to follow this tutorial http://www.tonypa.pri.ee/tbw/tut05.html to implement real-time collisions in a tile-based world. I find the center coordinates of my entities thanks to these ...
7
votes
1answer
659 views

Implementing water effects (splashes) into XNA 4.0 game [closed]

I am creating a 2D XNA game and came across a tutorial on adding water effects (splashes) to an XNA game but after implementing it into my game I can't get it to scale down. Currently it takes up the ...
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.
6
votes
7answers
1k views

Wikipedia A* pathfinding algorithm takes a lot of time

I've successfully implemented A* pathfinding in C# but it is very slow, and I don't understand why. I even tried not sorting the openNodes list but it's still the same. The map is 80x80, and there ...
6
votes
5answers
2k views

What is the logic behind dialog trees?

How do dialog trees actually work? What is connected to what and how to move between lines of speech when a sub-conversation ends? If you have any examples of a basic dialog tree in C#, please post ...
6
votes
5answers
1k views

Why do objects interpenetrate in this simple collision solver?

The code below is from a Microsoft XNA sample here. This is quite a simple rigid body simulation that ignores many physical effects (such as angular momentum), but it does try to push objects ...
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 ...
6
votes
3answers
2k views

Network communication via Sockets. Is there a better way?

I'm building a game engine on the OpenTK framework that needs to support multiple players. How I have the basic framework established is that there is a Client and a Server. The Server binds and ...
6
votes
4answers
833 views

Game Editor - When screen is clicked, how do you identify which object that is clicked?

I'm trying to create a Game Editor, currently just placing different types of Shapes and such. I'm doing this in Windows Forms while drawing the 3D with XNA. So, if I have a couple of Shapes on the ...
6
votes
2answers
463 views

XNA ContentManager.Load causes string allocation

I was running the Visual Studio memory profiler on a project and noticed that an enormous amount of strings were being instantiated. It turns out that ContentManager.Load appears to create a new ...
6
votes
2answers
2k views

How do I save and load settings on the Xbox?

I'm using XNA 4.0. How can I load and save settings when on the Xbox? And can I write to and read from files?
6
votes
2answers
619 views

What is data-driven design? [closed]

I've been reading up on a lot of articles covering data driven design for games. It seems to come down to: No hard coding No game-specific code in the engine Scripting for AI, cutscenes, et cetera. ...
6
votes
2answers
397 views

Simulate movement towards the screen in a 2D world

I need to create the illusion of someone kicking a ball to the screen. For that, I have a initial position of the ball (about the middle of the screen), and I put the sprite of the ball scaled at 0.2 ...
6
votes
1answer
830 views

Questions about XNA

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, ...
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 ...
6
votes
3answers
3k views

XNA - Static classes from game libraries executing after content pipeline extensions, how to avoid the problem?

Alright, formulated this way I'm sure it sounds obscure, but I'll do my best to describe my problem. First, let me explain what's wrong with my real source code. I'm making a platformer, and here ...
6
votes
5answers
1k views

Fastest bit-blit in C#?

I know there is Unity, and XNA that both use C#, but I am don't know what else I could use. The reason I say C# is that the syntax and style is similar to AS3, which I am familiar with, and I want to ...
6
votes
2answers
10k views

How do i create bounding boxes with XNA 4.0?

I am having some trouble making bounding boxes for my models I am using within XNA 4.0. The way it was done in XNA 3.1 seems to be obsolete as you can no longer access parameters that were used before ...
6
votes
1answer
317 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
1answer
5k views

Clickable hex grid in c#.net

I want to create a Windows Form-based adventure game where the player clicks a hex on a static map to bring up their next encounter. I have the map already and plan to scan it and convert it to a .bmp ...
6
votes
2answers
4k views

C# Perlin noise - generating “endless” terrain chunks?

I'm currently writing a little side scroller in C#, to both learn C# and have fun. Right now I have a simple random number generator generating the world but it isn't exactly all that great - so with ...
6
votes
2answers
4k views

How do I create selectable menu options in C#/XNA?

Ok, I have my game's menu system set up. There are 3 screens (Controller Detect Screen, Title Screen, and GamePlay Screen). I wish to improve on this by having the ability for the player to select ...
6
votes
3answers
2k views

Is there a simple way to group two or more sprites, so all of them will be dependent on each other?

I think that this question is very similar to this one, but I'm not sure if the answers are universal. So, my goal is: Place two sprites in fixed position, for example player and his eyes Make ...
6
votes
3answers
3k views

Networking and movement in MMORPG's UNITY

I'm programming a dedicated server in C# using BeamServer2 DLL's. At first I wanted to be able to see other players move on our already made Omuni map. This I did by just sending your position to the ...
6
votes
1answer
261 views

How to make a registration for my game?

Me and my (new) company want to sell a very simple game, but we want it so that only the person that buys it can play it. I want to know if it's possible to make a "registration" window pop up when ...
6
votes
3answers
947 views

How should the actual game interface with the menu system

I'm using the Game State Management (GSM) concept in my prototype and I like it very much. One of the screen has a "Game" embeded in it, where all the "good stuff" happens. The menu launching the game ...
6
votes
2answers
2k views

XNA 2d Camera Scrolling - why use matrix transform?

I am making a test game where I want the level to be constantly scrolling. To create this effect I have established a camera class which simply stores a vector2 position and an enum direction. It also ...
6
votes
1answer
279 views

How do I make something visible only when I'm looking at it?

So I'm making a basic 2D game in C# XNA. I want it so wherever my character is facing there is a cone of light and only that part of the level is visible while the right of the screen is dark. Please ...
6
votes
1answer
448 views

ObjectDisposedException when Texture2D isn't disposed

I'm making a particle engine so I develop a texture programatically and I want to display it in a Windows Form picture box. So I create the Texture2D which goes fine. Then I use this code to convert ...
6
votes
2answers
2k views

Get collision details from Rectangle.Intersects()

I have a Breakout game in which, at some point, I detect the collision between the ball and the paddle with something like this: // Ball class rectangle.Intersects(paddle.Rectangle); Is there any ...
6
votes
3answers
526 views

Transforming a primitive tetrahedron into a primitive icosahedron?

I've created a tetrahedron by creating a BoundingBox and building the faces of the tetrahedron within the bounding box as follows (see image as well): VertexPositionNormalTexture[] vertices = new ...
6
votes
3answers
641 views

Is there any Card Game Framework? [closed]

Please let's avoid the discussion of creating/using a game framework or not. I would like to create a small framework for card games or use one if it exists. Does anyone knows one? Preferably ...
6
votes
6answers
322 views

What can I do with an old XNA game?

I have this little amusing game that I made in my second year of high school, and I'm rather impressed with it. It isn't anything that I could present in any style of major game conference or ...
6
votes
1answer
150 views

How to put an invisible marker on a model and refer to it in the game?

I am using XNA/C# to load up 3ds Max models exported in FBX format. Is there some way to mark a specific point in the model like the pipe of a gun so I can just refer to it and place a bullet in there ...
6
votes
3answers
3k views

Loading sound in XNA without the Content Pipeline

I'm working on a "Game Maker"-type of application for Windows where the user imports his own assets to be used in the game. I need to be able to load this content at runtime on the engine side. ...
6
votes
3answers
4k views

XNA: SpriteFont question

I need some help with the SpriteFont. I want a different font for my game, other than Kootenay. So, I edit the SpriteFont xml, i.e: <FontName>Kootenay</FontName> or ...