Show Posts
|
|
Pages: [1] 2 3 ... 5
|
|
1
|
Game Development / Newbie & Debugging Questions / Re: {lwjgl} "lag" problem
|
on: 2013-05-04 14:24:25
|
Take note your jar isn't working on 64-bit platform. Error: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\Iulian\AppDa ta\Local\Temp\natives-656819368\lwjgl.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary1(Unknown Source) at java.lang.ClassLoader.loadLibrary0(Unknown Source) at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at org.lwjgl.Sys$1.run(Sys.java:73) at java.security.AccessController.doPrivileged(Native Method) at org.lwjgl.Sys.doLoadLibrary(Sys.java:66) at org.lwjgl.Sys.loadLibrary(Sys.java:95) at org.lwjgl.Sys.<clinit>(Sys.java:112) at Loop.getTime(Loop.java:34) at Loop.getDelta(Loop.java:26) at Board.<init>(Board.java:14) at Game.<init>(Game.java:16) at Game.main(Game.java:47) |
|
|
|
|
|
7
|
Game Development / Newbie & Debugging Questions / OpenGL Fog not working
|
on: 2013-04-07 14:53:12
|
Hello! I can't make the fog work in my game: it is not "following" the player, it is depending on z-axis. I already searched for bad GL_PROJECTION matrix, but i only call it once. Here is my rendering code, if anyone could help me, thank you: 1 2 3 4 5 6 7 8 9 10 11
| public void updateCamera() { glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(50f, (float) Main.WIDTH / Main.HEIGHT, 0.1f, 64f); glMatrixMode(GL_MODELVIEW); glLoadIdentity();
glRotatef(pitch, 1.0f, 0.0f, 0.0f); glRotatef(yaw, 0.0f, 1.0f, 0.0f); glTranslatef(-position.x, -position.y, -position.z); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| private void initGL() { glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glEnable(GL_TEXTURE_2D); glEnable(GL_FOG);
FloatBuffer fogColor = BufferUtils.createFloatBuffer(4); fogColor.put(0f).put(0f).put(0f).put(1f).flip(); glFogi(GL_FOG_MODE, GL_LINEAR); glFog(GL_FOG_COLOR, fogColor); glHint(GL_FOG_HINT, GL_DONT_CARE); glFogf(GL_FOG_START, 16f); glFogf(GL_FOG_END, 32f);
glClearColor(0f, 0f, 0f, 1f); } |
1 2 3 4 5 6
| public void render() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
camera.updateCamera(); HallwayManager.getInstance().renderHallway(); } |
|
|
|
|
|
9
|
Games Center / Cube World Projects / Re: [Optimization] View Frustum Culling
|
on: 2013-04-01 18:20:56
|
You need to check every time the camera is moved whether or not a chunk is in the frustum. If it is, you send the chunk to renderer and render it until it is not in the frustum anymore. Only rebuild chunks when a block is removed or it enters the view frustum. If it leaves the screen, save it to disk or delete it or whatever you want to do. But it's a bad idea to rebuild it every frame. Only rebuild it when you absolutely have to. Otherwise, just have a render method that is constantly running for the chunk. Also, this: 1 2 3
| positionBuffer.put(new float[]{x, y, z + 1f, x + 1f, y, z + 1f, x + 1f, y + 1f, z + 1f, x, y + 1f, z + 1f}); colorBuffer.put(new float[]{1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0}); vertexCount += 4; |
Should not work. You are creating 3 * 4 vertices per face, not just 4. 3 is the size, 4 is the amount of vertices per face. I don't know how you're render function is actually working without that. It is correct. I am having 4 verices per face, 3 * 4 float numbers per face. That int is used in 1
| glDrawArrays(GL_QUADS, 0, chunk.vertexCount); |
Also, thank you very much for help, that works perfectly for what i am doing. 
|
|
|
|
|
13
|
Games Center / Cube World Projects / Re: [Optimization] View Frustum Culling
|
on: 2013-03-31 15:54:23
|
Now i've made this work i'm struggling to potimize it. How i use the frustum culling: 1 2 3 4
| if (cameraHasMoved) { updateFrustum(); recalculateVBOOfEveryChunk(); } |
I already implemented the octree (one octree per chunk). The problems are: - the fps drops from 50-60fps to 5-15fps when i am moving the camera - memory usage >800mb when moving the camera Tell me what part of code you need and i will post it.
|
|
|
|
|
15
|
Games Center / Cube World Projects / Re: [Solved] View Frustum Culling
|
on: 2013-03-30 08:35:08
|
Here it is. I can't really tell who's the owner, because i found this on google without any description. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
| import org.lwjgl.BufferUtils;
import java.nio.*;
import static org.lwjgl.opengl.GL11.*;
public class Frustum { public static final int RIGHT = 0; public static final int LEFT = 1; public static final int BOTTOM = 2; public static final int TOP = 3; public static final int BACK = 4; public static final int FRONT = 5;
public static final int A = 0; public static final int B = 1; public static final int C = 2; public static final int D = 3;
float[][] frustum = new float[6][4];
FloatBuffer modelBuffer; FloatBuffer projectionBuffer;
public Frustum() { modelBuffer = BufferUtils.createFloatBuffer(16); projectionBuffer = BufferUtils.createFloatBuffer(16); }
public void normalizePlane(float[][] frustum, int side) { float magnitude = (float) Math.sqrt(frustum[side][A] * frustum[side][A] + frustum[side][B] * frustum[side][B] + frustum[side][C] * frustum[side][C]);
frustum[side][A] /= magnitude; frustum[side][B] /= magnitude; frustum[side][C] /= magnitude; frustum[side][D] /= magnitude; }
public void calculateFrustum() { float[] projectionMatrix = new float[16]; float[] modelMatrix = new float[16]; float[] clipMatrix = new float[16];
projectionBuffer.rewind(); glGetFloat(GL_PROJECTION_MATRIX, projectionBuffer); projectionBuffer.rewind(); projectionBuffer.get(projectionMatrix);
modelBuffer.rewind(); glGetFloat(GL_MODELVIEW_MATRIX, modelBuffer); modelBuffer.rewind(); modelBuffer.get(modelMatrix);
clipMatrix[ 0] = modelMatrix[ 0] * projectionMatrix[ 0] + modelMatrix[ 1] * projectionMatrix[ 4] + modelMatrix[ 2] * projectionMatrix[ 8] + modelMatrix[ 3] * projectionMatrix[12]; clipMatrix[ 1] = modelMatrix[ 0] * projectionMatrix[ 1] + modelMatrix[ 1] * projectionMatrix[ 5] + modelMatrix[ 2] * projectionMatrix[ 9] + modelMatrix[ 3] * projectionMatrix[13]; clipMatrix[ 2] = modelMatrix[ 0] * projectionMatrix[ 2] + modelMatrix[ 1] * projectionMatrix[ 6] + modelMatrix[ 2] * projectionMatrix[10] + modelMatrix[ 3] * projectionMatrix[14]; clipMatrix[ 3] = modelMatrix[ 0] * projectionMatrix[ 3] + modelMatrix[ 1] * projectionMatrix[ 7] + modelMatrix[ 2] * projectionMatrix[11] + modelMatrix[ 3] * projectionMatrix[15];
clipMatrix[ 4] = modelMatrix[ 4] * projectionMatrix[ 0] + modelMatrix[ 5] * projectionMatrix[ 4] + modelMatrix[ 6] * projectionMatrix[ 8] + modelMatrix[ 7] * projectionMatrix[12]; clipMatrix[ 5] = modelMatrix[ 4] * projectionMatrix[ 1] + modelMatrix[ 5] * projectionMatrix[ 5] + modelMatrix[ 6] * projectionMatrix[ 9] + modelMatrix[ 7] * projectionMatrix[13]; clipMatrix[ 6] = modelMatrix[ 4] * projectionMatrix[ 2] + modelMatrix[ 5] * projectionMatrix[ 6] + modelMatrix[ 6] * projectionMatrix[10] + modelMatrix[ 7] * projectionMatrix[14]; clipMatrix[ 7] = modelMatrix[ 4] * projectionMatrix[ 3] + modelMatrix[ 5] * projectionMatrix[ 7] + modelMatrix[ 6] * projectionMatrix[11] + modelMatrix[ 7] * projectionMatrix[15];
clipMatrix[ 8] = modelMatrix[ 8] * projectionMatrix[ 0] + modelMatrix[ 9] * projectionMatrix[ 4] + modelMatrix[10] * projectionMatrix[ 8] + modelMatrix[11] * projectionMatrix[12]; clipMatrix[ 9] = modelMatrix[ 8] * projectionMatrix[ 1] + modelMatrix[ 9] * projectionMatrix[ 5] + modelMatrix[10] * projectionMatrix[ 9] + modelMatrix[11] * projectionMatrix[13]; clipMatrix[10] = modelMatrix[ 8] * projectionMatrix[ 2] + modelMatrix[ 9] * projectionMatrix[ 6] + modelMatrix[10] * projectionMatrix[10] + modelMatrix[11] * projectionMatrix[14]; clipMatrix[11] = modelMatrix[ 8] * projectionMatrix[ 3] + modelMatrix[ 9] * projectionMatrix[ 7] + modelMatrix[10] * projectionMatrix[11] + modelMatrix[11] * projectionMatrix[15];
clipMatrix[12] = modelMatrix[12] * projectionMatrix[ 0] + modelMatrix[13] * projectionMatrix[ 4] + modelMatrix[14] * projectionMatrix[ 8] + modelMatrix[15] * projectionMatrix[12]; clipMatrix[13] = modelMatrix[12] * projectionMatrix[ 1] + modelMatrix[13] * projectionMatrix[ 5] + modelMatrix[14] * projectionMatrix[ 9] + modelMatrix[15] * projectionMatrix[13]; clipMatrix[14] = modelMatrix[12] * projectionMatrix[ 2] + modelMatrix[13] * projectionMatrix[ 6] + modelMatrix[14] * projectionMatrix[10] + modelMatrix[15] * projectionMatrix[14]; clipMatrix[15] = modelMatrix[12] * projectionMatrix[ 3] + modelMatrix[13] * projectionMatrix[ 7] + modelMatrix[14] * projectionMatrix[11] + modelMatrix[15] * projectionMatrix[15];
frustum[LEFT][A] = clipMatrix[ 3] + clipMatrix[ 0]; frustum[LEFT][B] = clipMatrix[ 7] + clipMatrix[ 4]; frustum[LEFT][C] = clipMatrix[11] + clipMatrix[ 8]; frustum[LEFT][D] = clipMatrix[15] + clipMatrix[12]; normalizePlane(frustum, LEFT);
frustum[RIGHT][A] = clipMatrix[ 3] - clipMatrix[ 0]; frustum[RIGHT][B] = clipMatrix[ 7] - clipMatrix[ 4]; frustum[RIGHT][C] = clipMatrix[11] - clipMatrix[ 8]; frustum[RIGHT][D] = clipMatrix[15] - clipMatrix[12]; normalizePlane(frustum, RIGHT);
frustum[BOTTOM][A] = clipMatrix[ 3] + clipMatrix[ 1]; frustum[BOTTOM][B] = clipMatrix[ 7] + clipMatrix[ 5]; frustum[BOTTOM][C] = clipMatrix[11] + clipMatrix[ 9]; frustum[BOTTOM][D] = clipMatrix[15] + clipMatrix[13]; normalizePlane(frustum, BOTTOM);
frustum[TOP][A] = clipMatrix[ 3] - clipMatrix[ 1]; frustum[TOP][B] = clipMatrix[ 7] - clipMatrix[ 5]; frustum[TOP][C] = clipMatrix[11] - clipMatrix[ 9]; frustum[TOP][D] = clipMatrix[15] - clipMatrix[13]; normalizePlane(frustum, TOP);
frustum[FRONT][A] = clipMatrix[ 3] + clipMatrix[ 2]; frustum[FRONT][B] = clipMatrix[ 7] + clipMatrix[ 6]; frustum[FRONT][C] = clipMatrix[11] + clipMatrix[10]; frustum[FRONT][D] = clipMatrix[15] + clipMatrix[14]; normalizePlane(frustum, FRONT);
frustum[BACK][A] = clipMatrix[ 3] - clipMatrix[ 2]; frustum[BACK][B] = clipMatrix[ 7] - clipMatrix[ 6]; frustum[BACK][C] = clipMatrix[11] - clipMatrix[10]; frustum[BACK][D] = clipMatrix[15] - clipMatrix[14]; normalizePlane(frustum, BACK); }
public boolean cubeInFrustum(float x, float y, float z, float size) { for(int i = 0; i < 6; i++ ) { if(frustum[i][A] * (x - size) + frustum[i][B] * (y - size) + frustum[i][C] * (z - size) + frustum[i][D] > 0) continue; if(frustum[i][A] * (x + size) + frustum[i][B] * (y - size) + frustum[i][C] * (z - size) + frustum[i][D] > 0) continue; if(frustum[i][A] * (x - size) + frustum[i][B] * (y + size) + frustum[i][C] * (z - size) + frustum[i][D] > 0) continue; if(frustum[i][A] * (x + size) + frustum[i][B] * (y + size) + frustum[i][C] * (z - size) + frustum[i][D] > 0) continue; if(frustum[i][A] * (x - size) + frustum[i][B] * (y - size) + frustum[i][C] * (z + size) + frustum[i][D] > 0) continue; if(frustum[i][A] * (x + size) + frustum[i][B] * (y - size) + frustum[i][C] * (z + size) + frustum[i][D] > 0) continue; if(frustum[i][A] * (x - size) + frustum[i][B] * (y + size) + frustum[i][C] * (z + size) + frustum[i][D] > 0) continue; if(frustum[i][A] * (x + size) + frustum[i][B] * (y + size) + frustum[i][C] * (z + size) + frustum[i][D] > 0) continue;
return false; }
return true; } } |
|
|
|
|
|
18
|
Games Center / Cube World Projects / Re: View Frustum Culling
|
on: 2013-03-29 18:12:39
|
|
I understand what you say. I will optimize the algorithm after i will manage this to work. First i want to make this work, because i understand how it works, but there is a problem with it. Am i using the right matrix? How can i calculate the W component of the points vector? What am i doing wrong in my code? The second thig is that i'm 10th grade (in Romania), this is 2nd grade of high school and I didn't learned matrix and planes at mathematics. I am very towards to learning stuff in advance, just tell me what i should do.
|
|
|
|
|
19
|
Games Center / Cube World Projects / [Solved] View Frustum Culling
|
on: 2013-03-29 09:56:58
|
I give up! Hello everyone! I am struggling to get the frustum culling working for the last day, but i can't find what's wrong with what i do. Here is my code for updating the frustum (called eveytime camera is moved) and checking if a point (a box) is in frustum. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| public void update() { FloatBuffer modelMatrixBuffer = BufferUtils.createFloatBuffer(16); glGetFloat(GL_MODELVIEW_MATRIX, modelMatrixBuffer); modelMatrixBuffer.rewind();
Matrix4f modelMatrix = new Matrix4f(); modelMatrix.load(modelMatrixBuffer);
planes[0] = new Plane(modelMatrix.m30 + modelMatrix.m00, modelMatrix.m31 + modelMatrix.m01, modelMatrix.m32 + modelMatrix.m02, modelMatrix.m33 + modelMatrix.m03); planes[1] = new Plane(modelMatrix.m30 - modelMatrix.m00, modelMatrix.m31 - modelMatrix.m01, modelMatrix.m32 - modelMatrix.m02, modelMatrix.m33 - modelMatrix.m03); planes[2] = new Plane(modelMatrix.m30 + modelMatrix.m10, modelMatrix.m31 + modelMatrix.m11, modelMatrix.m32 + modelMatrix.m12, modelMatrix.m33 + modelMatrix.m13); planes[3] = new Plane(modelMatrix.m30 - modelMatrix.m10, modelMatrix.m31 - modelMatrix.m11, modelMatrix.m32 - modelMatrix.m12, modelMatrix.m33 - modelMatrix.m13); planes[4] = new Plane(modelMatrix.m30 + modelMatrix.m20, modelMatrix.m31 + modelMatrix.m21, modelMatrix.m32 + modelMatrix.m22, modelMatrix.m33 + modelMatrix.m23); planes[5] = new Plane(modelMatrix.m30 - modelMatrix.m20, modelMatrix.m31 - modelMatrix.m21, modelMatrix.m32 - modelMatrix.m22, modelMatrix.m33 - modelMatrix.m23); }
public static boolean inFrustum(int x, int y, int z) { Frustum camFrustum = Camera.getInstance().fow;
Vector4f vCube[] = new Vector4f[] { new Vector4f(x, y, z, 1f), new Vector4f(x + 1, y + 1, z + 1, 1f) };
for(int v = 0; v < 2; v++) { for(int i = 0; i < 6; i++) if(distanceToPlane(vCube[v], camFrustum.planes[i]) < 0) return false; }
return true; }
public static float distanceToPlane(Vector4f vertex, Plane plane) { return plane.a * vertex.x + plane.b * vertex.y + plane.c * vertex.z + plane.d; } |
The Plane class is containing only the a, b, c and d from the plane's equation. For the moment i just want to see it working and then i will try to optimize it. Can anyone please help me?
|
|
|
|
|
21
|
Games Center / Cube World Projects / Re: The Architect (Voxel Engine)
|
on: 2013-03-28 23:28:07
|
Can you please tell me how you did the frustum culling? I am trying to do it for last 4 hours, but i can't make it work how it should. Here is how i did the frustum faces loading: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| public void update() { FloatBuffer projectionBuffer = BufferUtils.createFloatBuffer(16); glGetFloat(GL_PROJECTION_MATRIX, projectionBuffer); FloatBuffer modelBuffer = BufferUtils.createFloatBuffer(16); glGetFloat(GL_MODELVIEW_MATRIX, modelBuffer);
Matrix4f projectionMatrix = new Matrix4f(); projectionMatrix.load(projectionBuffer); Matrix4f modelMatrix = new Matrix4f(); modelMatrix.load(modelBuffer); Matrix4f viewMatrix = new Matrix4f(); Matrix4f.mul(projectionMatrix, modelMatrix, viewMatrix);
planes[0] = new Plane(viewMatrix.m30 + viewMatrix.m00, viewMatrix.m31 + viewMatrix.m01, viewMatrix.m32 + viewMatrix.m02, viewMatrix.m33 + viewMatrix.m03); planes[1] = new Plane(viewMatrix.m30 - viewMatrix.m00, viewMatrix.m31 - viewMatrix.m01, viewMatrix.m32 - viewMatrix.m02, viewMatrix.m33 - viewMatrix.m03); planes[2] = new Plane(viewMatrix.m30 + viewMatrix.m10, viewMatrix.m31 + viewMatrix.m11, viewMatrix.m32 + viewMatrix.m12, viewMatrix.m33 + viewMatrix.m13); planes[3] = new Plane(viewMatrix.m30 - viewMatrix.m10, viewMatrix.m31 - viewMatrix.m11, viewMatrix.m32 - viewMatrix.m12, viewMatrix.m33 - viewMatrix.m13); planes[4] = new Plane(viewMatrix.m30 + viewMatrix.m20, viewMatrix.m31 + viewMatrix.m21, viewMatrix.m32 + viewMatrix.m22, viewMatrix.m33 + viewMatrix.m23); planes[5] = new Plane(viewMatrix.m30 - viewMatrix.m20, viewMatrix.m31 - viewMatrix.m21, viewMatrix.m32 - viewMatrix.m22, viewMatrix.m33 - viewMatrix.m23); } |
|
|
|
|
|
23
|
Games Center / Cube World Projects / [Solved] Weird results when using ArrayList + VBO
|
on: 2013-03-26 21:57:47
|
So I am learning 3D programming for 3 days now. I managed how to use VBOs, culling and other things. I store level data in chunks (16 x 16 x 16). I am generating a VBO for every chunk (not for every tile), i get rid of "unseen" faces of cubes. If I simulate (using 25 chunks) the updating (recalculation of VBO) of all the chunks every 2 seconds, the application's emory use gets >500m in lass than 10 seconds. I think that the bottleneck is my float[] declaration (the data passed to the FloatBuffer); i am declaring it as 16^3 * 6 (faces) * 4 (vertex per face) * 3 (x, y, z). As solution, i found using an ArrayList<Float> (so i can have dynamic size) significantly reduces the memory use, but i get very wierd results, apart from OpenGL errors that are making my app to start only sometimes :  NORMAL (HOW IT SHOULD BE)  WEIRD Here are my Chunk classes (first is the one with float[], and second is the one with ArrayList): http://pastebin.java-gaming.org/d2fb87c055bhttp://pastebin.java-gaming.org/2fb8c850b58LE: Also, another issue i have is that when the (0, 0, 0) point is in screen (view), my framerate drops to 15-20 FPS, it doesn't matter if i have or not any block at (0, 0, 0).
|
|
|
|
|
25
|
Game Development / Newbie & Debugging Questions / Re: LibGDX tile rendering flicker.
|
on: 2013-02-27 13:03:17
|
I fonud as a fix casting to int the camera's coordonates, but this is messing my camera code (i am calculating a vector to player's position for a smooth camera effect). Any fix for this?  Here's my code: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| private void updateCameraPosition() { float targetX, targetY; if(player.getPosition().x - camera.viewportWidth / 2 < 0) targetX = camera.viewportWidth / 2; else if(player.getPosition().x + camera.viewportWidth / 2 > world.getLevel().getWidth() * Tile.TILE_SIZE) targetX = world.getLevel().getWidth() * Tile.TILE_SIZE - camera.viewportWidth / 2; else targetX = player.getPosition().x; if(player.getPosition().y - camera.viewportHeight / 2 < 8) targetY = camera.viewportHeight / 2 + 8; else if(player.getPosition().y + camera.viewportHeight / 2 > world.getLevel().getHeight() * Tile.TILE_SIZE + 8) targetY = world.getLevel().getHeight() * Tile.TILE_SIZE - camera.viewportHeight / 2 + 8; else targetY = player.getPosition().y; float dx = targetX - camera.position.x, dy = targetY - camera.position.y, dist = (float) Math.hypot(dx, dy); Vector3 cameraVector = new Vector3((float) Math.cos(Math.atan2(dy, dx)), (float) Math.sin(Math.atan2(dy, dx)), 0); cameraVector.mul(Math.max(dist / 25f, .2f)); camera.position.add(cameraVector); camera.update(); } |
|
|
|
|
|
27
|
Game Development / Newbie & Debugging Questions / LibGDX tile rendering flicker.
|
on: 2013-02-26 22:29:54
|
What's up everybody?  Ok, so i am making a top-down 2(.5)D game. My "floor" tiles are stored in a WxH array (not tiles, but their id's). When I want to render them, I use two fors (y and x) get the texture for that tile id and render it at x * Tile.TILE_SIZE (int constant). To optimize the algorithm, i calculate a start and end x and y based on camera's position (a float transformed to a integer), and render only tiles that are on the screen. Problem: The problem is that when i move the camera (using a calculated delta -- huge decimal number) i get a visual bug: 1 pixel gap between random rows of tiles (only horizontal gap). My assumption is that the problem is caused by that float -> integer transformation. Could anyone tell me how can i fix this problem? Also, how can i avoid this type of problems? Thanks! LE: Here's one picture of what is happening. 
|
|
|
|
|
29
|
Game Development / Newbie & Debugging Questions / Re: Kind of shadow casting.
|
on: 2013-02-24 22:49:22
|
Oh, so my ideea of getting the sprite's image, distorting it (flip it vertically and skew (:-??) until it gets 45 degrees) and then making it only black + decreasing it's opacity (tehniques that i use in photoshop to do the shadow) isn't so good. Is it practical? 
|
|
|
|
|
30
|
Game Development / Newbie & Debugging Questions / Re: Kind of shadow casting.
|
on: 2013-02-24 21:15:43
|
I think that if i make the shadows by code, it will be easier to me to avoid things like this:   (notice the shadow rendered under the wall and intensifying the wall's shadow) Also, it would be easier than drawing and positioning the shadow for every entity i make.
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|