Java-Gaming.org Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (604)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (654)
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 ... 100
1  Discussions / Miscellaneous Topics / Re: File replacing bat/sh file! on: 2015-08-03 04:13:12
Ohhhh!!!! Thank you!

One thing though, I want to delete all files that have a .new version of them and replace them with the new version. I don't want to keep the .old ones. Also, does this script recursively process all subfolders as well?
2  Discussions / Miscellaneous Topics / Re: File replacing bat/sh file! on: 2015-08-03 03:02:04
After much work I've come up with this little bat script. It checks all files in the same folder (and all subfolders) for files that have the ".new" extension and overwrites the old files using move commands.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
@echo off

echo Checking directory...
call :updateFiles

echo Starting updater!
java -jar updater.jar

exit /b



:updateFiles

for /R %%f in (*.new) do (
    move "%%f" "%%~nf"
    echo Updated %%~nf!
)

for /D %%d in (*) do (
    cd %%d
    call :treeProcess
    cd ..
)

Now to do the same using an .sh script...  Emo
3  Discussions / Miscellaneous Topics / File replacing bat/sh file! on: 2015-08-03 02:09:30
Hello, everyone!

I have a rather interesting problem. I'm trying to create a self-updating launcher, but I am having some problems, especially on Windows. Windows won't let me modify any file in any way, so it seems like I'll need native code for that. The simplest way would be to have the launcher download all updated files with the file extension ".new" added and then execute a small script that scans through the directory and overwrites all old files with their new version. That allows the JVM to unload all files that it used and the script can update everything without any problems. The problem is writing said scripts as I have limited experience with .bat scripts and pretty much no experience with .sh scripts. >___<

I'm currently looking into how to do this with a .bat script, but I will most definitely need help with the .sh version. It'd be great if someone could help me out with it! Help with the .bat file would also be much appreciated!
4  Game Development / Performance Tuning / Re: Disabling floating point denormals on: 2015-08-02 20:32:34
The latest LWJGL build (3.0.0b #9) includes bindings to the SSE control register macros.
Can you clarify a little what this is useful for?
5  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-08-02 14:18:29
Yep! That looks perfect! Functions to add, subtract and multiply values per element would be useful too, both normal and 4x3 versions.
6  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-08-02 13:54:07
Vector3.setLength(factor) would be faster than v.normalize().mul(factor). In GLSL-speak: (vector.xyz / length * factor) is 6 instructions. vector.xyz * (factor/length) is only 4. It's a small detail, I guess. Something that would be more useful would be a Vector3*.clampLength(float maximum), which makes sure that the length of the vector isn't above the given value. I use that for clamping motion vectors and velocity vectors to a maximum length.

Matrix.fma() is probably not as useful as it was with LibGDX, but it's still my preferred way of doing skeleton animation. In skeleton animation you have up to 4 bone matrices and 4 bone weights. With some GLSL syntax to make it clearer what's happening:
1  
2  
3  
4  
5  
Vector3f inputPosition = ...;
Vector3f result = new Vector3f();
for(int i = 0; i < boneCount; i++){
    result += (boneMatrix[i] * inputPosition) * boneWeight[i];
}

The boneMatrix*inputPosition can be done using a 4x3 multiplication. We do 3 dot products (3 muls + 2 adds) plus add a translation, which equals 6*3=18 instructions per 4x3 matrix multiplication. We also multiply by the bone weight, another 3 muls, and add the result to the result vector, for a total of 18+3+3 = 24 instructions per bone. That's a total of 96 instructions per vertex.

Another way of calculating this is to do something like this:
1  
2  
3  
4  
5  
6  
Vector3f inputPosition = ...;
Matrix4f skinningMatrix = new Matrix4f().zero();
for(int i = 0; i < boneCount; i++){
    skinningMatrix += boneMatrix[i] * boneWeight[i]; //Scalar multiply of matrix
}
Vector3 result = skinningMatrix * inputPosition;

This translates to 16 muls with the bone weight plus 16 adds to the skinning matrix per bone plus 18 instructions for the final multiply at the end, for a total of 146 instructions. Why would you do this? Normals. If you also have normals, the first one needs to do another 4 matrix multiplies for a total of 8. In the second one, you can reuse the calculated skinning matrix for both positions and normals, so in total you do 4 matrix fma()s and 2 bone multiplies, which is faster (192 vs 164 instructions). In addition, as you know LibGDX was not as fast as JOML so this actually translated to a really big performance increase.

Fun fact: GPUs actually have a MULADD (fma) instruction to do a multiply and add in the same clock cycle. A matrix4x3 * vec4(x, y, z, 1.0) multiply therefor only takes 9 instructions to accomplish. The same works for fma'ing matrices together as the weight multiplication can be done together with the summing. In addition, I use a matrix4x3 for the skinning matrix. On a GPU, this means that (with normal transformation) the first technique takes 96 instructions vs 66 instructions for the second technique.
7  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-08-01 04:39:13
Preliminary performance results:

 - LibGDX: 48 FPS
 - JOML: 68 FPS

Skeleton animation seems to be almost exactly twice as fast. JOML uses slerp() from LibGDX. Once I integrate the frustum culling optimizations JOML had I should be able to cram out a tiny bit more performance.
8  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-31 20:21:55
Lightly started experimenting with converting WSW and Insomnia to JOML. I will be editing this post as I find features I'm missing. KaiHH, you may want to add me on Skype so we can communicate through chat there (same username as here).

 - Matrix3f/d.set(Matrix4f/d): copies rotation of 4D matrix.

 - Matrix4f/d.getTranslation(Vector3f/d): opposite of setTranslation(). Stores result in provided vector.

 - Matrix4f/d.getScale(Vector3f/d): gets the scale of the X, Y and Z axes. Stores result in provided vector.

 - Vector3f/d.distanceSquared(Vector3f/d): calculates the squared distance between two points.

 - Vector3f/d.lerp(Vector3f/d, float/double alpha): does linear interpolation between two vectors.

 - Vector3f/d.project(Matrix4f/d): same as mul(Matrix4f/d), but also calculates resulting w value and divides by it at the end. Proposed implementation:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
    public Vector3d prj(Matrix4d mat, Vector3d dest) {
       double w = mat.m03 * x + mat.m13 * y + mat.m23 * z + mat.m33;
        if (this != dest) {
            dest.x = (mat.m00 * x + mat.m10 * y + mat.m20 * z + mat.m30) / w;
            dest.y = (mat.m01 * x + mat.m11 * y + mat.m21 * z + mat.m31) / w;
            dest.z = (mat.m02 * x + mat.m12 * y + mat.m22 * z + mat.m32) / w;
        } else {
            dest.set((mat.m00 * x + mat.m10 * y + mat.m20 * z + mat.m30) / w,
                     (mat.m01 * x + mat.m11 * y + mat.m21 * z + mat.m31) / w,
                     (mat.m02 * x + mat.m12 * y + mat.m22 * z + mat.m32) / w);
        }
        return this;
   }


<<<FATAL BUG>>>: Vector3d.mul(Matrix4d mat, Vector3d test) DOES NOT ADD THE TRANSLATION! It does NOT assume that w=1.0 despite the JavaDoc saying so! Fixed version:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
    public Vector3d mul(Matrix4d mat, Vector3d dest) {
        if (this != dest) {
            dest.x = mat.m00 * x + mat.m10 * y + mat.m20 * z + mat.m30;
            dest.y = mat.m01 * x + mat.m11 * y + mat.m21 * z + mat.m31;
            dest.z = mat.m02 * x + mat.m12 * y + mat.m22 * z + mat.m32;
        } else {
            dest.set(mat.m00 * x + mat.m10 * y + mat.m20 * z + mat.m30,
                     mat.m01 * x + mat.m11 * y + mat.m21 * z + mat.m31,
                     mat.m02 * x + mat.m12 * y + mat.m22 * z + mat.m32);
        }
        return this;
    }


 - Vector3f/d.setLength(float/double): normalizes the vector to a given length (lengthArgument/sqrt(x*x+y*y+z*z)).

 - Matrix*f/d.add(Matrix*f/d): sums up each element in the matrices.
 - Matrix*f/d.sub(Matrix*f/d): you get it.
 - Matrix*f/d.fma(Matrix*f/d): multiply and add version (EXTREMELY useful for skeleton animation).

 - Matrix*f/d.scale(Vector*f/d): scale and scaling function with vector parameter.
 - Matrix*f/d.scaling(Vector*f/d): scale and scaling function with vector parameter.

 - Matrix*f/d.get() functions that work on ByteBuffers instead of Float/DoubleBuffers.

 - Vector3f.mul(Matrix3/4d): to multiply float vectors by double matrices.
 - Vector3f.project(Matrix4d): to project float vectors by double matrices.

 - A function to normalize the rotation part of a 3D or 4D matrix. This is useful since after generating a normal matrix, the axes are probably not unit.

<<<FATAL BUG>>>: Matrix4d.rotate() resets the scale of the matrix somehow. I can't figure out how, but it does.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
System.out.println(new Matrix4d().scaling(0.0000001).rotate(0, 0, 1, 0));
/*
WRONG:
  1,000E+0  0,000E+0  0,000E+0  0,000E+0
  0,000E+0  1,000E+0  0,000E+0  0,000E+0
  0,000E+0  0,000E+0  1,000E+0  0,000E+0
  0,000E+0  0,000E+0  0,000E+0  1,000E+0
*/


System.out.println(new Matrix4d().rotation(0, 0, 1, 0).scale(0.0000001));
/*
CORRECT:
  1,000E-7  0,000E+0  0,000E+0  0,000E+0
  0,000E+0  1,000E-7  0,000E+0  0,000E+0
  0,000E+0  0,000E+0  1,000E-7  0,000E+0
  0,000E+0  0,000E+0  0,000E+0  1,000E+0
*/



 - Vector3f/d.rotate(Matrix4f/d): Multiplies a vector by only the rotational part of a 4D matrix (= assume w=0) (= what mul() does now due to the bug).

<<<FATAL BUG>>>: The Matrix4d.normal(Matrix3d dest) fast path produces incorrect results. Commenting out the fast path causes the function to calculate correct normal matrices.

<<<FATAL BUG>>>: The Quaternionf.slerp() tends to produce NaN every now and then. I replaced the implementation with that of LibGDX and my performance sky-rocketed. You DEFINITELY need a better implementation.
9  Game Development / Performance Tuning / Re: Disabling floating point denormals on: 2015-07-31 16:51:55
Shouldn't there be a library for this? It sounds like it'd be useful. Maybe someone feels obliged to make one? =P
10  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-07-31 02:33:43
Well, SkyAphid's declared war on artists after a number of the ones we paid didn't deliver, so here we are constructing 3D models out of concept art. SkyAphid had an idea for a pretty cool algorithm and I implemented it. It actually works pretty well.



EDIT: Fixed link.
11  Discussions / Miscellaneous Topics / Re: Looking for early testers for We Shall Wake Demo 7 on: 2015-07-29 13:53:05
We've already managed to mash most bugs. Unless you have a Linux or Mac computer to test on, we're not looking for more testers right now.
12  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-07-27 19:16:46
Adding lerping to Riven's algorithm does not have any noticeable performance impact in my grass simulation, so I will roll with that. Adding lerping reduces the error to 1/200th of just reading a single value, allowing for a smaller lookup table more likely to be in the cache.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
   public static final float sin(float rad) {
      float index = rad * radToIndex;
     
      float alpha = index - (int)index;
     
      int i = (int)(index) & SIN_MASK;
     
      float sin1 = sin[i+0];
      float sin2 = sin[i+1];
     
      return sin1 * (1f-alpha) + sin2*alpha;
   }

I also expanded the sin[] to hold an extra value when the last element of the array is indexed like philfrei did. IMO this is the best performance/quality tradeoff.
13  Game Development / Shared Code / Re: Extremely Fast atan2 on: 2015-07-25 21:53:22
Random.nextFloat() is dominating that benchmark.
14  Game Development / Shared Code / Re: Extremely Fast atan2 on: 2015-07-25 21:39:39
I had some big sine performance problems for the grass wind simulation in WSW. Ended up using a look-up table without any interpolation as my precision requirements were extremely low and it was faster by a magnitude. I find i hard to believe an approximated sin() is slower than Math.sin(). I can test it in WSW when I get back home tomorrow.
15  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-23 08:38:07
@Spasi

- You always need a position to know where to write. For limit, either you already know the size of your data and have a buffer that has the exact same size so limit==capacity, or your data is smaller than your buffer, in which case you probably NEED a limit to show the number of relevant bytes in the buffer.

- That's how the entirety of NIO works though.

- It's a newbie problem, sure, but knowing that you should always flip after writing to it is easier than having to figure out if you should flip or not. Not writing position just makes you keep track of the position yourself, and possibly set the limit and position at the end with flip anyway. Following NIO's way is better IMO.


My vote goes to incrementing position for consistency with NIO.
16  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-07-21 21:15:59
Got my three monitors + VESA stand all up and running Cheesy
Nice! How is this wired/cabled? Any particular video card needed to have 3 monitors? Is 4 a possibility?
Most cards nowadays support 4 monitors (3 for gaming + 1 extra), but you'll need to use whatever cable connectors your card has. You may have to plug in 2 through DisplayPort, 1 through DVI, 1 through HDMI or something like that. My 3 monitors only have DVI inputs, so I need 2 cards to connect all of mine.
17  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-21 17:30:30
With only 1 bone, JOML goes up to 33 344k and native JOML to 9 290k. Benchmarking only sequence.call() gives 16 284k bones per second, which is still ~half as fast as normal JOML. Argument buffer building is of course unaffected.

My guess is that the only way to benefit from SSE would be to port the entire skeleton animation to native code. That of course means that I might as well write the entire game in C instead. >____>

Still, please don't be discouraged. JOML still has a huge number of advantages for the average user.

EDIT: Also, the reason LibGDX uses a native function for matrix multiplications could be because they're faster on Android. I've heard that HotSpot is much more flakey there, and it's possible the overhead of calling a native function is lower (just a guess) so it might simply be an optimization for low-end hardware at the cost of high-end performance.
18  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-21 16:48:41
Bad news. It's slow.

Librarybones per second
LibGDX12 452k
JOML (mul4x3)31 251k
JOML native6 346k
JOML native, only sequence building11 339k
JOML native, only sequence.call()13 601k

It looks hopeless. The native version is 1/5th as fast as the normal version. Just building the sequence is 1/3rd as fast as the normal version, and even if I only benchmark sequence.call() only it's still less than half as fast as the normal version. Looking at the code, I can see that the argument and opcode buffer building is very inefficient. putArgs() is called 12 times for translationRotateScale(), which checks the buffer size 12 times when once should be enough. I tried to optimize that to see if it made a difference, but only managed to crash Java.exe. Still, it looks hopeless since call() itself is half as fast as the normal version.

EDIT: My test source code: http://www.java-gaming.org/?action=pastebin&id=1310
19  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-21 14:02:04
I'm not entirely sure how to try it out. I could extend the benchmarks I've made so far to also test NativeMatrix4f I guess, but I'm not sure how the code works anymore? @__@
20  Discussions / Miscellaneous Topics / Re: Looking for early testers for We Shall Wake Demo 7 on: 2015-07-20 22:20:37
We've fixed a number of problems. Update with the launcher.
 - Fixed extreme load time on Intel GPUs.
 - Fixed Lambaste not spawning enemies due to the launcher not syncing certain files.
 - Minor controller fixes.
 - Minor fixes to physics and controls in general.
21  Discussions / Miscellaneous Topics / Re: Looking for early testers for We Shall Wake Demo 7 on: 2015-07-19 22:51:18
I've sent information to the people who contacted me. Please follow the instructions in that PM.

I don't think I'll have the spare time to play through it and test for those kind of bugs, but I can check it works on linux with catalyst and/or radeon drivers if you're in need of that.
I was unable to send you the PM as the limit is 5 per hour. I'll need a tiny bit of help to try out the Linux version, so if you have time please contact me on Skype (same user name as here) so we can coordinate that.
22  Discussions / Miscellaneous Topics / Re: Looking for early testers for We Shall Wake Demo 7 on: 2015-07-19 03:41:09
Thank you for your responses! We were planning on sending you the demo tonight, but we ended up spending the entire evening/night evening out some rough corners and polishing. The demo is essentially ready though, so we will be sending it to you guys as soon as possible tomorrow.
23  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-19 02:55:31
Wait, so I could literally convert any function to use SSE instructions? Would this cause some kind of JNI overhead? I am not very intimate with these kind of low-level instructions, so I'm sorry if I'm misunderstanding something.
24  Discussions / Miscellaneous Topics / Looking for early testers for We Shall Wake Demo 7 on: 2015-07-18 19:20:15
Hello.

We've basically finalized the features of demo 7 of We Shall Wake, but we're looking for some early technical and gameplay feedback from testers before we release it to the public to ensure everything goes smoothly on the actual release on August 5th. Note that we only need a limited number of people. We need people who are willing to play the game for some time hunting for bugs, not just people who want an early look on the demo.

If you are interested in being a tester, please either PM me or respond to this thread.

Thank you for your time!
25  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-07-18 12:45:33
@theagentd: also almost done with the "rotate" part of translationRotateScale, which will soon be in.
Hmm? The native version of it?
26  Discussions / Miscellaneous Topics / Re: [Giveaway] Steam keys for Biodrone Battle on: 2015-07-17 11:42:31
Sounds interesting! I'd love to try it out!
27  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-16 12:27:08
Update: keep in mind you are creating this side-projects that only a handful of people will understand, and eventually nobody will use. I've been there with LibStruct. I think it's cool tech, but even though I'd deem it simple to use, it's too complex for 'the 99%', and the remaining people can't be bothered jumping through hoops, as the benefits of the library seem not to outweigh the complexity cost.
LibStruct was a bit of an extreme case though. Having classes being converted to structs is a gigantic minefield as you don't have any compile-time checks, and a huge number of things that Java programmers are used to doing are simply not supported. That in combination with the sometimes confusing ways it failed made it hard for me to justify the overhead, especially since the gains were minimal on my own CPU (but substantial on AMD CPUs).

The complexity of the system I proposed is nowhere near as high or intrusive. If you know how to use the standard Matrix4f class, it's not a big leap to understand the Sequence object and that all operations are queued in it. It's also not very confusing or full of pitfalls if you use builder methods that take care of argument filling etc. The only thing that can cause VM crashes is feeding invalid op codes or arguments to the native processor, and that can be hidden by abstraction.
28  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-15 23:07:07
The reason I proposed that was for the simplicity of it. It might not have as insanely good performance as possible alternatives, but it does seem extremely easy to implement. The only real addition you have to make is to create a Sequence and make the matrices "native". That's convenient enough for people to be able to use it in every-day scenarios.
29  Java Game APIs & Engines / OpenGL Development / Re: [LWJGL3] Experiencing weird crash on glUseProgram when started in fullscreen on: 2015-07-15 12:25:12
Definitely a driver bug. Try updating your Intel drivers.
30  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-07-15 10:40:21
SENPAI NOTICED ME! Time to start subscribing to /r/TsundereSharks!

(Nvidia responded to the bug report I sent weeks ago! First time they've actually responded!)
Pages: [1] 2 3 ... 100
 
SHC (28 views)
2015-08-01 03:58:20

Jesse (20 views)
2015-07-29 04:35:27

Riven (40 views)
2015-07-27 16:38:00

Riven (22 views)
2015-07-27 15:35:20

Riven (25 views)
2015-07-27 12:26:13

Riven (15 views)
2015-07-27 12:23:39

BurntPizza (36 views)
2015-07-25 00:14:37

BurntPizza (46 views)
2015-07-24 22:06:39

BurntPizza (31 views)
2015-07-24 06:06:53

NoxInc (37 views)
2015-07-22 22:16:53
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

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
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!