Tagged Questions

XNA is a game framework by Microsoft that allows deployment for Xbox Live Indie Games as well as Windows Phone 7.

learn more… | top users | synonyms

2
votes
1answer
82 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 ...
1
vote
1answer
26 views

XNA - DrawIndexedPrimitives or DrawUserIndexedPrimitives?

When rendering primitives in XNA, does it matter if I use DrawIndexedPrimitives() versus DrawUserIndexedPrimitives()? RB Whitaker uses the former, while Reimer's uses the latter. From what I can ...
0
votes
1answer
39 views

Mouse state not acting as I intend it to

I am creating an inventory system. I have it working well, but for some reason when I pick up an item from a slot(lets say slot 2 of 20) and drop it into that same slot(slot 2) the mouse state fails ...
0
votes
0answers
43 views

HLSL - Binary operations

I'm trying to do binary operations with integers in the hlsl code. For example: int n = 10 & 15; Binary value of 10 = 1010 and Binary value of 15 = 1111. With this, n = 10, because (1010 & ...
1
vote
1answer
111 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
1answer
108 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 ...
1
vote
1answer
54 views

RenderTarget2D moves with scene

I encountered a strange RenderTarget issue, in XNA/Monogame. I am currently updating my render target at every frame, just to test to see what is happening. When I move the camera around, the ...
1
vote
1answer
115 views

Is it Possible to create one equipment piece, and handle the manipulation programatically

I have a 2D game made in XNA-4.0. I am brainstorming on how to implement a system of equipment where I can draw one Texture, and rotate/scale it to my character's current animation without haveing to ...
0
votes
0answers
30 views

HLSL Shader Relative Positioning

I've got a shader that does the texturing, lighting, etc. for my game engine (written on top of MonoGame, in case that's relevant) for my block-terrain-based game (everything is rendered as triangles ...
1
vote
1answer
48 views

How to deform 2D tileable texture in XNA/MonoGame

I'm looking for a way to deform tillable texture in a 2D game I'm building using MonoGame but I'm not sure how this effect is called and searching the internet for "deforming textures" gives me mostly ...
1
vote
3answers
77 views

Handle many objects to draw in XNA

in my 2D engine - using XNA 4.0 - I´ve an issue with handling many objects. The way my engine works is that I only draw visible sprites (base objects) and ignore those sprites out of the current ...
0
votes
1answer
34 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
165 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 ...
2
votes
1answer
120 views

XNA/MonoGame/SharpDX: Pixel shader with sprite sheet

I've searched around for two days now on the internet but cannot find a solution. I've also read up on Pixel Shaders on MSDN with no luck. I'm trying to apply a simple pixel shader to a sprite batch ...
1
vote
0answers
31 views

XNA: Working with primitives and tessellation [closed]

I was working with primitives in XNA (since I have limited knowledge with 3D and modelling), and I have 3 similar questions below: Question 1 I was reading up on terrain tessellation in an article ...
1
vote
0answers
28 views

Export into several files with custom XNA content pipeline?

In order to implement a basic Ubershader (a shader which is compiled numerous times with different directives (defines)) I wrote a custom shader processor in XNA. My processor outputs a dictionarry ...
2
votes
2answers
226 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
1answer
46 views

Trying to implement bounding box collision

I've been trying to do collision detection using the Intersects() function with two rectangles. I've got a player and multiple enemy's. When the player intersects with an enemy a bool var is set to ...
1
vote
1answer
109 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
278 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 ...
0
votes
1answer
42 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 ...
1
vote
1answer
91 views

MonoGame SharpDX Error 'The Parameter is Incorrect' when using graphics.DrawUserPrimitives [closed]

Below is a small section of code that is meant to draw a multicolored triangle to the middle of the screen in a MonoGame game. This uses the basic function DrawUserPrimitives to draw the triangle. ...
0
votes
0answers
38 views

Speeding up Recursive Quad-Tree iteration

I've got a problem in regards of runtime speed in XNA. I've built up a Quad-Tree where each node stores the 3 positions of a triangle, which forms a Icosahedron and its subdivided triangles. My aim is ...
3
votes
3answers
67 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 ...
0
votes
1answer
67 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
0answers
99 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 ...
0
votes
0answers
76 views

2D Vector Graphics in XNA

I'm here today to ask about Vector graphics in XNA, my first question being whether it is possible or not. The only other question on here that I have seen in relation to this is simply asking which ...
1
vote
3answers
119 views

Is this way of making an XNA game window borderless safe to use for various Windows PCs?

I have found a way to simply make an XNA 4.0 game's window borderless. Here is the code from the article: IntPtr hWnd = this.Window.Handle; var control = System.Windows.Forms.Control.FromHandle( hWnd ...
0
votes
2answers
72 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
1answer
126 views

How can I simulate a magnet that attracts a ball in a 2D enviroment?

I am making a top-down game where you have to move a ball from point A to point B. You are attracting the ball using magnets that are standing still. The ball needs to get pulled by multiple magnets. ...
0
votes
2answers
107 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 ...
0
votes
1answer
52 views

Creating refraction map problem

I'm reading riemers tutorial on how to make a water effect and trying to translate it from xna 3 to xna 4. So far I figured out I have to create a shader in order to clip the planes for my refraction ...
2
votes
2answers
91 views

Multi-colored text and kerning

Drawing multi-colored text or highlighted text in XNA/MonoGame is pretty annoying, and the standard way I've seen to do it is to just to make multiple SpriteBatch.DrawString calls, and place them ...
0
votes
2answers
82 views

Vertical Collision Detection, Falling Through Ground

After much work trying to learn collision system theory and apply it, I've got my collision system working for the most part. The player can collide horizontally with no issue, sliding against walls, ...
1
vote
1answer
77 views

Inventory management syncronized network

I'm implementing an inventory system with items in 1x1 slots in a open-world multiplayer game. But I can't decide how I want to synchronize the item management with the server. I see two options here. ...
1
vote
1answer
98 views

Why are my sprite outlines partially rendering in the wrong place?

I've been trying to draw an outline around a sprite using the code from this answer. Details My sprite is called Ship2Sprite. This is how I create the rectangle: rectangle = New ...
4
votes
1answer
118 views

How do I letterbox a C#/Monogame viewport within a resizeable window?

I am making a 2d game with xna/monogame. I want the main view area to always show 15x15 tiles, or 480x480px. I've got something that sort of works, following this guide. It expands the view range ...
0
votes
1answer
132 views

Multiple tile drawing in monogame is slow

So I have this drawing function (which is by the way recomended as an solution here). It draws tiles on the whole window with no problem but my game slows down to ~30fps after maximizing it to ...
0
votes
0answers
24 views

Wall Collision on a model

I am building a model of a house in XNA and made a collision system so that when the player goes into the wall they stop. Also I made it so if the player is pressing the key 'up' and collides into the ...
0
votes
2answers
54 views

Performance Difference Between Content.Load and Texture.FromStream xna

Is there any performance difference between Texture2Ds loaded using the content pipeline and Texture2Ds loaded using Texture2D.FromStream()?
2
votes
1answer
69 views

Wall-sliding Collision Response Only Works On One Axis (2D)

"sprite" is the player object, velocity is a Vec2 that tracks movement (is set to -1, 1, or 0 at any given time), each sprite in "sprites" is a wall of the same size as the player (everyone is a block ...
1
vote
3answers
115 views

Get highest (Y-axis) vertices from primitive d20 dice in xna

I have created a d20 dice (icosahedron) in xna and used BEPU physics to roll it. But now I'm trying to get the value from the dice after its rolled. I was thinking about looking for the 3 vertices ...
3
votes
4answers
262 views

RPG like hit points growth algorithms help

I am currently making an XNA game in C#. I want to increase health as the player level up. I am currently using this equation. MaxHealth = Convert.ToInt32(100 * Math.Pow(1.17, level - 1)); Its ...
0
votes
1answer
57 views

How does Texture2D.GetData return coloured pixels?

I'm trying to work out how the pixels are stored in the returned array but I'm not having a lot of luck (and thus my calculations don't seem to be working). I realize that the pixels are stored in ...
0
votes
1answer
61 views

XNA: Camera's Rotation and Translation matrices seem to interfere with each other

I've been following the guide here for how to create a custom 2D camera in XNA. It works great, I've implemented it before, but for some reason, the matrix math is throwing me off. public sealed ...
0
votes
0answers
25 views

XNA `tex2Dlod` always returns transparent black

I want to sample a texture in a vertex shader, so at first I just tried using float2 texcoords = ...; color = tex2D(texture, texcoords); But apparently I cannot use tex2D in a vertex shader, and ...
0
votes
1answer
97 views

How do you create a .XNB Font file for use with CocosSharp?

I know the .XNB file format is an XNA thing and that CocosSharp inherits this from its MonoGame roots. However there doesn't seem to be any information on how to create your own .XNB fonts to use with ...
1
vote
2answers
119 views

XNA How to change the sprite texture to white color

as the title, how can i do to take the sprite to white color here is some example, turn to follows image and my game planform is XNA now, and developed winphone game thanks for reading!
0
votes
2answers
46 views

Collision detection problem in XNA

I'm having two problems with my collision detection in XNA. There are two boxes, the red box represents a player and the blue box represents a wall. The first problem is when the player moves to the ...
1
vote
1answer
60 views

how to define a field of view for the entire map for shadow?

I recently added "Shadow Mapping" in my XNA games to include shadows. I followed the nice and famous tutorial from "Riemers" : http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series3/Shadow_map.php . ...