Java-Gaming.org Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (603)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (652)
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 ... 102
1  Game Development / Shared Code / Re: Phase Modulation for Synthesizers on: 2015-08-01 12:48:34
On abs.  This is totally bottom feeder land.  Either could be faster and the difference is going to be one or two micro ops.  And it can flip at any jdk update and or each time you tweak nearby code.

I'd go further and say that better is always use specific.  The issue with truncated power series is that it's minimal error is always at the center of the expansion and very rapidly grows as you move away from it.
2  Game Development / Performance Tuning / Re: Disabling floating point denormals on: 2015-08-01 09:20:44
For completeness.  In other use cases (not DSP like) or unwilling to call native and/or muck with FP behavior flags:

1  
2  
public static final strictfp float flushDenormal(float x) { return (x+1.f)-1.f; }
public static final double flushDenormal(double x) { return (x+1.0)-1.0; }


Both return input 'x' unless x is a denormal or negative zero in which case they return zero.  The strictfp on the single version is paranoia.  It disallows improving the precision of the computation.  Not needed in the double case.  (EDIT: Actually there's a range where a rounding will occur.)
3  Game Development / Shared Code / Re: Phase Modulation for Synthesizers on: 2015-07-31 20:19:31
px is s*cos(t) and py is s*sin(t), where 's' is some initialization scale factor.  the 'fx' & 'fy' values are the cosine and sine

You can't count operations to get an idea of performance.  You can't even look at the latency values.  As an example say some op takes 40 cycles to complete, that's only the time that it take before the result can be used.

The version I posted has 2 independent computations with the same form:  2 independent multiples (lower latency than loading a 32-bit value from L1 to registers) followed by an add to combine.

Oh it's also interesting to try both forms of lerp on modernish hardware.

@nsigma - the sin coefficients are bad.  Truncated power series is never a good choice.  Remez will give much better results.  The comment on 'abs' is incorrect.  There's no special NaN handling in abs.  It's not handling negative zeros...abs(-0) = -0 instead of +0.
4  Game Development / Performance Tuning / Re: Disabling floating point denormals on: 2015-07-31 19:02:24
I think both VC and GCC support the macros:

_MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
_MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);

which wrap the intrinsics:

_mm_setcsr(xxx)
_mm_getcsr()
5  Game Development / Shared Code / Re: Phase Modulation for Synthesizers on: 2015-07-31 05:46:31
For constant walks you're just performing a constant rotation at each step.  The simplest method is logically you have a complex number that's your current position P=(sin,cos) and another that's your rotation rate (F for frequency).  P  = P*F.

t   = px*fx - py*fy;
py = px*fy + py*fx;
px = t;

Compounding errors make this unusable after awhile.  But you can test if it helps/hurts performance.  If helps then there are corrective steps which can be taken.  Such a renormalize outside of the main transform loop or move to a second order version.  Obviously second order is more expensive.
6  Game Development / Shared Code / Re: Extremely Fast atan2 on: 2015-07-31 04:51:12
Don't bother.  You can't get meaningful data.  People should just know that approximations that use anything other than a few look-ups will always be shown in approaching best case or unrealizable performance.  They gotta test it in place to know if it's a win or not.

If you're bored try out this one: https://github.com/roquendm/JGO-Grabbag/blob/master/src/roquen/math/Float32.java

It'll be shown in approaching worst case performance.
7  Game Development / Shared Code / Re: Phase Modulation for Synthesizers on: 2015-07-31 03:49:28
On this sine thing...you're just walking sine at a constant rate?
8  Game Development / Newbie & Debugging Questions / Re: Check to see if Triangle intersects Rectangle on: 2015-07-31 03:01:46
@Jesse - thread pollution is traditionally. The 'T' of SAT is for theorem.  And whole thing is a misnomer because it's really the hyperplane separation theorem (Minkowski did this too).  Any two convex bodies that don't intersect must have at least one separating partition (which projects into the axis)...all well and good.  Mathematicans that were alive way before Minkowski was born knew how to compute AABB and sphere-sphere intersections (and many other).  Neither of these tests explicitly use the theorem for the result.  Of course you have to see how it relates, because it must hold.

On specific specialized tests, the best method will be the one that best exploits the symmetry of problem.  Like sphere-sphere/point is distance field with a change of metric.  Go toward the bottom of the link below, looking for Rectangle intersection with Points and Circles.  The part were I'm extending the point to a circle is Minkowski addition.

http://www.java-gaming.org/topics/vectors-what-s-the-point/24307/view.html

9  Game Development / Newbie & Debugging Questions / Re: Check to see if Triangle intersects Rectangle on: 2015-07-31 01:23:50
@Jesse

provide link: not from my cell I'm not...nag me after I'm back if you still care.

Sure you can think of AABB as being SAT, but it's really just a set of independent interval intersection tests.  So it's just a set of zero dimensional problems over Reals.  To my mind it's just as logically to call the standard sphere-sphere (circle-circle) intersection tests SAT.  Heck you even calculate the direction of normal of the partitioning line/plane...but in both cases the argument is as circular as the test.  Of course the partition must exist if they don't intersect.  Probably the association of AABB with SAT is it's a simple first example of why the partition must exist in the non-overlapping cases.

What you seem to be really saying is:  "Use the symmetry Luke!"  I'd endorse that statement.

Personally I if talk about SAT it's only going to be about an iterative "find the partition" method, so probably what you're calling non-trivial.  And instead one should generally use one of the Minkowski summation based methods that ideally someone else has already written for you.
10  Game Development / Newbie & Debugging Questions / Re: Check to see if Triangle intersects Rectangle on: 2015-07-30 23:20:36
I've covered "why not SAT" before.  It's silly to say that AABB is SAT.  We really don't even know what the problem is since OP seems to be AWOL.

EDIT:  Picturing it in my head, maybe in 3D:  AABB vs. a tri.  SAT might be reasonable...humm.  Maybe think about that after my vacation.
11  Game Development / Performance Tuning / Re: Disabling floating point denormals on: 2015-07-30 20:29:39
Because all FP computations while these modes are active are ignoring denormals. That's outside of the JVM's spec.  Additionally any routine that depends on the behavior of denormals will be effected.  The CPU and OS take care of limiting the mode changes to the thread(s) in question.
12  Game Development / Performance Tuning / Re: Disabling floating point denormals on: 2015-07-30 20:11:33
It's officially a no-no to muck with flags like this.  It worked the last time I checked.
13  Game Development / Newbie & Debugging Questions / Re: Check to see if Triangle intersects Rectangle on: 2015-07-30 20:02:02
Bubble sort works and is simple.  But that's a bad example because sometimes bubblesort is a good choice.
14  Game Development / Performance Tuning / Re: Disabling floating point denormals on: 2015-07-30 18:47:21
You'd need a native method to set denormals-as-zero or flush to zero mode for the thread(s) in question.  Call once and then not worry about it again. 
15  Game Development / Newbie & Debugging Questions / Re: Check to see if Triangle intersects Rectangle on: 2015-07-30 17:17:02
SAT is almost never a good idea.  It's only upsides is that it works and it's simple to implement.
16  Game Development / Shared Code / Re: Extremely Fast atan2 on: 2015-07-30 13:57:54
Table-lookup are almost always slow (as in much worse than using the default) in real use cases.  Especially as table sizes get large.

17  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-30 08:58:25
To repeat myself for the n-th.  Understanding the basics of compilers is uber-useful and in ways that isn't necessarily obvious.
18  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-19 07:31:49
I have been using simd ops since mmx was only available on prototype hardware.  Something that's been true since then is if you want real performance gains then the data has to laid out in a friendly manner.
19  Game Development / Game Mechanics / Re: Quaternions comment from my cell on: 2015-07-15 07:38:51
This is a hard question to answer from a cell which is why I was trying to pawn the question off on F.G.

Slerp is just the complex number equation: zn which linearly parameterizes the arc between one and the angle represented by z.  For slerp we want the same between a and b. To get there we transform the system.  

Let c = a*b.

Now between one and c is a linear transformed version of a and b.  Performing the operation (ct) and transform the system back to it's original space (pre-multiply by 'a') yields:

slerp = a(a*b)t = (ba*)ta

where the right hand is just performing the pre/post transform operations on the opposite side (since quaternion multiplication doesn't commute).  Note this is the same technique that's used to represent a rotation about arbitrary point with 3x3 matrices.  We can rotate about the origin so to generalize to any point we translate to origin, perform the rotation and translate back.

Directly implementing the equations above is insanely expensive so Shoemake/Davis reworked into want you see everywhere.  But it's completely ignores that one can approximate the equation to high accuracy.

We have two rotations a and b which we want to interpolate.  Assuming they are unique we know that they fall on two different lines through the origin.

Given the largest possible minimal angle is pi which translates into pi/2 in H.

OK I taking a break
20  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-14 17:13:10
Oh and I intended to point out that even if you go with a structure where you need to xform multiple the actual matrix doesn't needed to be stored anywhere...it just temp expanded in registers.

21  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-14 17:04:50
Consider that an animation hiearchy most often is a static trie.  A breath first walk yields a flat linear ordering of memory chunks.  Each logical node can be a quaternion, a vector and the number of children which although an integer can be stored as a single.  It's cheaper to xform 1 vector directly than to pass through LA.  So no struct library is really needed in this case.  There are a number of variants on this theme.
22  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-13 16:00:27
Split quaternion topic non specific.  I am on vacation cell only so more terse than usual.

 I can back up all my commentary..ask for specifics if my reasoning isn't clear.
23  Game Development / Game Mechanics / Quaternions comment from my cell on: 2015-07-13 14:40:39
Let q be a unit quaternion which represents a rotation.  Let p be a coordinate in R3 which we map to H by setting the scalar to zero.  Then the equation:

p' = qpq-1

is p rotated by q.  Multiply q by non zero scalar s.

(sq)p(sq)-1 = s(qp)(s-1q-1) = (s/s)qpq-1 = p'

scalars commute so the terms s and 1/s cancel so it yields the same result.

If we change the equation to using the conjugate then we get the same for unit since q-1 = q* in that case.

p' = qpq*

and for non unit the scale factors compose yielding the rotation plus a uniform scaling by s2:

p' = (sq)p(sq)* = s2(qpq*)

If we change the mapping of p to setting the scalar to one then we are back to an unscaled rotation.

Some implications:
  • All quaternions except zero can represent a rotation.
  • The set of all quaternion that represent the same rotation fall on a line through the origin.
  • There are only two points the line intersects the unit sphere: q and -q.
  • If two quaternions don't fall on the same line through the origin then the represent different rotations.
24  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-13 08:30:37
There are much bigger gains to be had than sse atm.  Notably lowering memory stalls.  These two go hand in hand.  The latter needs to be addressed before the former has what it needs.  And as mentioned previously there's quite a bit of reworking that can be performed.
25  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-13 00:10:01
Not true.  All quaternions other than zero represent a rotation.
26  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-12 13:04:03
By no implicit normalization I only referring to operations on quaternions.  Conversions in & out need to do the correct thing.  'unitInvert' just needs to be properly named, but the conjugate is an axiomatic function.

The difference function is another poorly named function and no normaliztion should be performed.  Of more general interest would be cmul:  A*B and mulc AB*, which covers and is much more efficient that this.

There are a large number of useful functions I could suggest. Off the top of my head:

Cayley (stereographic) & inverse projections
unit log
pure exp
orientation change:  get Q that rotates unit vector A into unit vector B (this reduces further if actually a matrix is desired)
unit square root
unit square

Having a function called div is IMO awkward since there's right and left versions, but since most people only care about unit quaterions I probably wouldn't include either.  Those that do care will most of the time be able to carry through the derivation of the total desired operation.

Remember that there's absolutely nothing special about unit quaternions. Non-unit quaternions have uses.

On slerp:  Implementations like this have zero use cases.  I'm too lazy to have this conversation from my cell phone though.  Basically slerp is just linearly parameterizing an arc length (2D) and the angle is no more than PI/2 for random input.  It's always reducible to lerp.  The only question is the method of reduction.  If you want a quick answer try twitting @rygorous
27  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-11 16:14:41
I'm on vacation for the next few weeks.  I took a quick skimmed and could give a very large number of feedback points.  Some quick ones.  Generally nobody really cares about 4x4 matrices...what they really want is 4x3.  There's tons of examples of reducible operations, sometime at the cost of adding a rounding step...who cares.  The quaternion function unitInvert should indicate it's proper name: conjugate.

The slerp implementation is a classic example of a function one always sees that should never, ever be called.
28  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-10 08:47:17
implicity normalizing quaternions is a bad idea.
29  Game Development / Newbie & Debugging Questions / Re: How to implement scripting correctly? on: 2015-07-09 09:52:40
A typically dialogue system can look like this.  You have a root set of "opening" dialog as a list and each player response leads to the next list.  To make it interesting you simply need to allow each element to be conditionally shown based on a boolean response.
30  Discussions / General Discussions / Re: FFXIV refunds on Mac OS through poor performance - interesting nuggets... on: 2015-07-09 07:20:04
They're probably thinking it isn't worth the effort.
Pages: [1] 2 3 ... 102
 
SHC (17 views)
2015-08-01 03:58:20

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

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

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

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

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

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

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

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

NoxInc (34 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!