What I did today

My beginning JavaFX tutorial crossed 150,000 hits on Friday (two days ago). Was fun seeing 149,999 and then 150,002 a couple hours later.

Let’s say 2/3rds of the people who arrive leave quickly because whatever reason.
Let’s say of those who stay longer, they average 5 return visits.
If those are valid estimates (are they?) that would still give 10,000 individuals (mostly beginners) coding or attempting to code a JavaFX game.
What is this site doing to retain them? Could we do more?

There are maybe a handful of people here that think JavaFX legit? More folks, it seems to me, are interested in Libgdx/lwjgl. Which is fine.

But, for example, nurture JavaFX somewhat and a significant proportion will eventually decide to give Libgdx a try as they grow in skills and confidence?

Last night YouTube recommended me a GDC talk on interpolation functions and I was bored. They talked about interpolation/easing/tweening functions as composition of simpler functions, thought it be cool to play around with that. So I built this tool which allows you to quickly put together these functions and see what each component does.

Re-evaluated java.lang.Math.fma() for performance again. I did an evaluation with JDK 9, where it actually was slower than a manual multiplication and addition, but now the situation changed (at least with JDK 12 and JDK 14).
Benchmark of JOML’s methods:


Benchmark           Mode  Cnt   Score   Error  Units
Without fma JDK 14
Matrix4f.invert     avgt    5  24,695 ± 0,179  ns/op
Matrix4f.mul        avgt    5  15,308 ± 0,081  ns/op
Matrix4f.mulAffine  avgt    5   9,588 ± 0,065  ns/op
Without fma JDK 12
Matrix4f.invert     avgt    5  23,706 ± 0,429  ns/op
Matrix4f.mul        avgt    5  15,279 ± 0,322  ns/op
Matrix4f.mulAffine  avgt    5   9,152 ± 0,087  ns/op
With fma JDK 14
Matrix4f.invert     avgt    5  21,583 ± 0,093  ns/op
Matrix4f.mul        avgt    5  11,779 ± 0,110  ns/op
Matrix4f.mulAffine  avgt    5   8,333 ± 0,124  ns/op
With fma JDK 12
Matrix4f.invert     avgt    5  20,997 ± 0,382  ns/op
Matrix4f.mul        avgt    5  12,330 ± 0,146  ns/op
Matrix4f.mulAffine  avgt    5   8,323 ± 0,137  ns/op

Now, it is very unfortunate that the JDK does not contain a method to check whether FMA3 instructions are actually supported by the CPU…
So one can either hope that they are supported and get better performance by the JIT emitting such instructions or one gets abyssimal performance by BigDecimal approximations when using java.lang.Math.fma() but the CPU not supporting it. So I end up having a small JNI library querying cpuid().

Got drunk yesterday lol. Happy New Year to everyone!

Hopefully you call stay safe are not as hungover as I’m and can reach your goals this year :slight_smile:

Refactored all uses of [icode]1.0 / sqrt(x)[/icode] into a separate method and found a few cases where [icode]float v = (float) (1.0 / Math.sqrt(x));[/icode] was used instead of the much faster [icode]float v = 1.0f / (float) Math.sqrt(x);[/icode] (with a [icode]float x;[/icode]).
The first uses a double-precision vcvtss2sd cast, followed by vsqrtsd square-root, vdivsd and a vcvtsd2ss cast, whereas the latter uses the much faster two single-precision instructions vsqrtss and vdivss.
So, even though java.lang.Math.sqrt(double) takes a double, the JVM will see that you cast the result immediately to a float and omit the argument cast to double as well as the return value cast to float, but use the single-precision intrinsic.
(besides: it’s such a shame, that Java does not expose vrsqrtss…)
EDIT: The same btw. goes for Math.sin/cos.

Spent the day making a new color picker for LWJGUI! :slight_smile:

Live CSS editing in the Game Engine me and @Guerra2442 are creating

Great feature! https://github.com/orange451/LWJGUI deserves more stars! :slight_smile:

Also, because this bugs me everytime I see it :wink:
“Live CSS editing in the Game Engine I and @Guerra2442 are creating” or even better: “…@Guerra2442 and I are creating”.
You also wouldn’t say: “The milk that me am buying.” You would say “The milk that I am buying.”
Because I is the subject (the one acting) in this sentence. And it’s no different when multiple subjects are present: “The milk that he and I are buying.”
Also wrong (all subjects turned into objects): “The milk that him and me are buying.”
Such mistakes become apparent when you simply leave one subject out of the sentence (omit “and me”): “The milk that him is buying.”
An enumeration of multiple subjects does not suddenly turn a subject (“I” or “he” as someone acting) into an object (“me” or “him” as someone being acted upon).
It is always I in such cases and never me.

Implemented Area Lights using the SIGGRAPH 2016 paper Real-Time Polygonal-Light Shading with Linearly Transformed Cosines, the same one that @KaiHH used a while back. It took longer than expected but the results are quite nice.

I’ve been MIA for a while, but I’ve got a lot done on my game and implemented 2 more missions. Been working hard on Saint’s Row, I hope some of you guys play this game when it comes out, it’s gonna be pretty sweet.

Edit: MY game is NOT Saint’s Row.

Made a small script for Blender that automatically renders spitesheets for multi part models:

import bpy

projectname = bpy.path.display_name_from_filepath(bpy.data.filepath)

folderpath = "//render/" + projectname + "/"

scene = bpy.data.scenes["Scene"]

print("Rendering spritesheets for", projectname)

render_objects = [bpy.data.objects.get("Root")]

i = 0

# Collect Objects
while i < len(render_objects):
    
    obj = render_objects[i]
    
    i = i + 1
    
    for obj_child in obj.children:
        render_objects.append(obj_child)


# Hide all objects
for obj in render_objects:
    obj.hide_render = True

# Unhide, render and hide again if type is mesh
for obj in render_objects:
    
    if obj.type != "MESH":
        continue
    
    obj.hide_render = False

    # Move object to origin
    location_backup = obj.location.copy()
    rotation_backup = obj.rotation_euler.copy()
    obj.location = [0,0,0]
    obj.rotation_euler = [0,0,0]
    
    print("Rendering part:", obj.name)
    
    for frame_current in range(scene.frame_start,scene.frame_end):
        
        filepath = folderpath + projectname + "_" + obj.name + "_" + str(frame_current) + ".png"
        
        scene.frame_current = frame_current
        
        bpy.context.scene.render.filepath = filepath

        bpy.ops.render.render(write_still=True)
        
        
    obj.hide_render = True
    
    obj.location = location_backup
    obj.rotation_euler = rotation_backup

scene.frame_current = scene.frame_start

print("Finished.")

Automating stuff in Blender is such a breeze, you don’t have to install or setup anything, just start programming inside blender, you can directly access any piece of data or function that the program uses internally. I can only recommend you to try it out if you use Blender yourself.

Wrote a little tutorial about the order in which matrix transformations can be viewed and what effect the different orders have: https://github.com/JOML-CI/JOML/wiki/Tutorial---Matrix-Transformation-Order
Program used for the graphs/illustrations: https://github.com/JOML-CI/joml-lwjgl3-demos/blob/master/src/org/joml/lwjgl/CoordinateSystemDemo.java

I resumed working on the Simplex-Noise visualizer I wrote something like 7 years ago. Since it is public code (on github), I wanted to try and dress it up a little before officially starting to see if I can get a new programming job. Part of this also about giving my wife some experience with github’s Markdown as she’s also looking for a new job, has editing skills, and is interested in learning more about the tech context.

Multiple headaches, though! The code is tough to revise, a LOT of refactoring needed. I was only so far along in figuring out how to write good code when I wrote this. I’ve managed some in the last couple days, fixed a few bugs (and along the way found a few more and fixed them). I managed some improvements to the “animator” making it easier to use, and did some jiggering around with the GUI so the position of the sections makes better workflow sense. That was painful, as my understanding of Swing has never been very solid. JavaFX is so much easier to work with!

New thing added: SIVI now can generate the textures with either Gustafson’s SimplexNoise implementation, or OpenSimplexNoise, which I am making the default noise engine. I wrote an Interface that should make it easy to add more 2D noise generation engines. Any suggestions on which would be interesting to add? (A good Java Improved Perlin implementation out there somewhere?) I suppose it would be also possible to adapt other types of noise-generation as well, besides gradient noise.

The lattices on OpenSimplex seem to be spaced farther apart than with Simplex. Is this true? It should be possible to include a scaling factor as part of the adaptor code, to bring the various types of noise-engines more into alignment.

Are people even interested in this type of texture generation any more? Is there new, faster tech that has replaced it that I haven’t heard about?

I will post a link when the update to the git repository happens. I noticed that my images on the old SIVI thread have gone dead. That’s another task: my Linode isn’t yet set up to receive the domain name that I used for those links.

Created a new simple risk like game where you can easy create your own ai.

OK. The changes to the SIVI repository are up.

Here is a screen shot of the GUI.

Here is the source code. It’s pretty easy to download, unzip and run a couple shell commands. Uses Java 11.

    javac -d compiled/ --module-source-path sivisource -m siviModule
    java -p compiled/ -m siviModule/com.adonax.sivi.LaunchSivi

There’s still a fair amount of refactoring that should be done, but the project is in much better state now than it was. IDK if there is any interest in building onto this. I think some pretty cool things could be done. Maybe that sort of functionality is already available in other graphics tools.

But at least the project is in a more presentable shape, and hopefully won’t be a source of embarrassment if a prospective employer scopes it out. Better to clean it up some than just delete it, yes?

@ShannonSmith, I included references and a link to your “content generation for programmers” tutorial on the angryoctapus site in the new README.md for SIVI. That was a good tutorial!

Work on a virtual theremin stalled out last Summer when the vowel-generating synth patch I created turned out to be using an algorithm that some other fellow had patented.

Today, months later, I tried out a new version of this patch in the synth. The old version of this patch used FM synthesis. The new method uses additive synthesis. I have some more control over how the amplitude vs frequency profile of the formant is shaped, and this new patch is set to make the formant regions a little narrower than what I had on the FM. It sounds a little better than what I had before!

If I write an article describing the algo and publish it somewhere (where?), it becomes public domain and no one can patent it out from under me, right? I doubt what I’m doing requires patent protection. Working with formants and additive synthesis has been going on since the 1960’s and most of this just incorporates general knowledge. (I thought the same of the FM formants, but I have no desire to argue my side in a court of law.)

Bunch of house models for my WIP game :wink:

View on imgur

The road to fast A* pathfinding…

Been prototyping how to quickly build the gridmap for doing A* pathfinding on, right now i use circles for collision so i tried rasterizing them. Maybe I’ll switch to pre-made raster-images and ditch the circle approach so i can have more detail in the collision shape.

I also made the terrain rendering less convoluted, rendering multiple semi-transparent layers over each other instead of having one mega-shader with many textures like someone on the forum here suggested quite some time ago.

Begun writing a small JVM with x86/64-only backend powered by the fantastic AsmJit project in C++. This allows me to learn C++ and x86 and probably have SIMD vector intrinsics working before OpenJDK’s Vector API is out…
Today, I got basic class file parsing done and jit’ting of a simple method. So, if you have this class:


public class Main {
  public static int main(String[] args) {
    return 4;
  }
}

(I modified the type of the main method a bit, to be able to directly return an int value via EAX/RAX.)
I will first identify a method with name “main” and descriptor “([Ljava/lang/String;)I” and jit its code (which in this example is iconst_4, ireturn) via AsmJit’s Compiler interface to at least not care about register allocation and calling conventions, which for that code AsmJit generates: 0xB8 0x04 0x00 0x00 0x00 0xC3 (mov of immediate value 4 to eax and ret).
Calling that as an int (*MainMethod)(char const**)-typed function pointer then gets 4 as int result.
Yay!
Though, I’ll probably soon abort this project again, because, well… there is a TON of stuff to add. An actual standard class library like OpenJDK would be nice and that requires JNI. Then we need GC.
But what I actually want is a truthful JVM and JIT that translates the Java Bytecode predictably 1:1 to x86 code without one wondering whether some arbitrary optimization kicks in because of arbitrary limits and whatnot, because: there won’t be any optimizations to begin with. :slight_smile: Just a low-level single-tier JIT.

EDIT: Now, simple arithmetic operations work:


public int f(int arg) {
  return arg * 2 + arg;
}

generates:


0:  b9 02 00 00 00          mov    ecx,0x2
5:  8b c7                   mov    eax,edi
7:  0f af c1                imul   eax,ecx
a:  03 c7                   add    eax,edi
c:  c3                      ret

No strength reduction yet, so a*2 won’t be replaced with a<<1.

EDIT2: Btw.: JetBrain’s CLion is an amazing IDE, if you already work with IntelliJ IDEA in Java and on Linux.

EDIT3: Read this http://www.ssw.uni-linz.ac.at/Research/Papers/Stadler14PhD/Thesis_Stadler_14.pdf awesome paper. Going to implement that. Then I’m immediately better than HotSpot when it comes to e.g. scalar replacement.

Just finished working on my polygonal navigation shape editor:

TAh6Ft0E6FE