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

1
vote
1answer
86 views

Ambient occlusion of cubes, a specific case

After much fiddling around and thinking I've got my AO working on my game engine as intended; except one specific case. When a block is nestled between others on two sides, but the corner block is ...
2
votes
1answer
180 views

How do I call OpenGL methods that require pointers in C#?

I have found the following C++ code in this tutorial to draw a triangle with OpenGL 4: float points[] = { 0.0f, 0.5f, 0.0f, 0.5f, -0.5f, 0.0f, -0.5f, -0.5f, 0.0f }; GLuint vbo = 0; ...
1
vote
1answer
101 views

How to draw a diagonal fade-in and fade-out?

How to draw a diagonal fade-in/fade-out in 2D using MonoGame draw API? For a simple (non-directional) fade-in/out drawing the background with alpha variation do the tricks, but what is the standard ...
0
votes
1answer
50 views

Combination Keypad in Unity

Im having a slight problem in getting my Combination keypad to work. Ok so basically I'm using gameObject buttons to use for the numbers 0-9. So each gameObject button has a number link to it. The ...
1
vote
1answer
131 views

Opentk LookAt() and 'eye' argument rotating

I'm trying to create rotating camera, which looks down by 45 deegre like this: However my code for rotating eye vector is not working properly and I achieve vertical rotation, when it should be ...
2
votes
1answer
86 views

Is it bad practice to add GameComponents and DrawableGameComponents outside of the main initialization method?

I'm working on a snake game that has multiple game objects (snakes, apples, obstacles), and game modes (classic, adventure), that are DrawableGameComponents. Is it OK that I'm adding them as needed ...
0
votes
0answers
226 views

Calling an android method from Unity3D with a JAR plugin

I am developing a game with Unity only for Android platform and I am requiring to share content of my game through an intent so I have implemented a JAR plugin according to several tutorials with this ...
1
vote
0answers
74 views

Dynamic Level Loads [ Story Saves ] [closed]

I have recently revisited the legend of zelda series and got inspired by it to create a game similar to majora's mask. After some slight work on the player movement and key game mechanics I started to ...
1
vote
1answer
126 views

In a TPS, how to aim bullets to the direction the camera is pointing, but make the shooting from the player?

(In C#/XNA.) I mean, I can't find an answer nowhere. I'm trying to learn how to make a Third Person Shooter, especially like the one I found in a game called "M.A.R.S.", from Epic Games. I don't want ...
1
vote
2answers
217 views

How should I store edge weights in my A* graph in C#?

I am working on A* pathfinding in Unity, using C#. I am currently implementing Dijkstra's shortest path algorithm. I have a Dictionary with nodes as keys and corresponding lists of adjacent neighbors ...
1
vote
1answer
110 views

Downsides of using this integration formula for movement?

So I read that Gaffron integration basics tutorial and noticed how the Euler integration method gives a small error over time. I implemented the RK4 and noticed that with constant acceleration, I ...
0
votes
2answers
120 views

Destroy GameObject as an Array of Transform instantiated destroying the whole array

I am trying to destroy a GameObject with the Destroy() method, but when I call it the whole array is destroyed, not just that element. //Instantiating the prefabs public Transform[] blue; foreach ...
0
votes
1answer
128 views

Tiling 2D textures in random order

I am wondering what the best way to make a random set of 2D textures. Currently I have tried the follow code but I am aware that when this comes to collisions that would be an issue. Therefore I would ...
2
votes
1answer
404 views

Sending POST data with WWW in Unity C#

I would like to use Unity's WWW class to send a an HTTP request with POST data. So in my server, my PHP script can do something like $number = $_POST["NUMBER"]; According to ...
1
vote
1answer
90 views

Collision detection across multiple components

I have been reading this article: http://gameprogrammingpatterns.com/component.html which describes how a game object should be constructed out of components. It also encourages the decoupling of ...
0
votes
1answer
48 views

XNA tiling a sprite with a camera.viewmatrix in the Draw method

I'm looking for help fixing a small problem that I have with my XNA game project. I currently have: spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, ...
2
votes
2answers
187 views

How can I combine chasing and obstacle-avoidance in a steering-based AI?

I'm developing a top-down game in XNA with enemies that wander until they are within range of a player, at which point they begin chasing the player. This works, but I also want them to avoid ...
3
votes
1answer
79 views

How do I edit a Texture2D at run-time to visually indicate connected tiles?

I'm making a 2D sandbox game in C# and MonoGame, and I have a couple of tile sprites. These tile are loaded in-game as Texture2Ds. I want to have blocks visually connect to adjacent blocks. An ...
2
votes
1answer
91 views

Lidgren peer to peer

I am currently integrating Lidgren into my Unity game. I need to move away from the built in networking capability in Unity because of the style of game I am making, basically MMO, I will have far too ...
3
votes
1answer
102 views

Deploying MonoGame on Android

I've developed a game using MonoGame for Android (with Xamarin). When deploying to my Android device (via the Xamarin Studio IDE) it installs 3 apps - Monogame-Android-8-support, ...
0
votes
2answers
43 views

Can you save a png in XNA larger than the backbuffer width?

I'm looking at using the 'savetopng' method of the texture2D class to draw out custom textures. My problem is that my viewport is quite small (the application runs in a window) and the textures will ...
0
votes
0answers
70 views

Very strange trigger behavior in Unity2D (4.5)

I am developing 2d platformer and I've faced with a very strange triggers behaviour in Unity. I have made the enemy that can throw objects into main player. So I have made two empty GameObjects with ...
2
votes
2answers
233 views

Processing periodical operations on the database [duplicate]

I program MMO strategy game (C# monogame) like Goodgame Empire or Travian for Windows Phone. The server part of the game will run on Windows Server and MS SQL database. I'm trying to figure out a ...
1
vote
2answers
113 views

Trying to better understand Unity gameobjects

New to Unity, but develop in C# normally. I can't seem to get how / why / where to grab certain elements. For simplicity, I have a top-level game object, say a cube. I add a sphere to the scene as ...
1
vote
1answer
115 views

Voxel engine/vertexes: how to add more and more different textures during game runtime and change some of the blocks' faces?

It's difficult to ask this, but I'll try. The thing is: I asked before somethings about creating ramps and blocks with vertexes. [I'm using C#/XNA.] Explanation: now I got a chunk that has blocks ...
2
votes
1answer
288 views

Handling game-state updates in an MMO while the player is logged out

I have a plan to build MMO strategy game like Goodgame Empire or Travian for windows phone. I want program it in C# Monogame (because I have some good experiance with it). But I still can't figure ...
-1
votes
1answer
57 views

Finding and reading a script on a mouse-selected GameObject

I can't work out how to access and read changes in a script of a gameObject that has been selected. The script selects enemy objects with right mouse button and player objects with left mouse button. ...
3
votes
1answer
75 views

Colision detection of disc (Maximum Material Condition aka “Flatness”)

I have a 3D-laser scanner which gives me a series of points of a real-world object. The points are related by a common origin. I know I can derive the equation of a plane from 3 points and that the ...
0
votes
3answers
171 views

How do game servers / clients handle data?

How do servers handle data? I understand the concept of the client sending the player pos and then the server sending back the area to display and also sending other player positions and such. But ...
0
votes
1answer
43 views

Tilemap collision problem [closed]

I have a method here that returns true if a collision is detected between the player and tile. private bool CheckCollision() { foreach (CollisionTile tile in ...
3
votes
3answers
86 views

Can you offset the horizontal flip in SpriteEffects XNA?

As the title suggests I need to know if there is a way to offset the SpriteEffects.FlipHorizontally component in the XNA draw method. My reason for this is the sprite I am attempting to flip is not ...
-1
votes
2answers
69 views

Speeding up sprite the second time it passes the screen [closed]

I'm a student studying Games Development. I want a sprite to speed up on it's second passing of the screen. How do I do this? Code I wrote so far: public class Game1 : Microsoft.Xna.Framework.Game { ...
0
votes
1answer
76 views

C# XNA Rectangle.Contains returns false? [closed]

I am creating a simple XNA game. My mainMenu class contains a list of strings for menu options wich I draw on the scren using spriteBatch.DrawString. I've set Vector2 variables to controll the ...
1
vote
1answer
220 views

How do I add a border to rectangles using a shader?

I want to draw some rectangles with a border. Currently I render the fill with glDrawArrays(Triangles, ...) and the border with glDrawArrays(LineLoop, ...). Is there a neater way? I'm targeting ...
1
vote
2answers
73 views

Vertex Skinning Looks Messy on Real Android Device using Monodroid

I have no problem doing the "vertex skinning" for three-dimensional animation. All goes well when using the emulator (and genymotion). However, when run on a real device (such as Samsung and Lenovo) ...
0
votes
1answer
169 views

Moving gameobject with animation according to my script Unity3D

I am developing a game with Unity3D with an horizontal list of elements which you can move with arrows. Here you can see an example: I have created animations in order to modify the alpha value of ...
0
votes
1answer
82 views

How can I make an object change direction?

I have a moving cube that, when it moves over an arrow, should change its direction to the direction of that arrow. What would I need to do in order to accomplish this?
0
votes
0answers
97 views

Unity - 2D - Scaling to fit between two objects

The game is a top down 2d shooter and I'm facing trouble in doing this : - I got a player 2D ship - The player fires laser, which is a long thin image with box collider attached. - What I want is that ...
1
vote
0answers
100 views

Collision detection implementation suggestions

I'm working on a simple 2D game involving a rotating octagonal ring where a sphere sprite moves up/down avoiding objects as the ring rotates faster and faster. I'm having a difficult time with the ...
2
votes
3answers
131 views

Steering behavior using nodes

I've started rewriting some of my code (npcs, navigation and such) and I need some help with my new navigation system. Basically the way it works is: the game generates a random dungeon. For example: ...
0
votes
2answers
103 views

animation control problem

I have a list of .FBX object.When I drag that .FBX into scene its corresponding inspector Animation component(fig 1) appears but when I drag some other .FBX object into the scene the Animator ...
2
votes
0answers
94 views

Enable IME in a non-windows control

I'm writing my own game in DirectX using C#. I'm at the point where I'm implementing my own textbox, written from scratch. It has the very basic functions for now, but works well. I want, however, to ...
0
votes
1answer
58 views

Shared Material

I have this simple script, so the user touch one of the cubes all cubes with same material will change color. One of this cubes must have the name of the color on it, only one, so the user touch the ...
1
vote
2answers
140 views

control animation using animator control class

I did a sample existing code to control animation using animation.I dragged and dropped a character into the scene then I added a Animator to it and added the animator controller.Below I have given ...
0
votes
1answer
394 views

Getting a pixel of Sprite at the cursor position in Unity

Summary: I've been trying to figure out a way to use simple box colliders as a nice and efficient "first pass" collider. For the "second pass", I want to check that the area clicked has an alpha value ...
0
votes
2answers
250 views

Water Physics In top down 2D game

I have been making a game like Minecraft or Terraria in which you add blocks and such to the world, and I came across this interesting debacle, the game is in a top down 2D perspective, and I would ...
0
votes
1answer
100 views

Gun Bobbing Algorithm Math Explanation

I stumbled across this really neat algorithm which I don't fully understand. It simulates a camera's bobbing effect commonly witnessed in first person shooters while running/walking. I'm mainly unsure ...
0
votes
2answers
73 views

HLSL Shadow Mapping occurs only around player

I've recently begun playing around with Monogame (OpenSource "remake" of XNA). My current task is to write a simple shadow mapping shader. After following Riemer's XNA Tutorial I got the shadows to ...
2
votes
3answers
141 views

Persistence of Random

Sorry if this is such a simple thing, but for some reason I can't get my head around it. Imagine you have a world, that you have "seeded" with a value. You base all your randomisations off this ...
0
votes
2answers
114 views

Building a chunk w/ blocks: making ramps. How to detect if blocks are making “stairs” (like in a mountain) and should be turned into ramps?

My question is quite simple, but the answer may be not. I am studying and making a voxel engine, generating block vertices around its center position with TriangleList primitive at C#/XNA. The ...