Java-Gaming.org Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (575)
Games in Android Showcase (154)
games submitted by our members
Games in WIP (623)
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 ... 95
1  Game Development / Newbie & Debugging Questions / Re: [libgdx] Drawing gradient with vertices producing diagonal line artefact on: 2015-04-25 18:12:49
You could use a gradient texture instead, as bilinear filtering doesn't have that problem.
2  Discussions / General Discussions / Re: Need halp (help) testing native binaries on Mac and Linux on: 2015-04-25 01:57:38
Thanks, everyone! I'll see if I can do some more testing tomorrow!
3  Discussions / General Discussions / Re: [Solved] Wasted space a big deal in GLSL Shaders? on: 2015-04-24 09:32:30
Texture buffer objects work really well for this.
4  Discussions / General Discussions / Re: Need halp (help) testing native binaries on Mac and Linux on: 2015-04-23 22:57:33
I... have no idea what that script is supposed to do... or how it does it...
5  Java Game APIs & Engines / OpenGL Development / Re: Precision and value range on: 2015-04-23 16:49:25

Yes, that's why I asked in my original posting if glTranslated will make use of the added precision of doubles compared to floats.
In theory, the driver could be computing the matrices at double precision since it's done on the CPU and then upload them to the GPU as float precision at best, but I seriously doubt there are any drivers that do that. When it comes to the actual GPU, you can safely assume the math will be done at 32-bit float precision. Only recent GPUs can handle double precision math at all, and it's slow as hell, between 1/2x and 1/32x as fast as 32-bit floats.
6  Java Game APIs & Engines / OpenGL Development / Re: Precision and value range on: 2015-04-23 14:26:00
Like Kevin said, floats have a "precision" depending on their value, so they are fit for when you're only interested in a limited number of significant digits. However, GPUs use floats. To draw something in fixed precision, just convert your objects to a position relative to the camera, e.g. objectPosition - cameraPosition and render them like that. If your positions are relative to the camera, then floats are suddenly perfect! If something is a lightyear away, it doesn't matter if it's rendered at 10km off since that'll still be the same pixel. So in essence:

1  
2  
3  
4  
5  
6  
long objectX = ..., cameraX = ...;
...

float x = (float)(objectX - cameraX) * SCALE; //SCALE could be (1f/1024f) to achieve ~1mm precision
float y = ...;
float z = ...;


If you are okay with limiting yourself to half the range of a long, you don't even need to worry about overflowing longs during the subtraction. If you DO need the full range of longs, you can handle overflows easily by checking the resulting value and modifying the final long if an overflow occurred.
7  Java Game APIs & Engines / OpenGL Development / Re: Precision and value range on: 2015-04-23 13:29:06
I would strongly recommend using fixed precision for position and velocity. You want uniform precision over the entire space of the game, and you also want uniform precision of the velocity. A satellite orbiting the moon which in turn orbits the Earth which in turn orbits the sun will always have a very high velocity, and with double precision you would get worse local precision. Using a 64-bit long, you get a precision of 0.000512856272 meters, or ~0.5mm precision, way better than your 1m precision you would get with doubles at the edge of the universe.
8  Discussions / General Discussions / Re: Need halp (help) testing native binaries on Mac and Linux on: 2015-04-23 13:03:18
IIRC the working-directory on Mac OS X is the user-dir, not the directory of the double-clicked file / app.
Hmm. Any way of overriding that or getting the path of the double-clicked file? Sounds rather useless otherwise.

Do you think the average user would be okay with just a generic no-extension executable file?

Getting it all in a single executable is probably more work than creating the package file.  Just stick a folder with a shell launcher in an archive.  If you're clever about it you should be able to use the same launcher and structure for OSX and Linux.
Ah, yeah, that's what I meant. Not packing it all up into a single executable, but creating a shell script which boots it all up with the right VM and all.

Oh, the bin/ folder doesn't have javaw. -_____- I wonder why that is...

AFAIK javaw is a Windows-only concept.  I don't have OSX to test, but I noticed your app bundle has a somewhat different structure to mine, and I know mine works!  Wink  As Praxis LIVE is a NetBeans RCP application, it uses the build process from that, which seems to handle this well.  It might be worth having a look at the Praxis LIVE app bundle - IIRC the Contents/MacOS folder just contains a symlink to a folder in Contents/Resources, which has the same structure as the application folder in the zip bundle and .deb package.  All use the same shell launch script, which is part of the NetBeans RCP build, and is used for both OSX and Linux.

Also, I wonder if you're being bitten by issues with working directory, which behaves differently on Windows?  That shell launcher script also has logic in it to find absolute paths to resources based on its own location.
Sigh. This would be so much easier to figure out if I actually had a Mac... Is there any significant difference between how shell scripts behave on Linux and Mac?
9  Discussions / General Discussions / Re: Need halp (help) testing native binaries on Mac and Linux on: 2015-04-22 22:24:56
So clicking it isn't working? Damn it.
10  Discussions / General Discussions / Re: Need halp (help) testing native binaries on Mac and Linux on: 2015-04-22 21:01:27
What kind of executables are Linux users used to? Simply making a shell script and not giving it an extension at all and somehow marking it executable (?) seems to be the way to go here. Is it possible to give such a file a custom icon? Is a desktop entry (.desktop) the way to go to get a custom icon?

Bear something in mind - Linux isn't an OS - Ubuntu (for example) is an OS.  If you want something that's going to properly integrate with icons, etc. you're likely going to have to make a package suitable for the OS.  I've seen a pure-Java RPM builder before, but not sure if there's a .deb builder.  You should be able to make packages very easily in a Linux VM though.

Not sure if you looked at the somewhat hidden link in my reply above - it's a blog post I wrote on how the Praxis LIVE package is built - Packaging as a .deb
Hmm. Is it reasonable to expect Linux users to be less sensitive to stuff like icons? Do you think the average user would be okay with just a generic no-extension executable file?

when I first tried to run on my Mac Book Pro I had an error:

./HelloWorld: line 2: jre/bin/javaw: No such file or directory

I modified the HelloWorld to point to jre/bin/java and it gave a beautiful dialog saying HellWorld.
Thanks a lot for testing!!! That's really weird though. Oh, the bin/ folder doesn't have javaw. -_____- I wonder why that is... Anyway, I've fixed that problem.

One more question: Did it pop up a terminal window or did it start silently?

EDIT: Medal for "HellWorld".
EDIT2: And for helping of course. ^_^
11  Java Game APIs & Engines / OpenGL Development / Re: [LWJGL] Asynchronous batch renderer? on: 2015-04-22 16:36:03
The whole point of persistent mapping is to map stuff once and then leave it mapped forever, so you're doing things a bit wrong so far. Regardless, the driver shouldn't crash from you mapping a buffer twice in a row. I'm not entirely sure what's happening there. Care to show any source?
12  Discussions / General Discussions / Re: Need halp (help) testing native binaries on Mac and Linux on: 2015-04-22 16:30:49
INTRODUCING JAPPIFY

The brand new solution to all the world's problems! Just kidding, it's just a hacked together port of the Appify script.

Jappify source code
Executable jar file (uses command line arguments, see source code)
Test .app generated (JOptionPane hello world, ~40MB due to JRE)

The jar takes in 4 arguments:

 - gamePath: Path to the game's folder which includes the jar and all resource files.
 - relativeJarPath: Path to the jar relative to the base game folder. If your jar is in a folder called "jar" in your game folder, then specify "jar/<jar name>.jar".
 - jrePath: Path to an extracted JRE. It expects the JRE to have the bin/, lib/ and man/ folders along with several files right inside the JRE folder, so you'll need to do some manual unpacking from the .tar.gz JRE file.
 - appName: Name of the generated app.

If anyone could test the .app I created on OSX and/or possibly check and fix the source code if there's any problem somewhere I'd really appreciate it. Debugging stuff on the internet is just too time-consuming... x___x


EDIT: May want to change the classpath of the game it runs to the game folder in the shell script it generates...


I haven't tried it (I also don't have a Mac) but packr says it supports .apps.
Sadly it doesn't handle Oracle JDKs and icons. Good find, though.
13  Discussions / General Discussions / Re: Need halp (help) testing native binaries on Mac and Linux on: 2015-04-22 15:41:40
Yes, I found the Appify program as well, but since I don't have a Mac it's fairly useless for me. >___> Manually composing up a .app folder and packing it to a DMG file seems like the only solution.
14  Discussions / General Discussions / Re: Need halp (help) testing native binaries on Mac and Linux on: 2015-04-22 15:12:18
Hello, everyone. Sorry for the late reply.

I've started an article here for making native binaries for Windows. The next step is OSX and Linux. So far, I am unsure what the best course of action is, as I have very little personal experience with these two operating systems, so before I can get started with testing I need to figure those points out first.

What kind of executables are Linux users used to? Simply making a shell script and not giving it an extension at all and somehow marking it executable (?) seems to be the way to go here. Is it possible to give such a file a custom icon? Is a desktop entry (.desktop) the way to go to get a custom icon?

For Mac I'm even more confused. It seems like the most recommended way of doing this is to create a .app folder which has a specific structure and some configuration files, but in theory shouldn't the same files as on Linux work?
15  Game Development / Articles & tutorials / Professional looking games: bundling JREs and making native executables on: 2015-04-22 14:58:29
Hello, everyone.

This article is about making your game look more professional to the average user.

It can't be denied that there is a certain stigma around Java for use in games. Working on We Shall Wake, both me and other members have encountered people refusing to help or talk with us because we're using Java. I've even written blog posts about why our choice is a good one, but obviously it doesn't help. Obviously, the average gamer doesn't know exactly *why* Java is bad for games, but if they know a game is made with Java and anything at all goes wrong, some people are sadly likely to blame it on Java, and these people are loud.

There are some obvious giveaways for games made in Java. The requirement of a JRE and starting the game using an executable .jar files are both dead giveaways that the game is made in Java, and most importantly they both depend on the player's computer. Being unable to start a game because Java isn't installed without a proper error message, or not being able to start it because the Java HOME variable isn't set properly will cost you quite a few players. More importantly, players shouldn't have to even care that your game is made in Java, and they definitely shouldn't have to install separate programs. In addition, many players are not used to .jar files, bat files and other formats often used to launch Java, so we want to give the player an executable file that they are familiar with. We also want these files to have the icons we specify. Thirdly, we don't want the game to open up with an ugly console/terminal window.

One option is to create an installer which automatically installs a JRE on the client computer and then installs the game. There are many freeware programs that allow the player to create installers. Personally I'm heavily against installers in the first place since the game installation file is just a glorified compressed folder with automatic extraction, and once installed many games are hard to uninstall and may leave files in weird folders all over your computer. I prefer my games portable and confined to a single folder, so an installer is out of the question.

To ease in development, the native executable should not need to be updated for each new build. Preferably it should simply launch the game's executable .jar file for you so the .jar file can be easily updated without having to remake the native executable files. As a bonus goal, the game should pop up as <GameName>.<native extension> in the task manager instead of javaw.<native extension>.

Summary of goals:
1. Being able to run the game without an installed JRE.
2. Being able to run the game without the JAVA_HOME environment variable.
3. No console/terminal window should pop up when the game is started.
4. The game should be started with native executable files on Windows, Linux and OSX.
5. The executables should have custom icons.
6. The native executables should not need to be regenerated when the game is updated.
7. (Bonus): The game should be listed in the task manager by its name instead of javaw.

The goals are achieved by:
1. Bundling a JRE with the game.
2. Directly specifying the relative path to the bundled JRE instead of relying on the environment variable.
3. Using a program to generate OS-specific executables that supports this.
4. Using a program to generate OS-specific executables that supports this.
5. Using a program to generate OS-specific executables that supports this.
6. Having the executables simply launch an OS-independent .jar file that can be updated independently of the native executables.
7. Renaming the bundled JRE's executable javaw file to the game's name.



Getting JREs for all operating systems and architectures

JREs for all operating systems can be found on Java's website (DUH). From there on, go to the JRE download page and download the .tar.gz version of the JRE you're interested in. .tar.gz files can be opened using for example WinRAR, but at least using Chrome the file is somehow renamed to .gz only when downloaded, making it impossible to see the contents of the file. In this case, manually changing the extension to ".tar.gz" solves the problem. Once you have the file opened, it's simply a matter of extracting the jar to you a folder and you have a portable JRE. The javaw executable is located in the bin/ folder. It's also possible to get server JREs for 64-bit architectures.





Windows

Generating an executable for Windows is easy. To generate a .exe file, we simply use Launch4j which supports everything we need except the bonus goal.

1. Download and install =http://launch4j.sourceforge.net/Launch4j.

2. Launch Launch4j. Tongue

3. Enter the path to your game's executable .jar file. Note that this should path is relative to the .exe file you'll generate.

4. Check "Don't wrap the jar, launch only" so that the .jar file can be updated or replaced later without having to regenerate the .exe file.

5. Specify your .ico icon for the .exe file (link to online .ico converter).

6. Head to the JRE tab and enter the relative path to the bundled JRE. Assuming the bundled JRE is in a folder called jre\ in the same folder as the .exe file, this is simply "jre\".

7. Save the configuration because Launch4j hates you if you don't.

8. Generate a .exe file.

9. Profit!

Note: Since Launch4j does not allow you to specify the javaw.exe file in the JRE manually, you can't rename it to the game's name, so Launch4j does not fulfill the bonus goal. Most likely this could be worked around somehow. Suggestions are welcome!



TODO:

Linux

 - Shell script file without an extension for launching? Should be able to launch bundled JRE instead.
 - .desktop entry? Goes against my hate for installers?
 - Other way of setting icon directly of the executable file?


OSX

 - .app package for easy "installation"?
 - Would your average OSX user know what to do with a file the same as for Linux? Not sure what the standard is.



There's an ongoing thread at here for people interested in helping out with expanding the Linux and OSX sections.
16  Game Development / Game Mechanics / Re: Decreasing amount of vertices for a collision cloud on: 2015-04-21 10:42:38
I don't think anyone can implement a good algorithm for reducing the number of vertices in a mesh while retaining its shape somewhat in a reasonable time frame. If it's not a strict requirement, you should try to avoid it since it'll take lots of time.
17  Discussions / General Discussions / Need halp (help) testing native binaries on Mac and Linux on: 2015-04-21 01:11:49
Hello. I am looking for people who happen to have a Mac and/or a Linux computer to test some simple native binaries. I am working on some deployment related stuff like embedding a JRE so people don't need Java and making our game look more professional with native binaries. This requires some testing, and I'm all out of Linux and Mac computers. If someone could lend me an hour of their times, I could probably figure this out relatively quickly. I'd prefer to work over Skype, but JGO PMs would work too. Please post in this thread if you are interested in helping out and I will PM you my Skype name. All findings will eventually be posted to this forum within a few a days of course.

Thank you for your time.

PS: Apparently "Need help testing native binaries on Mac and Linux" is not an informative subject of a thread. >___>
18  Game Development / Game Mechanics / Re: Decreasing amount of vertices for a collision cloud on: 2015-04-21 00:20:35
The easiest way would probably be to generate a low-poly version of your mesh externally and just load in that mesh instead.
19  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-04-20 21:07:44
Submitted the first version of my bachelor thesis on the order-independent transparency algorithm I came up with.

EDIT: Reworded because words are hard.
20  Discussions / General Discussions / Minor forum bug on: 2015-04-18 23:18:30
There's a really tiny forum bug. If you press on the "My mentions" tab, both the Home and the My mentions buttons get selected.
21  Discussions / General Discussions / Re: Where can I find fast spatial querying? on: 2015-04-16 09:22:29
Grids are good. They're extremely easy to query (loop over grid tiles that intersect the query area) and they're fast to maintain (check if all objects still are inside their grid tile. If not, remove from current tile and add to the correct tile).
22  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-04-14 16:21:49
I upgraded my directional light shader and cascade handling code to handle a variable number of cascades as well as avoiding all branches in the shader. Before, all directional lights used 4 cascades. Now, by changing a simple variable, I can configure a specific directional light to have 1 to 6 cascades (point lights need 6 shadow maps, so up to 6 can fit in the same shadow map). Shadows for the whole scene is now possible!



Next up: Frustum fitting to fit each cascade to the depth range it's supposed to cover instead of wasting 75% of each cascade's area.
23  Game Development / Game Play & Game Design / Re: SSAO Problem on: 2015-04-14 09:32:47
Your normals should only be processed by the object normal matrix and the view normal matrix. A normal matrix can be generated by taking a matrix, setting its translation part to 0, inverting it and then transposing it. In LibGDX, that's
1  
2  
3  
viewNormalMatrix.set(viewMatrix).setTranslation(0, 0, 0).inv().tra();

objectNormalMatrix.set(objectMatrix).setTranslation(0, 0, 0).inv().tra();


You can NOT multiply the normals by the view matrix or the projection matrix.

EDIT: Also, there is a way of calculating a normal from the linear depth buffer by looking at (at least) 3 different depth values, converting them to view space positions and then doing a cross product. This produces incorrect normals at depth discontinuities, and will look horrible on noisy objects like vegetation and many other things, hence it's preferred to get the normal stored.
24  Game Development / Game Play & Game Design / Re: SSAO Problem on: 2015-04-13 23:35:16
It looks like you're getting self-occlusion, e.g. that objects are shadowing themselves. Your shader also is a bit weird. You don't even use the position and viewSpaceSample variable after calculating it. Your SSAO should compare the view-space position of each sample with the view-space position of the pixel being processed.

Try something like this in your loop:

1  
2  
3  
4  
5  
6  
vec3 sampleVector = viewSpaceSample - position; //3D vector from pixel to sample

float normalWeight = clamp(dot(normal, normalize(sampleVector)), 0.0, 1.0); //Gives higher weights to samples in the direction of the normal ("in front of" the pixel)
float distanceFalloff = clamp(1.0 / (1.0 + length(sampleVector)), 0.0, 1.0); //gives higher weight to samples close to the pixel

occlusion += normalWeight*distanceFalloff;


You also probably want to add a random rotation to your offsets to trade the banding for noise, which can be removed by blurring the result.
25  Game Development / Newbie & Debugging Questions / Re: Shadowmapping depth bias on: 2015-04-13 23:25:50
No drivers I've ever used have had problems with sampler2DShadow, and our game has been run on a lot of different computers. I personally test it on an AMD, an Nvidia and an Intel card at home, and none of them have ever had problems with hardware shadow testing.

About textureProj(), it is a bit redundant nowadays. Graphics cards don't actually have hardware for the projection anymore, so the w-divide is simply done in "software". textureProj() also isn't usable if you're doing PCF, as if you're taking multiple samples you need to do the z-divide first to not mess up the sampling offsets of the extra samples. Definitely use shadow samplers, but textureProj() you can avoid.
26  Game Development / Newbie & Debugging Questions / Re: Shadowmapping depth bias on: 2015-04-13 09:27:30
Your edit is correct. The problem with shadow mapping is that to be able to do a mathematical comparison between a projected fragment and the shadow map, you'd need both infinite floating point precision and infinite shadow map resolution. To avoid this, we use a bias. The thing is that GPUs have a way of pushing everything away from the light when rendering the shadow map. This is a better time to apply it, as the bias calculation can take the slope of the triangles being rendered into account. When rendering the shadow map in the first pass, call glEnable(GL_POLYGON_OFFSET_FILL), then glPolygonOffset() to tweak the setting. Remember to disable it afterwards.

GPUs also support hardware depth comparisons. In addition, it also supports doing 4 depth tests and bilinearly interpolating between the result of the depth test to achieve some basic filtering:

Without:


With:


These both run at the same speed (the FPS counter at the top is affected by the screenshot saving). See the shadow mapping part of this page http://www.java-gaming.org/index.php?topic=28018.0 to learn how to set it up. It's quite simple.
27  Game Development / Newbie & Debugging Questions / Re: Shadowmapping depth bias on: 2015-04-12 23:24:47
1. Use hardware depth testing instead. It's faster and gives you free bilinear filtering.

2. Use glPolygonOffset() to apply the bias when rendering the shadow map instead of when sampling it. glPolygonOffset() can use the slope of the triangle to dynamically pick a bias, which is better than you can code yourself.
28  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-04-10 09:00:40
Finally managed to work around an AMD driver bug that's been in the drivers since OGL 4 came out. Basically, when using BPTC texture compression, the AMD driver throws a GL_INVALID_OPERATION error when I try to update a texture with glCompressedTexSubImage2D(). To avoid this, I fell back to S3TC if the BPTC extension wasn't supported OR it failed to pass this simple test without an error:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
         int tempTexture = glGenTextures();
         glBindTexture(GL_TEXTURE_2D, tempTexture);
         glTexImage2D(GL_TEXTURE_2D, 0, ARBTextureCompressionBPTC.GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, (ByteBuffer)null);
         
         //This fails if running on AMD
         glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, ARBTextureCompressionBPTC.GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB, BufferUtils.createByteBuffer(16));

         glDeleteTextures(tempTexture);
         
         if(glGetError() == GL_NO_ERROR){
            supportsBPTC = true;
            System.out.println("Test passed, enabling BPTC compression.");
         }else{
            supportsBPTC = false;
            System.out.println("Test failed! Falling back to S3TC.");
         }


I finally found a way to work around this. If the texture is allocated using ARBTextureStorage (glTexStorage2D()) instead, glCompressedTexSubImage2D() works as expected with BPTC! Oh, the things I do for AMD... At least glTexStorage2D() is slightly faster to do than one glTexImage2D() for each mipmap level, which reduces the stuttering from texture streaming in the background.

Fun fact: Insomnia is based on OGL 3.2 Core profile, but can take advantage of a number of extensions to improve performance and efficiency:

 - Texture Storage to work around driver bugs and reduce stuttering when loading textures.
 - BPTC texture compression to improve the quality of color textures.
 - Base instance to improve performance when rendering instanced stuff (which is pretty much all models in Insomnia).
 - Multi draw indirect to improve performance when rendering models to shadow maps that don't require texture binds per model type.
29  Game Development / Newbie & Debugging Questions / Re: Textured Greedy Mesh on: 2015-04-09 17:14:17
Linear filtering can cause bleeding. Try to use GL_NEAREST for both.
30  Game Development / Newbie & Debugging Questions / Re: Textured Greedy Mesh on: 2015-04-09 15:30:34
What kind of filtering do you use on the texture?
Pages: [1] 2 3 ... 95
 
BurntPizza (28 views)
2015-04-23 03:42:11

theagentd (32 views)
2015-04-22 16:23:07

Riven (45 views)
2015-04-16 10:48:47

Duke0200 (54 views)
2015-04-16 01:59:01

Fairy Tailz (39 views)
2015-04-14 20:13:12

Riven (42 views)
2015-04-12 21:36:37

bus hotdog (58 views)
2015-04-10 02:39:32

CopyableCougar4 (63 views)
2015-04-10 00:51:04

BurntPizza (62 views)
2015-04-06 22:06:58

ags1 (62 views)
2015-04-02 10:58:48
How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
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!