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

3
votes
4answers
590 views

Some advice for settling on a map format for a tile game?

I am using XNA 4.0 and am currently working on a simple tile game to pass the time. Basically, I'm using the tried and true method of having numbers refer to tile types, where in 0 would be an empty ...
0
votes
1answer
232 views

Primitive Animation

I am creating a minecraft-like clone and was wondering what is the best way to go about animating a model, for example implementing the following feature: when the player presses the arrow keys, move ...
2
votes
1answer
1k views

Loading textures with SharpDX in Metro

I have converted my C# game from OpenTK (OpenGL) to SharpDX (DirectX) and have it up and running from Visual Studio 2010. I also have it up and running from Visual Studio 11 in Metro, in the Windows 8 ...
2
votes
2answers
571 views

How to store “chunks” of tiles or How to make my implementation work

I asked a previous question about the loading and unload of chunk data and people noted that my way of storing chunks is weird and I was wondering how I would go about doing it properly. @Byte56 ...
8
votes
1answer
4k views

Microsoft XNA Platformer Example, is the Collsion Detection implemented accurately?

The example provided by Microsoft seems as if the collision detection (from what I can see) will have a small error. When the user collides with an Unpassable tile, the depth of the intersection is ...
2
votes
5answers
4k views

How to make something rotate a certain amount over an exact amount of time

I'm trying to make a plane rotate down a certain amount and 180 degrees horizontally over 2 seconds. Basically I want it to take the plane 1 second to rotate to a horizontal-facing angle, then take ...
2
votes
3answers
1k views

Tutorials for Managed DirectX development? [closed]

Are there any good tutorials, for someone new to DirectX development? I'd like to use the SharpDX library in a project, but am completely new to this sort of graphics programming. I'm looking for a ...
2
votes
2answers
3k views

Loading and unloading “chunks” of tiles in a 2d tile engine with 2d camera

I am making a 2d tile based game in C# and XNA 4.0. I am having trouble loading and unloading "chunks" of tiles(blocks). The whole world is randomly generated and is infinate on both axis. How would I ...
2
votes
2answers
2k views

C# Console Snake Game, sort of fps problem

I have about 200 lines of code, really simple oop. When I load the console game (snake), I don't see it running smooth, like fps problems in in games, but I don't understand why, because my files are ...
1
vote
3answers
2k views

3D XNA Tracking Camera

I'm trying to implement a camera that tracks a 3D model in my game. I've taken a look at this MSDN article on creating a 3rd person camera, as well as experimenting on my own; but I don't get the ...
5
votes
1answer
559 views

XNA Vertex buffer/Index buffer high memory usage?

I've got about 120mb of vertex and indices data, but when I set the data in the vertex and indices buffer it ramps up to about 300mb of memory used, this isn't really acceptable and I don't know why ...
1
vote
2answers
930 views

Transformation order when dealing with Meshes

I have created a player model out of primitive types. To do this I have created a Model class and Component (mesh) class. Each model consists of one or more components my problems start when you have ...
9
votes
2answers
15k views

C# creating a simple snake game

I was thinking about creating a snake game with C#, so I ran ideas in my head, and some problems came up. How can I track and output in the correct location the blocks that run after the snake's ...
0
votes
1answer
323 views

flicker when drawing 4 models for the first time

i have some models that i only draw at a certain moment in the game (after some seconds since the game has started). The problem is that in that first second when i start to draw the models, i see a ...
2
votes
1answer
350 views

Implementing IVertexType Interface

In XNA, I have created a new VertexType, called it VertexPositionTextureLight which inherts the IVertexType Interface, but apparently I need to implement the member of VertexDeclartion which I cleary ...
5
votes
1answer
309 views

Is it possible to reuse the same window in multiple games?

In particular, I'm thinking about C# and XNA, and obviously on Windows. Let's say I have the main game which is a normal XNA game, but at some point I would like to momentarily switch to a mini-game ...
5
votes
4answers
4k views

How to clip cut-off text in a textbox?

I'm writing a textbox class for my XNA game and I'm using SpriteFont to draw the text. It's only a single line textbox so when the text width exceeds the size of the rectangle box, it currently just ...
3
votes
1answer
3k views

Why isn't my sprite being drawn in the correct position in XNA?

Sorry if this has been asked before, but I can't seem to find it here. I'm trying to make an asteroids clone in XNA. I took the Game State Management project and am making new classes for things like ...
1
vote
4answers
455 views

Bad to learn XNA without an amazing foundation on C#? [closed]

I've been going though Head First C#, and enjoying it's style of teaching. But I'm into this as a hobby for now, and I'm itching to learn more about games, so I've been diving into Learning XNA 4.0 as ...
-1
votes
1answer
1k views

3D Procedural Planet Generation - Resource [closed]

I don't know if the question fits on this site (if it doesn't I'll gladly accept any invitation to move it elsewhere), anyhow, I have found this Really great resource on 3D Procedural Planet ...
0
votes
1answer
472 views

XNA Sprites Not Drawing Correctly

I have a problem through out my current code where certain Texture2D's are not drawing correctly over each other. For example, at the start I have sprite font being drawn over a background image and ...
1
vote
3answers
841 views

How to integrate game logic in game engines

Recently I'm working on a 2d game engine example in .Net with C#. My main problem is that I can't figure out how I should include the game logic within the game. Currently I have a base engine which ...
3
votes
1answer
626 views

Calculating torque required to turn an object to a target rotation, depending on timestep

The function below works fine, when the timesteps of the physicsengine are short enough for the function to update often. It determinates when the ship(the object) needs to start decelerating to reach ...
3
votes
3answers
2k views

How to access SpriteBatch, Input, and ContentManager from all game screens?

I'm trying to make a Game State Manager and I'm using the Microsoft Game State Management Sample as guidance. However, I want a more simplistic design (no transitions, reflection, or support for ...
4
votes
2answers
2k views

Performance/architectural implications of calling SpriteBatch.Begin/End in many different places?

I notice some code samples only call SpriteBatch.Begin and SpriteBatch.End in the game's main draw method and then draw everything within that method through direct SpriteBatch.Draw calls or indirect ...
1
vote
0answers
165 views

Farseer Physics EndContact events don't fire for all registered delegates

Here's my situation: I have several objects that contain a body and a fixture. They are set to sensor = true; atmosphere = BodyFactory.CreateCircle(world, atmosphereRadius / Level.METER_IN_PIXELS, ...
1
vote
1answer
554 views

Xna rotate around world axis?

I want to make it so that either the pitch yaw or roll rotates around the world axis and not the local axis, but I'm not sure how, I've got. Vector2 mouse_change = new Vector2(mouse_previous.X - ...
1
vote
1answer
4k views

Looking at the mouse position in a top down Unity game?

I'm trying to make a simple top down game where the player looks at wherever the mouse is pointed. The player is only going to rotate on the Y axis. Here's what I have so far but I can't seem to get ...
3
votes
5answers
1k views

C#/XNA multiplayer TCG game inside a browser possibe?

I wish to try and create a TCG using C#/XNA that would run inside a web browser. Some of the main game's features would be: At least 2.5D to imitate the card flipping/shuffling and etc. effects ...
3
votes
3answers
846 views

How to refactor and improve this XNA mouse input code?

Currently I have something like this: public bool IsLeftMouseButtonDown() { return currentMouseState.LeftButton == ButtonState.Pressed && previousMouseSate.LeftButton == ...
1
vote
1answer
342 views

How to prevent 2D camera rotation if it would violate the bounds of the camera?

I'm working on a Camera class and I have a rectangle field named Bounds that determines the bounds of the camera. I have it working for zooming and moving the camera so that the camera cannot exit its ...
2
votes
1answer
696 views

Building different game objects (EG Spells, Items,) for an rpg game

I believe the best way to manage item data would be to use xml? For spells would the best option be to create a class (EG Fireball) and define all of the parameters inside of that class? Like ...
0
votes
1answer
124 views

InvalidCastException in Farseer's raycasting when trying to use the built-in explosion class?

I'm trying to create an explosion at the point that two entities collide, but whenever explosion.Activate() is called, it causes an InvalidCastException to be thrown in Raycast(), on the line that ...
1
vote
1answer
1k views

SpriteBatch Draw Using Floats with the Destination Rectangle

So I created a nice little isometric tile engine and I have it so that when you scroll with the mouse it changes a variable called scale. Scale is a float and gets passed through the ...
3
votes
1answer
335 views

Should the camera's rotation value be clamped?

I noticed that when writing a camera for my 2D game that the camera rotational value of -6 and 6 is equivalent to 0. That is, -6 = -12 = -18 = -24 = 6 = 12 = 18 = 24. I was wondering if it was ...
-1
votes
3answers
3k views

3D Procedural Planet Generation [closed]

I was looking for some inspration for my Voxel based game I am writting and came across this: http://www.youtube.com/watch?v=rL8zDgTlXso. I would like to know how to go about (or preferably source ...
2
votes
1answer
317 views

delay camera xna

I read this tutorial http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series2/Camera_delay.php but i didnot unsterstand it. Is there another way to delay the camera position movement without this ...
1
vote
2answers
385 views

XNA 4.0 problem Initializing Instanced Classes in for loop

Okay so this is kind of weird, I have some code that creates particle.cs instances public void AddParticle() { for (int i = 0; i < Density; i++) { particle = new ...
1
vote
0answers
228 views

Unusual Farseer Behaviour? [on hold]

My basic implementation of a Farseer world has been behaving very strangely. It seems as though there is a very low maximum velocity, and collisions result in the small spheres involved clipping ...
2
votes
0answers
558 views

Developing user interface [closed]

i am beginner in graphic development and have no experience with it, i only developed always with standard win controls. Now i want to create interface in c# for my sports management simulation game, ...
10
votes
3answers
575 views

Good way to play a sound when something happens? How does this sound?

So I was thinking about how monolithic my classes get a lot of the time. For example, in the Character class's Jump method, one may have a reference to a sound effect object and play that. By itself ...
21
votes
3answers
5k views

How to properly implement message handling in a component based entity system?

I am implementing an entity system variant that has: An Entity class that is little more than an ID that binds components together A bunch of component classes that have no "component logic", only ...
0
votes
1answer
227 views

How to move the camera in XNA only after few moments?

I made the camera position 10 units from an object, but not behind it. I dont want the camera position behind the object right away when it rotates, I want that when I will rotate the object, the ...
11
votes
2answers
1k views

Projective texture and deferred lighting

In my previous question, I asked whether it is possible to do projective texturing with deferred lighting. Now (more than half a year later) I have a problem with my implementation of the same thing. ...
0
votes
1answer
338 views

How to go from Texture2DContent to Texture2D in a content processor?

I'm using reflection to create a manifest of all assets, strongly typed. It's working fine for my own types: I get the type of the asset, if a processor is ran on it I get the output type. Then I ...
18
votes
2answers
3k views

Can I legally sell an XNA game made with Visual C# Express Edition?

I've dowloaded Visual C# Express Edition and when it starts up it says "for evaluation purposes only." What does this mean? Does this mean I have to buy the full version to legally sell my game I ...
10
votes
2answers
1k views

Handling scripted and “native” components in a component-based entity system

I'm currently trying to implement a component-based entity system, where an entity is basically just an ID and some helper methods tying a bunch of components together to form a game object. Some ...
50
votes
1answer
10k views

Using component based entity system practically

Yesterday, I've read a presentation from GDC Canada about Attribute / Behaviour entity system and I think it's pretty great. However, I'm not sure how to use it practially, not just in theory. First ...
2
votes
1answer
276 views

Shader and Custom Vertex Format Errors

I am creating an editor of sorts that allow you to create 3D voxel models. I just got started and have ran into a few errors. Here is what it is producing: I think the problem has to do with the ...
12
votes
3answers
894 views

Biased, conservative random walk

I have a sprite which has Velocity and Position, either stored as Vector2. At each Update cycle, velocity is added to the position. I would like to give the sprite a third vector, Target. New targets ...