Skip to main content

Questions tagged [c#]

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

Filter by
Sorted by
Tagged with
79 votes
10 answers
248k views

I have seen several videos and tutorials for creating singleton objects in Unity, mainly for a GameManager, that appear to use different approaches to instantiating ...
Zack Brown's user avatar
70 votes
7 answers
7k views

What pitfalls did you encounter when writing games for the PC with a managed Language like C# and how did you solve them?
Michael Klement's user avatar
66 votes
6 answers
21k views

I came across this question when I was designing a video game in C#. If we consider games such as Battlefield or Call of Duty, hundreds or even thousands of bullets are flying at the same time. ...
Eric's user avatar
  • 783
59 votes
7 answers
10k views

I am about to embark upon a journey into game development. Following answers to my last question, I will be using C# and XNA. However, I don't personally know any other game developers and I don't ...
Ste's user avatar
  • 1,006
59 votes
1 answer
18k views

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 ...
TomsonTom's user avatar
  • 703
58 votes
9 answers
22k views

To make a game like an RTS networked, I've seen a number of answers here suggest to make the game completely deterministic; then you only have to transfer the users' actions to each other, and lag ...
BlueRaja - Danny Pflughoeft's user avatar
52 votes
7 answers
11k views

I have a problem with AABB collision resolution. I resolve AABB intersection by resolving the X axis first, then the Y axis. This is done to prevent this bug: https://i.sstatic.net/NLg4j.png The ...
Vittorio Romeo's user avatar
49 votes
4 answers
18k views

I have been using Unity to create a 2D game which will be completely offline (which is the problem), the game-play needs you to enter certain strings at certain levels and Unity compiles to DLLs, ...
TheBinaryGuy's user avatar
41 votes
3 answers
35k views

When writing a game in C# that uses plain-old Windows Forms and some graphics API wrapper like SlimDX or OpenTK, how should the main game loop be structured? A canonical Windows Forms application has ...
user avatar
39 votes
11 answers
102k views

I'm trying to wrap my head around this very Hello World-y problem in game development. I've created a TicTacToe game in XNA so I guess the next step would be a Breakout clone. Keep in mind that I ...
user avatar
38 votes
1 answer
3k views

I made this SoundAnalyzer class to detect beats in songs: ...
Quincy's user avatar
  • 626
33 votes
4 answers
5k views

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 an update, is that a new ...
Jason94's user avatar
  • 465
33 votes
4 answers
17k views

I'd like to write a game completely in C#. In my search for an engine, I found Unity3D, but all the tutorials and documentation are speaking about a visual editor and the Unity IDE in which you click ...
Ray's user avatar
  • 633
32 votes
3 answers
15k views

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 ...
Onlainas's user avatar
  • 441
31 votes
5 answers
7k views

So I'm making a game where you can send ships to locations to sell or buy resources like wood, iron, gold, etc. Now I was wondering how the resources should be created in de game. I came up with 2 ...
melledijkstra's user avatar
31 votes
5 answers
10k views

I have a 2D grid based water system in my XNA game, we have a method using cellular automata to simulate water falling and spreading. Example of water flowing down a slope: Each tile can contain a ...
Cyral's user avatar
  • 1,039
30 votes
2 answers
73k views

I'm working on a game which requires me to draw a few lines from a single point that is more formally said Given point A with coordinates x,y I draw n lines where the i-th line has the coordinates ...
Christo S. Christov's user avatar
30 votes
6 answers
14k views

I have a 2D platformer that currently can handle chunks with 100 by 100 tiles, with the chunk coordinates are stored as longs, so this is the only limit of maps (maxlong*maxlong). All entity positions ...
Blam's user avatar
  • 403
30 votes
1 answer
19k views

I have two objects (target and player), both have Position (Vector3) and Rotation (Quaternion). I want the target to rotate and be facing right at the player. The target, when it shoots something ...
Marc's user avatar
  • 465
29 votes
1 answer
7k views

I've downloaded a bunch of (free) 3d warriors with animations. I've noticed for about 25% of them, the 'run' animation physically moves the character forward in the z direction. For the other 75%, the ...
ineedahero's user avatar
28 votes
5 answers
34k views

Most of the question is in the title. Basically, I'm starting to develop a 2D multiplayer action game. The client is (probably) going to be in XNA, and I thought I'd ask here about whether it's a ...
Zaky German's user avatar
  • 1,136
27 votes
8 answers
12k views

Some time ago I started working with Unity and I still struggle with the issue of tightly coupled scripts. How can I structure my code to avoid this problem? For example: I want to have health and ...
K.L.'s user avatar
  • 795
26 votes
3 answers
33k views

What's the different between this int randomNumber = UnityEngine.Random.Range(0, 10); and this ...
H. Pauwelyn's user avatar
26 votes
2 answers
54k views

IL2CPP is a Unity-developed scripting back-end which you can use as an alternative to Mono when building projects for some platforms. Note - IL2CPP is only available when building for the following ...
Muhammad Faizan Khan's user avatar
24 votes
7 answers
3k views

I'm building a space exploration game and I've currently started working on gravity ( In C# with XNA). The gravity still needs tweaking, but before I can do that, I need to address some performance ...
Postman's user avatar
  • 415
24 votes
6 answers
23k views

That is, 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 them.
user1306322's user avatar
  • 1,411
24 votes
3 answers
14k views

I am working on generation 3d perlin noise. The C# Math library seems like overkill for what I need since most of its functions use double percision. I use Math.Sin() in several places to generate the ...
user2709's user avatar
  • 243
24 votes
1 answer
6k views

I have read about this pattern several times (from a best-practices perspective): Memory Allocation: Instead of instantiating the new object on the fly, always consider creating and using object ...
Muhammad Faizan Khan's user avatar
23 votes
7 answers
8k views

In industry games I mean like Quake, CoD etc.
Eldar's user avatar
  • 341
23 votes
4 answers
5k views

This question is a "follow-up" question from my previous one, regarding collision detection and resolution, which you can find here. If you don't want to read the previous question, here's ...
Vittorio Romeo's user avatar
23 votes
3 answers
5k views

I have an options screen for things like difficulty, resolution, full-screen, etc., but I'm struggling to find the "best" way to store/obtain these variables at run-time. Currently, I've implemented ...
R-nold's user avatar
  • 341
23 votes
2 answers
10k views

I'm looking for a solution for a "Right Click Options" behaviour. Basically any and every item in a game, when right clicked, can display a set of options based on whatever the object is. Right ...
Mike Hunt's user avatar
  • 341
23 votes
6 answers
9k views

I've been interested in the component based entity system for a while, and read countless articles on it (The Insomiac games, the pretty standard Evolve Your Hierarchy, the T-Machine, Chronoclast ... ...
PrettyPrincessKitty FS's user avatar
21 votes
2 answers
18k views

I have a sprite that I'm trying to scale up in XNA, but XNA is applying some sort of texture filtering that smooths it and makes it look ugly. I'd like it to just do pixel doubling instead of ...
Daniel T.'s user avatar
  • 537
21 votes
4 answers
14k views

I'm searching for a nice and easy way to generate a mask for an island map with C#. Basically I'm using with a random heightmap generated with perlin noise, where the terrain is NOT surrounded by ...
Ace's user avatar
  • 533
20 votes
5 answers
13k views

I have an image that contains a circles at a specific location, and of a specific diameter. What I need to do is to be able to calculate random points within the circle, and then manipulate the pixels ...
DMills's user avatar
  • 303
20 votes
11 answers
5k views

Can anybody guide me about where can I get the basic starter tutorials for developing using XNA framework?
20 votes
7 answers
7k views

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 ...
Maxi's user avatar
  • 259
20 votes
2 answers
3k views

When the player loses all of their lives, I want the entire game screen to go grayscale, but not stop updating immediately. I'd also prefer it fade to grayscale instead of suddenly lose all color. ...
Fibericon's user avatar
  • 657
20 votes
2 answers
3k views

I am in the process of implementing atmospheric scattering of a planets from space. I have been using Sean O'Neil's shaders from http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter16.html as a ...
ollipekka's user avatar
  • 406
19 votes
4 answers
26k views

Does Unity use a different version of C#, or is it all the same? It looks different from regular C# but there are some regular C# elements in there.
kprovost7314's user avatar
19 votes
2 answers
4k views

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 ...
MrSplosion's user avatar
19 votes
2 answers
4k views

I am a software developer, experienced with C# (5 years experience) alongside a few other languages. My "dream job" is working in video games as a developer. Most jobs require knowledge of C++, ...
spaceOwl's user avatar
  • 909
19 votes
2 answers
21k views

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 ...
Pectus Excavatum's user avatar
19 votes
1 answer
28k views

I'm looking for a physics engine to use in an XNA project (2D or 3D). Because it's for XNA, it needs to fulfill some requirements: Not necessarily free, but close to it is obviously preferred Managed ...
19 votes
2 answers
8k views

Before I get to my question, I know the most obvious solution would be to use the normalized view port rect, however I need more complex shapes than a rectangle, and I've looked in to using the view ...
Timothy Williams's user avatar
18 votes
2 answers
9k views

This has never happened to me so I'm a bit confused. GameObject someObject = Instantiate (Resources.Load ("Prefabs/Items/" + someName)) as GameObject; This ...
user4676310's user avatar
18 votes
10 answers
8k views

I recently learned that the MMO Minecraft is powered by Java from a recent interview on CVG.co.uk on a possible collaboration between two former and now competing colleagues. In the interview he ...
user avatar
18 votes
6 answers
134k views

I need a way to detect if animation's clip finished playing and then execute a certain code. Here's some script, that I wrote (called in Update): ...
user79825's user avatar
  • 181
18 votes
5 answers
105k views

Can anybody help me out with giving the steps needed for reading data from the text file in unity and how can the script be added.
user1509674's user avatar

1
2 3 4 5
170