Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2 3 ... 14
1  Game Development / Performance Tuning / Re: Anyone else here get a major kick out of refactoring and optimizing regularly? on: 2013-05-21 23:17:48
Just used two hours to optimize normal from height map(actual its just function) calculation at vertex shader. Was so happy when micro optimized function was two times shorter and faster. Some times optimized code looks ugly but sometimes you can reduce complexity without losing functionality.
2  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [LibGDX] Linking a Sprite (Or another image) to a Box2D Body on: 2013-05-21 00:45:33
Correct me if I'm wrong, but I thought the userData was mostly for collision info with contactlisteners. I think your original method was fine.

User data is just pointer to any data that you want. Also its only sane way to do mapping from body to entity.
3  Game Development / Performance Tuning / Re: Anyone else here get a major kick out of refactoring and optimizing regularly? on: 2013-05-20 11:11:41
Optimizing blindly is lottery. If you use enough time you might guess winning ticket.
If you don't know the bottleneck all your time is wasted. Always profile.

ps. Optimizing with profiler is much more fun. You can quite accurately tell that all the effort is giving you something back.
4  Java Game APIs & Engines / OpenGL Development / Re: Shader Program Fatal Error on: 2013-05-18 11:14:38
I added both of those methods to my initialisation and the texture is still rendered with a white background.

You should read this http://www.arcsynthesis.org/gltut/
Understanding how stuff work make doing it lot easier.
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.
11  Java Game APIs & Engines / OpenGL Development / Re: Multiple shader passes LWJGL on: 2013-05-14 23:16:02
Nice tutorials, thanks.

It seems really slow to use multiple fbo's just for a little blur Sad.

Slow in developing time or rendering time? Never assume anything but measure.

My box2dLights use two pass gaussian blur and it run fine even on couple year old android devices.

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.

http://www.unrealengine.com/files/downloads/Smedberg_Niklas_Bringing_AAA_Graphics.pdf
On that paper they present 6th pass god ray post process effect and that run fine on iPad2.
12  Game Development / Game Mechanics / Re: Libgdx 2D lights on: 2013-05-14 19:12:21
Box2dLights, for instance.

Also notice that only need box2d for shadows. So adding light library work fine even without box2d.
13  Java Game APIs & Engines / OpenGL Development / Re: Shader Program Fatal Error on: 2013-05-12 18:06:15
What you try to do with pass color? Currently it does absolute nothing and will get optimized away.
14  Game Development / Performance Tuning / Re: Fast/Efficient method to filter a numeric Value on: 2013-05-08 20:32:27
1  
2  
3  
4  
5  
int filter(int input)
{
   int values[] = {0,100,200};
   return values[input/100];
}
15  Game Development / Newbie & Debugging Questions / Re: [Final Decision] LWJGL or LIBGDX on: 2013-05-03 15:16:31
Games build with Lwjgl
Games build with LibGdx

i don't want to be childish (even if i am  Roll Eyes ) 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  Pointing )
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"  Roll Eyes
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.
17  Game Development / Newbie & Debugging Questions / Re: [Final Decision] LWJGL or LIBGDX on: 2013-05-02 23:17:41
Learning how to use LWJGL and writing boilerplate code is portrayed to be way harder than it really is.

Learning how to write boilerplate is portrayed to be way useful than it really is.

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. Cheesy

So is it still 3times slower than with just using floats?
19  Java Game APIs & Engines / OpenGL Development / Re: Horrible performance with GL_UNSIGNED_BYTE on: 2013-04-28 21:53:31
Is you data 4-byte aligned?

http://www.opengl.org/wiki/Vertex_Specification_Best_Practices
1  
2  
3  
4  
There is something you should watch out for. The alignment of any attribute's data should be no less than 4bytes.
So if you have a vec3 of GLushort​s, you can'
t use that 4th component for a new attribute (such as a vec2
of GLbyte​s). If you want to pack something into that instead of having useless padding, you
need to make it a vec4 of GLushort​s.
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.
21  Java Game APIs & Engines / OpenGL Development / Re: Post-Processing Effects on: 2013-04-19 23:57:35
Every AAA game use them so do not afraid. At gles2.0 and with some hardware you just have to be carefull with clearing and discarding them particaly at ios.
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;//precalculate this
        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.
24  Game Development / Game Mechanics / Re: What are the ways to optimize game? on: 2013-04-09 10:56:35
Why my busy loop is busy?

Also profile before optimizing. The problem propably isn't collision code and if it is then show some code.
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?
26  Game Development / Newbie & Debugging Questions / Re: [libgdx] Shaders, Light system. on: 2013-03-02 23:03:22
Sorry for late answer.
Thats not a bug. Problem is related to low dynamic range rendering. You just overburn the color buffer and everything is solid white at those points where many light overlap.
27  Game Development / Newbie & Debugging Questions / Re: libGDX - It's so large? on: 2013-02-25 13:27:05
I think you just wasted more time/bandwith by creating this thread.
Only place where download size matter much is at iOs store where 3g downloadable content limit is <50Mb.
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.
Pages: [1] 2 3 ... 14
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
hobbles (7 views)
2013-05-22 00:54:55

cubemaster21 (74 views)
2013-05-17 21:29:12

alaslipknot (86 views)
2013-05-16 21:24:48

gouessej (115 views)
2013-05-16 00:53:38

gouessej (110 views)
2013-05-16 00:17:58

theagentd (121 views)
2013-05-15 15:01:13

theagentd (110 views)
2013-05-15 15:00:54

StreetDoggy (155 views)
2013-05-14 15:56:26

kutucuk (177 views)
2013-05-12 17:10:36

kutucuk (175 views)
2013-05-12 15:36:09
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.211 seconds with 20 queries.