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

4
votes
2answers
431 views

Trace with 2D terrain

I currently have some 2D terrain in my game defined by 2D coordinates with lines drawn in between them (linear interpolation too keep it simple). Now I want to cast a ray from anywhere above the ...
1
vote
3answers
361 views

Help Reading this Data in XML as a List (ContentReader)

Edit: So i'm going to rephrase the question a bit, seeing as now i think know how i'm going to read this data. Looking at this example as my guide: ...
6
votes
1answer
156 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
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 ...
1
vote
4answers
243 views

Designing a game that allows for selectable perks/customization

Call of Duty games all have the core functionality of any FPS (walking around, killing, dying and repeat). Layered on top are various stuff. Of interest to me is during pre-game when you pick your ...
0
votes
1answer
195 views

A few queries about my Map Data (& ideas of improvement, seconded opinion required)

so like the title says i'm trying to think of ways that i can basically improve my level/map data. Currently it's "alright" but i don't feel it's great. There's certain things that i'd like to-do to ...
1
vote
2answers
197 views

How (if possible) would I change the BasicEffect Matrix mid draw

Say, for example, I have a list of enemies. Each enemy is a textured quad which is the stored in a singular shared VertexBuffer and IndexBuffer with the buffer usage set to BufferUsage.WriteOnly ...
7
votes
2answers
652 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 ...
3
votes
2answers
1k views

Is there a universal method to send key or mouse input to any application from C#?

I need method or group of them to send signals to any application (browsers, games, et cetera) about mouse movement or key input. I can easly retrieve an IntPtr to any process, but I don't know what ...
2
votes
2answers
2k views

Creating 2D billiard game with realistic movement

I'm new to XNA and game programming. I'm creating a 2D billiard game and I want to add balls with realistic movement (like 3D). Is it possible to achieve this without using 3D models? I only want to ...
2
votes
0answers
1k views

Controlling 3D model with mouse XNA 4.0 C# [closed]

I am creating a 3D table tennis game and the racquet (created in Maya 2012) is controlled by the mouse. I have used picking method to control the racquet, however the cursor is not on the racquet. It ...
5
votes
1answer
910 views

What are the drawbacks of this messaging system implementation?

So I've just been thinking about component and messaging systems recently for simple C# XNA games and came up with this. How extensible would this implementation be and what are the drawbacks? Example ...
2
votes
1answer
2k views

Simple WP7 pong game with real time multiplayer using sockets

I'm making a pong clone for Windows Phone 7 and I'd love to add a multiplayer option. I've been trying to use this Ricky Tan's tutorial: ...
2
votes
3answers
2k views

How to convert screen space into 3D world space?

I am trying to make a 3D model to look at the mouse position. Currently I have this code: MouseState mouseState = Mouse.GetState(); Matrix world = Matrix.CreateTranslation(0, 0, 0); Vector3 source ...
1
vote
1answer
345 views

Avoiding lag when playing sound for first time using Cue.Play

In my code I'm using SoundBank.GetCue("cuename") and Cue.Play() to play my sounds. On the xbox whenever I first play a cue I get lag of about about one second. How can I avoid this? I'm thinking I ...
-4
votes
1answer
941 views

should i use java or c#? [closed]

i know a similar question has been asked before but, my question is somewhat different. I have been learning C# for a few years but nothing in game making, more like applications and web like ...
3
votes
1answer
430 views

Performace problems with Voxel Engine

well, I am creating a voxel engine in C# and XNA and many posts I have posted on this site have been due to performace issues, many people suggested using a profiler to help me out. I have, and ...
2
votes
2answers
897 views

How do I deal with abstracting collision handling code between entities with differing collision components?

I'm using a component based entity design with Components that hold the data and Systems that act on entities based on the components they have. Entities are registered to all systems as they are ...
1
vote
1answer
649 views

Can't seem to get predictive collision detection working correctly

I am trying to set up the collision detection on a basic 2d game, player clicks a button sprite moves one step int he corresponding direction. Currently all my sprites have the collision rectange ...
1
vote
1answer
256 views

Should i be worried about loading so much data?

So a week ago or so i asked this question: A few queries about my Map Data (& ideas of improvement, seconded opinion required) And the advice in the comment was to ask them as 3 separate ...
3
votes
1answer
1k views

XNA mouse position in windows forms

I am using this code in Update method in XNA RenderControl in Windows Forms: ... Mouse.WindowHandle = renderControl1.Handle; MouseState stat=Mouse.GetState(); ... Everything works fine but when I ...
3
votes
1answer
400 views

Confused about order of operation when using a Matrix in XNA, C#

Here are two different pieces of code This is what I started with Vector2 hold = Vector2.Transform(pos1, mat1); Matrix inv = Matrix.Invert(mat2); Vector2 pos2 = Vector2.Transform(hold, inv); And ...
2
votes
1answer
989 views

How do I load Gleed 2D levels in WP7 XNA game?

I've been trying so long to use this modified version of GLEED2D that includes WP7 support, I'm stuck into loading the level into my game, now my Game1.cs class has the following: protected ...
4
votes
2answers
4k views

How to get mouse position relative to the map?

I'm creating a game in XNA similar to Minecraft - Minecraft 2D It looks like this Here's how it works: All blocks are generated once with fixed x,y coordinates and just re-drawn. //generate ...
7
votes
3answers
3k 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 ...
2
votes
1answer
1k views

How to get window size from within another class?

I have found this post explaining about how to get the size of the Window, but for whatever reason I'm having issues getting it to work inside of a Singleton class that I'm made to manage a set of ...
2
votes
2answers
306 views

Telling which side of a voxel was hit by an object

In XNA, I have an axis-aligned BoundingBox representing the object's hit box, and a Vector3 representing the object's velocity. I also have a stationary 1x1x1 axis-aligned BoundingBox representing a ...
2
votes
1answer
781 views

Create a car sound with frequencies

Im trying to create a car game in c sharp! Im now trying to figure out a way to get some sounds into the game! For example, the acceleration sound of the car. I recently tried to add a 5 second-sound ...
-4
votes
3answers
3k views

How to make map editor with XNA?

I have a problem with making map editor in XNA. I'm making a 2D tile based map editor. The problem is, I need every tile I put in map editor to be X: 0, or X: 32, or X:64 and so on, not 1.10, 2.99, ...
4
votes
3answers
633 views

How to calculate origin and position of a weapon which should be “in hands”?

I'm currently stuck with my game, which is from the top perspective. I'm currently using these sprites for player: (using the second at the top): And here's what I use for my gun My problem is ...
3
votes
4answers
1k views

Why does using multithreading during my load screen increase my load times? [closed]

OK, I added a loading screen to my game, and in order for the game able to update and show a loading screen and load stuff in the background I came to the concludsion that I needed to host the loading ...
28
votes
4answers
2k views

Why does my object move faster at 45 degrees than at 90 degrees?

I have objects in my game that move faster at 45 degrees then at 90 degrees. Each object has Point (x,y) position Vector2D (x,y) direction Int speed And what I do during a update is that new ...
3
votes
3answers
859 views

How to parse & “pack” network commands?

I'm currently creating a game which should be multiplayer (client-server-client), but I'm stuck. I have been doing crazy things like building a text chain like string networkMessage = userHash+" ...
2
votes
3answers
2k views

How do I check collision when firing bullet?

I'm currently creating 2D game from top perspective. I'm having problems with bullets. Yes, I currently simulate their movement so user can see them (about 2x ). Moving them with // this is static ...
-6
votes
2answers
1k views

How can I convert the 3D Object designed in MAYA or 3D Max to OpenGL Object?

I'm try to convert the 3D Objects created in the Maya or 3D Max to Simple OpenGl object anyone please guide me how can I do so???
3
votes
1answer
247 views

Does ContentManager.Load<T>() re-read an asset if I have loaded it before?

Or is it smart enough to know I have asked for it before and return an in memory copy created from the first call? For example if I have a projectile's texture: Texture2D projectile; If then I ...
9
votes
2answers
3k views

What are the pros and cons of Lua vs. Python as a scripting language for XNA/C# platform?

I am thinking about giving a go to one of my ancient ideas for a game. The core point of this game would be the possible level of functional customization of the game environment and objects (such as ...
1
vote
4answers
1k views

Significant 2D SmallTalk/Squeak Game? Smalltalk/Squeak vs. C#

Prompted by this question about becoming a faster programmer, I'm curious to know if anyone has made a significant-sized 2D game in SmallTalk or Squeak. And if so, how does it compare to C#? I'm ...
0
votes
1answer
216 views

Creating a vertexbuffer to define vertices arranged in a grid with the view for easy editing later

I'm using the marching square algorithm (2D version of marching cubes) to generate vertices. I end up with vertices arranged in a grid. I want to enable destructible terrain, and the way i was ...
0
votes
2answers
347 views

Can I create mods for a D3D game made in C#?

There is a game currently in development in C# (using Direct3D for graphics) that I want to make mods for. Ideally, I would like to make the mods in C#, but after that I am lost. How would I (or ...
0
votes
1answer
892 views

Open source component-based game engines? [duplicate]

Possible Duplicate: Are there existing FOSS component-based frameworks? What open source game engines with component-based design of game objects do you know? And which best of them? I mean ...
0
votes
1answer
448 views

Best Algorithm for attacking in the Risk Game

I apologize in advance for my English.I'll try to explain my problem. I am working on new version of the Risk game. I want to change the attacking algorithm to make it more similar to real life war. ...
4
votes
3answers
3k views

How can I stop looking for keyboard input for a length of time?

I'm pretty new to programming, and even newer to C# and XNA. I currently call a method that looks for keyboard input in my Update method. This method has if statements for doing what needs to be done ...
4
votes
1answer
1k views

Creating a Model out of Math primitives

Here is a litte sample that I drew in Blender to visualize what I am planing to create: Cone with spheres sample I already have the code to generate the cone and the spheres as mentioned in my ...
14
votes
9answers
4k views

How should I go about learning XNA? [closed]

I want to start learning how to make games in XNA, but I have no idea where to start! If someone could advise me on what pieces of software I need and some good books or tutorials to look at, that ...
13
votes
3answers
4k views

Beat detection and FFT

I am working on a platformer game which includes music with beat detection. I am currently detecting beats by checking for when the current amplitude exceeds a historical sample. This doesn't work ...
2
votes
1answer
269 views

How can I get the texture color data from GLEED2D's level file?

I've hit a little snag in my game. It's a 2D platform game and I need to check for collisions against the level. I'm using GLEED2D to create the map. I'd like to do per-pixel collision checking, but ...
2
votes
1answer
286 views

When animating sprites, why subtract frametime when switching between sprites instead of resetting elapsed time to zero?

I am currently on chapter 3 of the book "Learning XNA 4.0". At the end of this chapter is a section on changing the animation speed of sprites. timeSinceLastFrame += ...
19
votes
7answers
6k views

Easiest, most fun way to program 2D games? Flash? XNA? Some other engine? [closed]

this is a post detailing my search for the most enjoyable way for a hobbyist game programmer to sweeten his free time with making a game. My requirements: I looked at Flash first, I made a couple of ...
3
votes
2answers
599 views

What is the metrics of vectors in XNA?

When exporting a model from 3ds Max as FBX to import it into XNA, what metrics should I choose to make 1 unit in 3ds Max equal to 1 unit in XNA? For example: I have a sphere model with 1m radius ...