# Tag Info

20

The attenuation function you've got, att = 1.0 / (1.0 + 0.1*dist + 0.01*dist*dist) is a fairly common one in computer graphics - or, more generally, 1.0 / (1.0 + a*dist + b*dist*dist)) for some tweakable parameters a and b. To understand how this curve works it's helpful to play with the parameters interactively. This curve is nice because it approaches ...

17

There's a number of options: Do as you do. You've already said it doesn't look smooth. There are some flaws with your current method though. For x, you could use the following: tempx += speed * dt while (tempx > 0.5) move sprite to x+1 tempx -= 1 while (tempx < -0.5) move sprite to x-1 tempx += 1 this should be better. I've switched the ...

16

Here's a quick outline, off the top of my head, of an algorithm that ought to work reasonably well. First, calculate the direction the object is moving, and check whether it's closer to horizontal or vertical. If the direction is closer to vertical (horizontal), adjust the position of the object along the direction vector to the center of the nearest pixel ...

16

This article gives some useful explainations, even if that's before 4.3 came out: If you’re going for the “pixel art” look then the camera’s orthographic size is of critical importance; this is the trickiest part of nailing 2D in Unity. The orthographic size expresses how many world units are contained in the top half of the camera projection. ...

15

One way in which many old-skool games solved (or hid) this problem was to animate the sprite. That is, if your sprite was going to move less than one pixel per frame (or, especially, if the pixels/frame ratio was going to be something odd like 2 pixels in 3 frames), you could hide the jerkiness by making an n frame animation loop that, over those n frames, ...

12

I'm currently making a game that has to run on a wide variety of display sizes and aspect ratios, and it hasn't been a very easy process. In addition, if you're making things in pixel art, and you want to keep the pixel art feeling while supporting many resolutions, you're walking into a world of pain, so be prepared. In my opinion, there are several things ...

9

Talking about the "best choice" is always difficult, as long as you did not specify the task that you intend to perform in all detail. But here are several aspects to consider. First of all: Java is not C. The memory management is completely different, so one has to be very careful when trying to apply insights from one programming environment to another. ...

8

Consider actually generating the scaled down versions at development time, and including them directly in the game as a resource. Do this with Photoshop or whatever tool you find creates what you like. Then have the game dynamically select the right art set appropriate to the current resolution. Here are a couple of reasons you might do this... Saves ...

8

Found a slution from some resource. Go to Global Game Settings, then go to any platform spoiler(for example "Windows" or "Android"), there choose spoiler "Graphics" and put the mark "Interpolate colors between pixels" off. Have fun :)

6

Depends on the game, if the game is single-player, let the user select a resolution, if they are happy for small characters, they can have it, if they want to feel connected with the game, they can use a lower resolution. Games like Civilization opt for this method. However, if you're building a multiplayer game, you're going to need a fixed resolution, ...

6

Show What You Can Do When looking to start or join a team online, people are always interested in seeing what work you've produced beforehand. The work doesn't necessarily have to be done in a game, but it should showcase your ability to create game quality assets. Talk About What You Want To Do If you're looking to recruit people for a team, talk about ...

6

This is called mipmaping, It looks like you are missing out on mipmaping for your textures. this causes a huge impact on visuals. And when it comes to mipmaping Normals, Specular and other "information" textures, it gets quite tricky. the reason for this is that when objects gets further away, the gpu has to take this into account and calculate the ...

6

You can reduce the instruction count by using vector operations: e.g. instead of edr = bool4((w1.x < w2.x) && ir_lv1.x, (w1.y < w2.y) && ir_lv1.y, (w1.z < w2.z) && ir_lv1.z, (w1.w < w2.w) && ir_lv1.w); you can write edr = (w1 < w2) && ir_lv1; Operators in HLSL ...

6

The sprite's position should be kept as a floating point quantity, and rounded to an integer only just before display. You can also maintain the sprite at super resolution and downsample the sprite before display. If you maintained the sprite at 3x display resolution,you'd have 9 different actual sprites depending on the subpixel position of the sprite.

5

There are various scaling algorithms that are specifically crafted for enlarging pixel art for modern displays. They usually work with factors 2x or 3x and produce nice non-blurred and non-blocky results. Take a look at this Wikipedia article, which has many examples.

5

I got this working. It does not use the hqx filter, it uses the xBR filter (which I prefer). For me, this is not a problem. If you require the hqx filter then you'll want to convert the .cg files into their appropriate XNA equivalent. For completeness and searching reasons, I will be editing the question to be more concise and then posting all the relevant ...

4

It is absolutely business-as-usual to decouple physics (and related ops like ray-based picking) from display values. Two common examples (I welcome any others as comments): OpenGL uses the float range 0.0->1.0 in x and y, thus abstracting display code from resolution (and thus, pixels). Box2D is also built for such decoupling. But having said that, it's ...

4

I noticed in the comments you want to make an Entity Class. This basically indicates you want all of your objects in the game for example your player, a building etc to share similarities. To do this you simply decide what are those similarities and put them in your entity class (for my example i will assume everything will have a position so X & Y and ...

4

These are all good answers but nobody explained the reason why you need to access the pixels in the way you do. The pixel data is a one dimensional array. For a 10x10 screen, the following is how you can visualize the data being set up. // This is how it is actually setup unsigned int data[100]; // This is how people envision it being setup unsigned int ...

4

From your link: Next, we're calculating the line offset. We're dividing the pitch by 4; the pitch value is in bytes, but we're moving four bytes at a time. It should be: void putpixels(int x, int y, int color) { unsigned int *ptr = (unsigned int*)Screen->pixels; int lineoffset = y * (Screen->pitch / sizeof( unsigned int ) ); ptr[...

4

You will need an active edge list, which contains a list of all polygon edges intersected by the current scanline. You will also need an in/out flag for each polygon on the scanline. The flags are toggled on/of as you cross an edge for a polygon. The rules are drawing for each pixel along a scanline are; no polygon flags are 'in', then draw background ...

4

You're not working with bitmaps here. The graphics object you're using uses vector graphics. So basically you're painting a lot of rectangles to your mask... The only reasonable way to determine whether or not your mask is entirely filled would be to render it to a BitmapData (using BitmapData.draw) and then iterate through the pixels until you hit a ...

3

I will assume you are reading a 32 bit RGBA surface, which means each pixel will have 8 bit for Red, 8 bit for Green, 8 bit for Blue and 8 bit for Alpha(transparency). Pixels indices: Pixels are stored in an one-dimensional array, so you can't simply say pixels[x][y]. As they are stored in order from left to right and from top to bottom, determining an ...

3

I found this code which seems to do what you want : http://fvirtman.free.fr/recueil/02_03_10_resize.c.html With the nearest algorithm, we fill each pixel of the scaled image using the nearest pixel from the source image. This leads to many possible artifacts. With the linear algorithm, the goal is to look for each pixel of the scaled image where we are in ...

3

Sure. Figure out which portions of the screen you want to render at what resolutions, and render them into FBOs of appropriate sizes. Once you have your different elements rendered into separate FBOs, you can then composite them together into the main framebuffer using glBlitFramebuffer(). Or alternately, if you don't want to composite them together as ...

3

In your main ApplicationListener where you create a camera object there will also be a resize method. If not override/implement it. It takes two arguments and when the window is resized these will be the dimensions of the newly resized window. Just set the cameras size to the new window size and call camera.update(); Should sort it! (I assume you are using ...

3

When the pending movement is perpendicular to the last movement (in screen space), ignore it and use the last screen coordinates. If that lead to stutter that's as bad as the staircase, you might try moving the sum of the pending and last movement. I think the problem lies in v < sqrt(2). v > sqrt(2) should always move at least a full diagonal, ...

3

There's not much you can really do about that for a general physics-based world. If all of your objects were moving along lines or specific circles, you could do something. But you're operating under actual physics. The object is where the physics puts it; you are simply drawing a pixel-based approximation of that location. It's generally something you have ...

3

In the pixel shader you could pass in a 256x256 Texture2D with the pallet colors all lined up horizontally in a row. Then your NES textures would be converted to direct3D Texture2Ds with ever pixel converted to a 0-255 index value. There is a texture format that only uses the red value in D3D9. So the texture would only take up 8bits per pixel, but the ...

3

If you don't really care about texture memory usage (and the idea of blowing an insane amount of texture memory to achieve a retro look has a kind of perverse appeal) you could build a 256x256x256 3d texture mapping all RGB combinations to your selected palette. Then in your shader it just becomes one line of code at the end: return tex3d (paletteMap, ...

Only top voted, non community-wiki answers of a minimum length are eligible