Show Posts
|
|
Pages: [1] 2 3 ... 14
|
|
5
|
Discussions / General Discussions / Re: Blogpost about Java for Game Programming
|
on: 2013-05-17 20:03:10
|
An unsafe language like C++, or really more the C parts of it, can technically outrun any managed language runtime like Java, because they can bang on arbitrary memory to write almost any instruction sequence they want, and that's without embedded assembly. At the end of nineties, C/C++ fans gave the same kind of arguments to explain that as Java is written in C (Jikes was written in C++), it can't outperform C which is wrong. One of my teacher wrote a program that converted Java (1.3) to C code during his thesis and he only obtained a very small gain (less than 5%) after years of work. Brian Goetz explained that memory allocation and method calls are between 2 and 4 times faster in Java. I really think that almost no human being is able to write a better machine code or assembler code that a compiler like GCC except in particular cases on a small piece of source code and if you really believe you can be more efficient than the JVM, don't use Java. I'm sad to see these kinds of prejudices about Java even here on JGO. No one use standard memory allocator for performance critical code and inlined method have zero method call overhead.
|
|
|
|
|
6
|
Java Game APIs & Engines / Engines, Libraries and Tools / Re: LibGDX: No Box2DLights shadows on scene2d Stage Actors
|
on: 2013-05-17 13:57:21
|
Ok actually the soft lights are the best option, but that doesn't matter now.
I thought about modding Box2DLights so that the shadows are not rendered over the Body. I don't really understand the code, probably because I only know ridiculously small parts of OpenGL, but I thought I don't need this much OpenGL to do the kind of change that I want:
It looks like the shadows are drawn from the first collision of a light ray with a Box2D Body into infinity. I'd like to change this to the second collision, so it's the collision of the light ray with the other side of the Body. This way, the shadow would begin on the farer away side of the Body (seen from the light position) and not be drawn over it. Hopefully I made my idea clear enough.
Instead of replacing the current way it's done, wouldn't it be possible to add Light#setShadowBehindBody(boolean shadowBehindBody) or something similar? I don't want to put extra work on you, but is this as simple as it seems to me in theory? I don't even find the place where the collisions of rays and Bodies are calculated...
Just to test second collision wont work with non convex bodies. This would make raycastin rather complex. But if you wan't to modify source then just continue raycast until box2d body change or raycast end and use last collision point.
|
|
|
|
|
7
|
Java Game APIs & Engines / Engines, Libraries and Tools / Q
|
on: 2013-05-15 22:56:52
|
|
You have plenty choices here. These three come to my mind first.
1. Soften lights so player get some light. 2. Filter player body completely. This has side effect that player then won't cast any shadows. 3. Draw player body top of shadows if player bounding box corners are in light. You have query method for pointAtLight or pointAtShadow. Also light have point contain that can be used for more spesific queries per light. Point tests are really fast.
Adding small ambient light can also solve this.
Hope you find some way to solve this.
|
|
|
|
|
8
|
Java Game APIs & Engines / OpenGL Development / Re: Multiple shader passes LWJGL
|
on: 2013-05-15 19:06:13
|
|
Stuffing texcoord math is just special case for some mobile chips notably powerVR. If you don't touch textureVoord in any way fragment shader unit may prefetch texels before shader even run. Also this is just not theoretical performance gain but battle tested method. Simple example: I switched from shadow2DProjEXT to shadow2DProj and gained 1.5ms rendertime when doing fullscreen shadow mapping pass with iPhone4s today. This was because proj and bias variants always cause "depentant" texture reads.
|
|
|
|
|
9
|
Java Game APIs & Engines / OpenGL Development / Re: Multiple shader passes LWJGL
|
on: 2013-05-15 10:18:22
|
Reason to use two pass blur vs one pass is that you need only 2N samples instead of N^2. For bigger kernels this saving is really big factor.
You can optimize it even further by exploiting bilinear filtering to get a correctly weighted average of two texels per texture sample. You can achieve a 9x9 gaussian blur using only 5+5 texture samples, which means you'll go from 81 samples down to 10. Another trick is that you can do a 3x3 gaussian blur using only 4 texture samples and a single pass. Already doing linear sampling trick. Also I am calculating texture coordinates at vertex shader and passing them as varying to get rid of all "dependent" texture lookups with mobile hardware and some fragment shader math. Last part give over twice the performance compared to traditional approach. Still don't think it would do any good on pc hardware.
|
|
|
|
|
10
|
Game Development / Game Mechanics / Re: Libgdx 2D lights
|
on: 2013-05-15 10:11:53
|
|
If you just want black where there are no light and completely white neutral light that does not distort you game colors that library can do that too. But you need be more specific what you want.
|
|
|
|
|
15
|
Game Development / Newbie & Debugging Questions / Re: [Final Decision] LWJGL or LIBGDX
|
on: 2013-05-03 15:16:31
|
Games build with LwjglGames build with LibGdxi don't want to be childish (even if i am  ) but, let's be honest here, for a newbie game developers, seeing what people has achived with the current language,engines,framework,library or any development tools, will give him a big push up and huge motivation to keep working with that tool, and just like what most of you said (except libGdx extremist fans  ) a noob developer should just stick with what ever he saw "easy" to work with, i don't regret starting this topic cause i really was scared that i will spend months learning lwjgl without being able to finish ANY project, even a little one, so i wanted to ask, and now am sure that i will keep learning lwjgl for 2 simple reason : 1- i like the way i pronounce "lwjgl" 2- it has a very good wiki to start with You linked unofficial wiki that have been updated (Apr 19, 2012 by) and you are comparing mobile to pc games. Fair comparision IMO.
|
|
|
|
|
16
|
Java Game APIs & Engines / OpenGL Development / Re: Optimisation of continuous terrain engine
|
on: 2013-05-03 14:36:41
|
|
Your chunks seems to be just height maps and everything else can be calculated from that.
So you could try this. Create one vbo with 512x512 and texture coordinates(shorts have plenty precision) but nothing else. Reuse this vbo for every chunk. At vertex shader use vertex fetch and get current height. Calculate x and y position by chunk middle pos(uniform) + texture coord * chunk size. Z by height * scale. Calculate normal by fetching couple neighbour height. This will massively reduce the data bandwith used and total memory requirments. Now chunk is only 256 Kb of data and vbo is 1Mb. It's aslo quite easy to make couple different size LOD vbo's.
|
|
|
|
|
18
|
Java Game APIs & Engines / OpenGL Development / Re: Horrible performance with GL_UNSIGNED_BYTE
|
on: 2013-04-28 22:48:55
|
@pitbuller: That's probably it! I used 3 unsigned bytes for coords + 2 unsigned bytes for texture coords. I just changed vec3 to vec4 and added one dummy value + changed UV to unsigned shorts. So they are all now 4-byte aligned and it went to 300 fps on ATI card. Thanks! How could I have missed that best-practices page.  So is it still 3times slower than with just using floats?
|
|
|
|
|
20
|
Games Center / Cube World Projects / Re: Voxel Engine Problems
|
on: 2013-04-20 00:04:37
|
Just added frustum culling but finding using the distance formula better...
As anybody else implemented frustum culling in their voxel project and how does it fair over doing a distance check?
I think I will use frustum culling for other objects in my project, not for the voxels, will stick with distance formula.
Frustum culling is dead cheap. Distance formula can't be faster than it if you use it right. Draw call is at least magnitude slower than any sane bounding box frustum culling method that you can ever write. For iOs project I frustum cull every particle as optimization.(Sphere frustum test. Even this is better than distance checkl) This was faster than rendering them all with one draw call even before any simd optimizions.
|
|
|
|
|
22
|
Games Center / Cube World Projects / Re: Voxel Engine Problems
|
on: 2013-04-18 20:35:12
|
I don't think the bottle neck is the ArrayList, more to do with my distance formula, I've now got this: 1 2 3 4 5 6 7 8 9
| int deltax=Math.abs((int)x - (c.getX() * 32)); int deltaz=Math.abs((int)z - (c.getZ() * 32)); int deltay = 1; float distance=(float)Math.sqrt((deltax*deltax)+(deltay*deltay)+(deltaz*deltaz)); if(distance < Chunk.CHUNK_SIZE * 8) { c.render(); } |
Why you use math abs? Multiplying real number with itself make it positive always. Also you don't need sqrt when comparing distances. 1 2 3 4 5 6 7 8 9 10
| int deltax=(int)x - c.getX() * 32; int deltaz=(int)z - c.getZ() * 32; int deltay = 1; int distance2=deltax*deltax+deltay*deltay+deltaz*deltaz; int radius2 = (Chunk.CHUNK_SIZE * 8) radius2*=radius2; if(distance2 < radius2) { c.render(); } |
|
|
|
|
|
23
|
Discussions / General Discussions / Re: Steam Questions
|
on: 2013-04-09 20:56:34
|
|
It's quite good deal that you can sell game by your own and give steam code to customers. See how games at Humble Bundle does. Steam benefit from that by gaining new users. Portals are all about users and Steam have plenty those.
|
|
|
|
|
25
|
Game Development / Newbie & Debugging Questions / Re: [LibGDX] Resize Texture for use with TextureRegion
|
on: 2013-03-27 09:46:52
|
Resizing the texture on the screen isn't the problem. TextureRegion using the textures native resolution is my problem.
Let's say I have a texture that's 100x100 but I need it to be 50x50 for use with TextureRegion. I need to resize the native resolution to 50x50 before sending it to be cut into pieces by TextureRegion.
For further clarification I'm splitting up a single picture into many little pictures that make up the main picture. I'm making a puzzle type game.
The pictures all need to be a certain resolution for the game to work correctly.
Then you have logic problem if TextureRegion size dictate the code flow. Just think about it little. Texture is nothing more than 2d array of bytes at gpu memory. This 2d array have size and those bytes are interpreted as colors usually. You can pretty much use this data how you want. TextureRregion is just helper class that has texture as reference and texture coordinates that describe rectangle shaped portion of that original texture. So textureRegion does no split anything it just have additional texture coordinates. So what you want to achieve?
|
|
|
|
|
28
|
Game Development / Newbie & Debugging Questions / Re: [libgdx] Shaders, Light system.
|
on: 2013-02-09 13:54:00
|
Oh well, that's great to hear then! we just go ahead and try to use it then! Thanks a lot!
First i read through the code of box2light I was a bit worried that it uses a physics engine to do a calculations, and I thought it might be slow, but yeah if you say it's not then it's great news.
I hope it is possible to use it with Stage class right?
Should be usable with Stage. Box2d is only used for raycasting what is needed for shadows. Box2d have really good and efficient acceleration structure for collisions so that plus native code make generic raycasting with it really fast.
|
|
|
|
|
29
|
Game Development / Newbie & Debugging Questions / Re: [libgdx] Shaders, Light system.
|
on: 2013-02-09 12:25:00
|
So, that means that even if I do not need "more dynamic" system, box2dlight is still better in performance then the fake dynamic overlaying to buffer approach?
As author of box2dLights I can say that performance with box2dLights is way better than any other multiple light solution that I have tested. If you don't need shadows then algorithm is cheap as hell. Its designed to work with mobile devices so performance with pc is top notch.
|
|
|
|
|
30
|
Discussions / General Discussions / Re: How to think of game ideas???
|
on: 2013-02-02 14:23:38
|
|
Ideas is easiest part of game developing. Everybody and their dogs have plenty of ideas. Thought usually only small percentage is even usable. Making coherent game of that mess is the hard part. Mixing too many ideas is bad. Using just one is boring. Finding the balance and focusing the best ideas is key to win.
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|