Tag Info

New answers tagged

1

Try making your texture 512x512 that could be the issue since your texture is 400x400. XNA error logs state that the texture should be resized to a power of two.


0

Are you sure that Color.White*0.25f is the right way to go? I would have used SpriteBatch.Draw(RENTAR, new Rectangle(0, 0, 800, 600), new color(255,255,255, 64)); I think it's the only way to ensure that you're getting the transparency level in to the draw color.


5

How blend states/ blend modes work A blend state defines how newly rendered fragments should combine with existing pixel data. They define how to mix two values: The Source Color - the color you are trying to render. In your case, this is a grayscale value ranging from white (in the center of the disc) to black (at the border of the disc). The ...


0

Clear both rt's to Transparent before drawing the texture to them. Since you will be explicitly clearing them to Transparent[Black], you should specify: new RenderTarget2D(..., RenderTargetUsage.PreserveContents); to prevent XNA from clearing rt's rendertarget (to not Transparent[Black]) when you set the current rendertarget to NULL. When you draw them ...


0

Ah, then I may be confused on game structure with XNA... If loadcontent and initilize in the main game class can only be called once, They are called once per device creation not per game start. If you re-size the underlying Windows window, the device is, and all content should be, explicitly destroyed. then do I call my other classes loadcontent ...


1

Why not draw a semi-transparent black sprite in between the background and the yes and no buttons? For example something like this: If you had a scene that looked like this: Then you could simply draw the semitransparent mask on top and have it look like this: Then all you'd have to do is draw the buttons on top of the mask while the rest of the ...


0

In general, please refer to Reimer's for everything XNA. Stencil texture: To avoid duplicating, here's a link to the specific tutorial regarding render targets. Stencil buffer: You intend on using an off-screen rendertarget as a stencil; why not use the stencil, instead? With the stencil active and always incrementing, draw the shadows, but don't output a ...


0

This is very late, but just use the TriangleMesh class. In the future, I highly recommend the BEPU Forums for questions like this.


0

float4 color = tex2D(s0, coords); float4 land_color = tex2D(land_sample, coords); You are sampling the "world" using the SpriteBatch quad's UV's. The blue UV's are used to sample the color-texture; the yellows are used to sample the world-texture. A Draw() parameter and/or the camera matrix is inverting the Y-axis, so it is using the bottom corner as (0,0) ...


0

This method will save you some resources create a sphere for your planet with a small height map, make your texture 2.5k for compact pixels add sphere with transparency + weather around the planet. that is the best way to fudge planets for games just ask bungie


2

The way Google does it The way Google Maps does it, is indeed by having multiple levels of detail. Moving through these levels, tiles will get smaller and smaller. Fitting a 2k texture on a tile that contains a full continent, will give you less detail than fitting a 2k texture on a tile that contains a small neighbourhood with only a few roads. It is ...


1

If you want to space game where you can get close to the planets you actually need to model the planets in a significant more realistic fashion, just using one humongous texture is not going to cut it. Now it really depends on the level of fidelity on what you want to do. But the problem with the scale of planets, when they fill your almost your entire ...


2

(removing the sides of the cube does not count) Sorry dude, that is what you have to do if you want this to be efficient and work every time. The reason you're getting those lines is slight depth buffer inconsistencies (also known as z-fighting). The sides of the blocks are almost at exactly the same depth as the tops of the nearer blocks. Ideally, in ...


1

I've already answered a similar question, with identical goals, over on Stack Overflow I'll repost it here for convinience: (NB - all code is written and tested in Java) This image shows the top left corner of a hexagonal grid and overlaid is a blue square grid. It is easy to find which of the squares a point is inside and this would give a rough ...


0

for anyone else wondering how to do this. Try this: http://www.david-gouveia.com/portfolio/limiting-2d-camera-movement-with-zoom/


0

There are a lot of ways to move something between two points. Want it to go in a straight line at a constant velocity? Then you might want to consider simple linear interpolation. // Gives you a value that linearly interpolates between the start and end. // t is an interpolation parameter between 0 and 1. When t = 0, the position is // at the stat. When t = ...


1

Where could I find good HLSL tutorials? Reimer's Two ways off the top of my head: Light volume After rendering, switch to a flashlight shader and draw a cone (some triangles), with the tip located at the camera's position and the circular base pointing in the camera's forward direction, with arbitrary dimensions. You literally render a cone containing ...


0

position += velocity * DeltaTime * speed; This is a better way of calculating the position. this way your movement wont slow down on framerate drops, because you take into account the time elapsed between the last Update call, if it was longer than usual (low fps) you move more distance. The code you have simply keeps increasing the position and never ...


1

As the variable name suggests, its finding the row where the image for "currentFrame". int row = (int)((float)currentFrame / (float)Columns); If you have 4x4 images, so 4 in row and 4 in columns. Then you are animating your image and going through frames. Well, frame 1 is easy to find, since it's the first, so row = 0 and column = 0. But if you are in ...


3

Creating threads is expensive. If you’re going to perform animation processing each frame, it’s better to keep the thread around. Something like this: void UpdateAnimationWorker() { for (;;) { WaitForTrigger(); // waits for Draw() to signal us if (ShouldExit()) break; foreach (var model in AllGameModels) ...


1

Your point ① is almost correct. This is indeed a bug, but your fix is buggy, too. When f1 != 0 and f2 == 0 you’re going to set X = 0 and your eigenvector will be zero. Here is the proper fix, much simpler: // recalculate y to make equation work if( f2 != 0.0 ) vTmp = XMVectorSetY( vTmp, ( FLOAT )( -f1 / f2 ) ); Your point ② is correct. This is a bug ...


0

You shouldn't be trying to ensure that all your updates happen after X milliseconds - the existing game loop does that already. Instead, what you should be doing is applying delta time correction to your updates to ensure your updates, no matter how frequent or infrequent, regular or irregular, all happen at the same rate. An example is as follows, and is ...


0

Having the ship stats in an external file would likely be a lot easier to maintain. You can modify values without having to recompile your game binary When you are working in a team with non-programmers, these can be taught how to edit these files on their own and contribute to the game balancing. It might even enable them to add and remove ships without ...


0

Since this is a top down shooter, and you have the basic shooting done, here is a 5 minute piece of (untested) incomplete code that allows for the creation of bullets at different angles. public class Bullet { protected Texture2D texture; protected Vector2 position; protected Vector2 angularVelocity; /// <summary> /// Defines a ...


0

Here's the simplest math function for velocity based objects utilizing parametrics. x += cos(theta); y += sin(theta); The end. It's really quite simple because speed is a scalar, but we want speed and direction, in essence, a vector -VELOCITY, thus we end up splitting our speed vector into x and y components as needed by a dimensional object. You can ...


0

I have answered this before, not that difficult, although this method is only as accurate in relation to how many points, perfect accuracy is when the number of points you use reaches infinity. have a vector that is the flying bullet, it starts at exit of muzzle with a direction and speed. have a vector of gravity, a vector of air resistance. have a force ...


-1

Incidentally, if you use MonoGame 3.3, you can just add a new SpriteFont to the MonoGame Pipeline and it works automatically :)


0

To close this up. As far as I know this is not possible. I solved it by using a different texture to store this information.


1

The following worked for Monogame. You can copy the .dlls to your game folder (the content folder is probably a better choice), then reference them and delete the old references, like I do below. You can take the exact same logic and apply it for Microsoft.Xna.Framework.dll, and every other Xna related .dll you are referencing. For Xna, all the .dlls are in ...


0

Forgive me if I'm wrong, but this might be because you have them listed out of order in the spritebatch.Draw() section. XNA draws images onto the screen from top to bottom, meaning that the images you have further down the drawing list, the higher up they'll appear in the game. So, your Player.draw() method does the same thing, so if that's your problem ...


1

I avoid Euler angles in aircraft pitch, roll, yaw orientations because aircraft rotate about thier local axis and trying to resolve this to Euler angles about the world (or global) axis adds uneccesary complication to the code. Instead of 3 Euler angles, I store the current orientation as a matrix or quat and simply modify the matrix/quat depending on input ...


2

You don't want to turn off depth stencil state. Leave that the way it was before. Giving the Problem a Name The problem you're having is that two objects are being drawn in almost identical locations, but because of floating point precision errors, at the different pixels, sometimes one turns out to be barely closer to the camera/eye than the other, and on ...


0

Occlusion query.... http://blogs.msdn.com/b/shawnhar/archive/2008/12/31/pixel-perfect-collision-detection-using-gpu-occlusion-queries.aspx It is described well enough there.


3

I found out that the Content.mcgb is actually a little GUI helper and you can generate and easily load a .spritefont file with it. Steps: 1.Load the GUI app by double clicking the "Content.mcgb" file in the "Content" folder 2.Go to Edit -> New Item... -> Choose SpriteFont and give it a name -> Hit "Ok" 3.Go to Build -> Build (or hit F6) - You should get ...


1

You're using vector3.up, vector3.forward and vector3.right to calculate the needed rotations. These axes don't move along with your plane. What you need to do is rotate the plane around its very own up, forward and right vectors. You could do that like this: Matrix rotMat = Matrix.CreateFromQuaternion(model_ROTATION); Quaternion additionalRotation = ...



Top 50 recent answers are included