Questions tagged [c#]

C# is a multi-paradigm, managed, strongly typed, garbage-collected, programming language created by Microsoft in conjunction with the .NET platform.

What is C#?

C# is a multi-paradigm, managed, strongly typed, garbage-collected, programming language created by Microsoft in conjunction with the .NET platform; not to be confused with C or C++. C# supports imperative, declarative, functional, generic, object-oriented, component-oriented and meta programming disciplines. C# is also available in non-Microsoft implementations.

Usage

When you ask a question, be sure to include any relevant source code as a minimal, complete, and verifiable example. If there are any compiler errors, be sure to indicate:

  • Which compiler &/or IDE you are using, including its version.
  • Which C# language version you are using.
  • Exact error messages, including the lines on which they occur (mark those lines with comments)

Because Unity has its own tag & uses its own version C#, you do not need to use the tag when asking general Unity questions.

Stack Exchange Resources

8357 questions
13
votes
2 answers

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 head? If the snake is built of five blocks, and the…
Novak
  • 275
  • 1
  • 3
  • 7
10
votes
1 answer

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 "depth" of the collection. But in video games,…
Jupotter
  • 302
  • 1
  • 9
10
votes
1 answer

Enum Vs. Integer for Skill Values

I'm implementing a basic skill and attribute system, though I'm having second thoughts about how I should go about it. For example, I could use a Dictionary/HashMap which uses SkillType enums to represent keys, and integer values representing the…
blissfreak
  • 550
  • 4
  • 15
8
votes
1 answer

Where to start writing games, any tutorials or the like?

I'm actually an industrial systems developer with knowledge of .NET C# and VB.NET, C/C++, Delphi, and an intermediate knowledge of 80286 Intel assembly language. I would be interested to learn how to develop games while taking as fully as possible…
Will Marcouiller
  • 1,357
  • 11
  • 16
8
votes
2 answers

How can I represent rooms and associated actions and inventory in a text-based adventure game?

I am just getting started learning to make games. I have created a simple text-based game where the user can walk around between rooms and interact with the objects in each room. However, I feel like my approach has led to a pile of bad spaghetti…
7
votes
4 answers

How to draw and store a Zelda-like map in custom game engine?

I have a school assignment where I have to draw a 2D map from one of the first zelda games, along with some animated sprites. Now I got the sprites to work, Im having trouble drawing the map. This is what it should look like: This is the TileSet…
S. Neut
  • 105
  • 3
  • 8
5
votes
3 answers

Accessing managers from game entities/components

I'm designing an entity-component engine in C# right now, and all components need to have access to the global event manager, which sends off inter-entity events (every entity also has a local event manager). I'd like to be able to simply call…
jmegaffin
  • 4,923
  • 2
  • 25
  • 46
4
votes
2 answers

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 a lot lighter and demand less resources than…
Novak
  • 275
  • 1
  • 3
  • 7
4
votes
1 answer

WiX installer for XNA 4.0 game?

I'm trying to make a quick installer for my XNA 4.0 game which should be able to install silently. I did some research and figured out that WiX would probably be best for me. I don't like the setup projects inbuilt in Visual Studio 2010, and…
4
votes
1 answer

How should I handle different aspect ratios in a fullscreen game?

I am creating a game using C#, GDI+ and Raster images (2D images). For performance sake, I believe that I should have the game change the user's resolution to 800 x 600 and run the game in that setting. However, the graphics look distorted in a…
CRobinson
  • 41
  • 2
4
votes
1 answer

Creating three-dimensional biomes

I have an idea for a space-based game where there are different sectors of control. These would be set up in a manner similar to terrain biomes, where there will be clusters with limited space between them where there are 'mixed' biomes or even no…
Fixer
  • 41
  • 3
3
votes
1 answer

Handle a canvas in a windows form application

I want to create a level editor, i've started it on XNA but finally it would be better using a WindowsFormApplication. Here is the layout that i want to achieve: BLUE -> Windows form control PURPLE -> Canvas, handled differently (Yeah, Windows…
Riptide
  • 292
  • 1
  • 2
  • 10
3
votes
2 answers

Slow dictionary access with coordinates as keys

I am making a game server and currently I am experiencing a huge performance hit. I have a class Map which holds a Dictionary of the class Tile with each tile having X, Y, and Z coords, some lists, etc. nothing fancy as it's a MMORPG. Currently in…
3
votes
3 answers

Separate "Battle Character" class from "Character" class?

So I have a Class called Character which represents all the player, his companions, and all enemies. This class does a lot of things including performing actions upon other characters, and upon the environment, and so on. I'm about to start work on…
Mason11987
  • 131
  • 2
3
votes
2 answers

Why can't I compare two Texture2D's?

I am trying to use an accessor, as it seems to me that that is the only way to accomplish what I want to do. Here is my code: Game1.cs public class GroundTexture { private Texture2D dirt; public Texture2D Dirt { get { …
Fiona
  • 43
  • 6
1
2 3 4 5 6 7