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

0
votes
1answer
143 views

Cannot build project for Xbox, using XNA

I'm trying to build a project for Xbox, and when I try to Package as an XNA Creator's Club Game I receive the following errors: The best overloaded method match for ...
2
votes
2answers
516 views

Transforming bounding spheres

When testing bounding spheres as part of the collision detection process, I'm using this method: public static BoundingSphere TransformBoundingSphere(Matrix m, BoundingSphere b) { var ...
0
votes
1answer
431 views

XNA Multisampling only for 3D

I am working on a game which consists of 3D elements and a 2D GUI. I have it working properly, but I want to enable multisampling for only the 3D parts, and not the 2D Textures. Otherwise, the GUI ...
5
votes
3answers
891 views

XNA shader compiler error in release mode

I'm having a hard time figuring out if I'm doing something wrong, or if there is a bug with Visual Studio. I want to pass a float into my pixel shader, clamp it to a value, and then return it as part ...
-1
votes
3answers
4k views

Trying to generate some unique numbers [closed]

I find impossible to get this code to work! I want to generate 10 numbers that are unique, but despite all I change, I get duplictates of numbers in the array! Would really preciate some help to solve ...
1
vote
2answers
656 views

XNA How to detect collision between 2d sprites and 3d primitives (not models)

My current status: I have already read some tutorials about 3d collision I know how ray trace works and how to convert mouse follow a vector to track the closest object that collides with out vector ...
5
votes
3answers
661 views

How should I handle collectable/droppable/stackable items in an inventory?

I am working on a game with an inventory system, but am trying to figure out the best way of doing it. I have read the post about adding WorldItems or InventoryItems to a list, which is fair enough ...
4
votes
2answers
383 views

Strongly Typed Skills

I am working on a skill system for use in a game project I'm chipping away at. The project is entirely in C# so I'm using .NET to its advantage. In my preliminary implementation of a Skill Category ...
1
vote
2answers
880 views

Random position of object in foreach loop

i need help with some "scary" thing. I'm creating some objects in foreach loop. Each object has implemented in Update function random change of position. But while i'm creating this objects in foreach ...
3
votes
1answer
2k views

C# XNA Is key toggled?

I've got a question about toggling keys. How do You check if the key is toggled? Here's my quick and easy code: public class KeyToggle { private bool isEnabled = false; ...
3
votes
3answers
2k views

Handling movement in an Entity Component System

I'm working on a 2d RPG game in C# using an Entity-Component-System architecture, and I'm currently working on movement. Right now, I'm wondering how to organise the code so it looks a bit more.. ...
3
votes
3answers
477 views

Tile based platformer, using larger tiles?

So for my tile based platformer, It has a grid of tiles Occupying 1x1 block for each one. However, What if I want larger tiles? Maybe doors, tables, etc. They wouldnt fit in a 1x1 tile, so what I ...
1
vote
3answers
637 views

Smallest increment for a SpriteBatch depth between 0.0 and 1.0?

I experienced some problems with SpriteBatch in XNA when I tried to mix two different SpriteSort modes. (Begin with deferred, end, begin with BackToFront wasn't sorting properly.) I've settled on just ...
1
vote
2answers
264 views

Client/Server Object updates seems to run at different speeds

i have been playing around with the NetworkPrediction sample from Microsoft. Trying to adapt it to use gameTime. The client is running without fixed TimeStep and the server is custom C# and updates a ...
2
votes
1answer
277 views

MonoGame: prevent command prompt in windows?

Is there a way to prevent the command prompt from opening in windows when launching the game (via double clicking)?
1
vote
2answers
634 views

PreferredBackBufferWidth/Height from GraphicsDeviceManager not working?

It works fine in other "projects" so it has something to do with project. The project im talking about here has tons of classes but nothing with graphicsdevicemanager other than game1.cs game1.cs ...
2
votes
2answers
522 views

Organize game classes C# XNA

I've just begun working on my game and I don't know how to organize my game in separate classes, because I need some variables/methods to be available to every class. I have a screen manager class and ...
0
votes
1answer
176 views

Getting width and height of view of game

well I have googled it and got some answers, asked many times, answered many times. as I read viewport is the "inside window" So I have 2 integers, height and width and this code: ...
2
votes
2answers
227 views

Child parent rendering (flash) in XNA

i am currently in the process of implementing a render engine that works like flash's. Where a sprite is drawn inside another sprite and reflects all transformation (rotation, scale, etc) on the ...
3
votes
3answers
1k views

Textureing subdivided Icosahedron in XNA, seam problem

*Look below for the updated source code* I have started to to make some different types of objects and create them by code in XNA. Right now I have finished the code for creating a Icosahedron. And ...
0
votes
2answers
141 views

X and Y value to Vector2

In the first code I get a Vector2 random position and create an object with that, but in the second code I want to use the same constructor to create an object, but I want to pass a X and Y value to ...
0
votes
2answers
227 views

Implementing a multishot powerup for a top down shooter

I have a top down shooter wherein I generate a projectile on each mouse click at the player's position and translate it in a straight line until it reaches the edge of the screen. I also have ...
2
votes
1answer
183 views

Overlapping vertices on sphere?

Iv started up doing some programming in XNA as Iv been doing C# for several years and would like to start do some 3D work with C# and XNA framework. Right now Im trying to build a sphere by code. It ...
8
votes
3answers
921 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 ...
4
votes
1answer
248 views

Create shape from points / lines in editor and mathematically calculate nearest points within shape

If I want an editor that accepts "points" of a minimum of three (a triangle) and I just add some points first, like this: how can I mathematically connect these corners (points) into an object of ...
2
votes
1answer
287 views

Texturing voxel faces separately

I am creating a 3D level editor which should be used to generate the very basic layout (level geometry) and a few basic game-logic entities of maps used in my game. So far, I decided to use voxels (i ...
0
votes
1answer
170 views

Can someone explain this occurrence with a fbx model in xna?

Because this is kind of weird to explain, let's show you what I mean. This is in my game. When I import this base ship model, it should be at (1000,1000,1000), but the model acts like it's at ...
0
votes
1answer
332 views

3d world vertex translation to go to 2d screen coords

My technical english is a little rusty so to avoid misunderstands please be patient with me :) I will try to be brief and clear Situation: - I have a 2d sprite character on the screen - I've just ...
5
votes
1answer
782 views

What is the best way to implement dialogs in an xna game?

I want to implement some startup dialogs, for selecting game parameters, etc. The obvious (and I suppose naive) choice is to just use windows forms (I'm not really planning on porting this game to ...
0
votes
2answers
440 views

using per pixel collision for an elastic response

I realize this might be open ended ended but curious if I just did some over kill... I had this http://xbox.create.msdn.com/en-US/education/catalog/tutorial/collision_2d_perpixel and i reworked it ...
1
vote
1answer
210 views

How would a sprite spawn more sprites under themself every second?

I am making a snake game and am having trouble to make the snake go longer, at the moment when I run the program, I just have the snake head eating apples. But I want the snake head(30x30) to spawn ...
-3
votes
1answer
121 views

I need to make a create-a-class system like in COD

I need to make a create-a-class system like in COD but I don't know what code I need. I am also wondering if I have to make a photoshop image for every way it could look or do I type in the code to ...
0
votes
2answers
313 views

Compare new Vector2 position with previous Vector2 position

I'm trying to place different objects in the game area like a grid, but I have some problem with my method that creates this objects and there positions. I'm trying to store each new positions in a ...
6
votes
6answers
347 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 ...
3
votes
3answers
467 views

How can multiple clients be out of sync if they use the same RNG seed?

I have been working on a client-server architecture to enable LAN play for my open source game, Aigilas. In its current state, players stay synced in all running instances of the game but enemies and ...
2
votes
2answers
186 views

Handling of data sharing between framework module

I am currently developping a 3D game using C# / XNA 4.0 and i am currently thinking about how i should structure my game. The actual game is in fact not really important as the framework i am working ...
2
votes
0answers
1k views

Why is my deferred lighting implementation so expensive?

I've implemented deferred lighting and I tried to put about 20-26 lights on the viewable space of my map, and it brings down the FPS from 61 to 28-31. It also makes my VGA temperature to go from 68°C ...
2
votes
1answer
442 views

How to handle input for both UI and game

So I originally had my input system set up with only the game part in mind. It listens to keyup/down events, marks the key as pressed/unpressed and then when the next update comes around, it sends ...
1
vote
2answers
261 views

Help retrieving/sending data to/from a server on iOS (C#, Mono, .Net)

I'm sorry in advance if this is a silly question. I'm currently working on getting something running where I can grab information from a server. My goal is to make the data I'm retrieving (or ...
1
vote
0answers
306 views

Is it considered poor programming to do this with xna components?

I created my own Menu System that is event driven. In order to have a loading screen and multithreaded loading to work, I devised this sort of implementation: //Let's check if the game is done ...
0
votes
1answer
433 views

Setting Krypton Light to Screen Pixels

So a few days back, I started playing around with Krypton XNA for 2D lighting in my game. I noticed in general, that spawning a light at (0,0) with Krypton causes the light to appear in, pretty much, ...
4
votes
4answers
1k views

Why use this equation to get a percentage?

In an XNA book I read that this code does an action with a 0.2% of probability but I don't' understand why: float chance = 0.2f; if((float)rand.Next(0,1000) / 10 <= chance) { ... } I understand ...
0
votes
2answers
1k views

Creating mesh at run-time

I've a set of voxel data and I want to create a mesh out of it at run-time. I've looked into MeshBuilder and MeshHelper but I haven't found anything useful or a good tutorial how to use them. Can ...
2
votes
2answers
297 views

Avoid the same code several times in game state enum

I use a switch with enums to divide my game in different parts. In the code below, that is simplified, I have a problem, becasue I need to show the same text in two or perhaps more parts and I wonder ...
2
votes
1answer
397 views

My transparent objects overwrite opaque objects depth and always draw on top?

I have set up an 'Order Independent Transparency' method for drawing my transparent objects. The algorithm can be simplified as follows: DrawOpaqueObjects() DrawTransparentObjects() Drawing the ...
1
vote
0answers
253 views

Map terrain generation to texture instead of color

I have some terrain being generated using the following algorithm double rand1 = rand.NextDouble() + 1; double rand2 = rand.NextDouble() + 2; double rand3 = rand.NextDouble() + 3; float offset = ...
2
votes
1answer
301 views

Implementing Circular Sprite Masks

So I've been scouring the interwebs for a couple of days with regards to how to implement sprite masking in XNA 4 and C#. Coming from a pet project I did in Flash, this was pretty easy as masks are ...
1
vote
2answers
118 views

Unable to generate standalone noise

I've been stuck this evening on getting a Perlin Noise function to generate by itself. Every time I run the program without adding to different types of noise together it calls an ArgumentException ...
0
votes
1answer
350 views

Problem with monogame reference in monodevelop MAC

I've downloaded monogame, monotouch (test version) and monodevelop for MAC and I created a monotouch IOS project, I included the Lidgren and Monogame csproject inside my monodevelop project and I ...
14
votes
5answers
12k views

SharpDX and game engines, back to zero?

I'm a desktop developer (I mainly do WPF for a living) but I want to make games as a hobby. So a few months ago, I started reading blogs, gamedevSE, you name it. I understand in the C++ DirectX ...