Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (623)
Games in Android Showcase (176)
games submitted by our members
Games in WIP (676)
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 ... 107
1  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-10-09 17:32:02
falling through in a rather large set of programming problems makes the code easier to read, write, maintain and faster.  Classic example is state-machine related.
2  Discussions / General Discussions / Re: Why are voxels everywhere!? on: 2015-10-08 20:02:32
You say voxels...I think Comanche.
3  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-10-08 19:52:27
I wholeheartedly endorse Riven's floor.  The domain reduction shouldn't be an issue here.  In cases where it is then the range is probably problematic elsewhere anyway.  It will flush small negative numbers to positive zero however...that small window is important not to forget.

On fma.   Hotspot could not issue in strictfp cases, otherwise it would be legal.  All of this is more in the future kinda thing anyway...fma ops are slower atm if memory serves.

All of this is from cell...otherwise I would have been more verbose.  For real even.

EDIT: for typos

More notes of FMA.  The compiler dev list chain starts with "a bug".  Someone added to the compiler a transform that would convert "Math.pow(x,2)" into x*x.  The later is more faster and more accurate.  The bug filed was that the interpreter would compute Math.pow(x,2) and once the code got compiled it would compute x*x..thus different results between the two.  The proposed solution was to fix the interpreter to detect and actually compute x*x as well.

The persons who's e-mail you linked was saying:  This is not a bug, the method is not marked strictfp..the transform should be considered legal.  And if you go down this route of attempting to have bit exact results across the interpreter and all compilers then you're unreasonably restricting the optimizations the compiler can perform because it's impossible for the interpreter to know how the code is going to be fact it's part of the interpreter's job to collection information so the compiler can do it's thing.  The usage of FMA comes up in that context.  That author missed an important point:  This is exactly the situation the JVM was in before it started using SSE registers.  Computation would be performed on x87 in 64 bit mode...all 32-bit float ops were generating different results than the interpreter in non-strictfp methods.

The stackover thread doesn't apply.  It basically about strictfp on modern CPU doesn't do much of anything since hotspot isn't taking advantage of operations like FMA at the moment.
4  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-10-08 11:42:06
Intel has been thinking about it.  The various FMA ops are hard and lerp is harder.  I know both Michael Abrash and Tom Forsyth pushed for LERP while at Intel.  Abrash gave a presentation on Larrabee where the first slide read:  "I never did get that lerp instruction!"

Oh I didn't have my thinky thinky cap on earlier, form (2) converts into FMA:
  t00 = a - t*a             // different opcode from FMA related set
  t10 = t * b + t00
5  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-10-08 09:26:55
A note on lerp:  f(t) = (1-t)a + tb

It can be expressed in three forms
1) (1-t)a + tb
2) a - at + bt
3) a +t(b-a)

They all have have the same max-chain length (3):
(1-t)a + t b:
  t00 = (1-f) | t01 = t * b
  t10 = t00 * a
  t20 = t10 + t01

a - t a + t b:
  t00 = t * a | t01 = t * b
  t10 = a - t00
  t20 = t10 + t01

a + t(b - a):
  t00 = b - a
  t10 = t * t00
  t20 = a + t10

Forms (1) & (2) requires 4 operations and (3) requires, well, 3.

I can't think of a reason why (2) might be a "better" choice...just mentioned for completeness. Personally I use (3) as my default.  The one less instruction to issue means that it's generally faster.  It also is in a form that allows performing a fused-add-multiply (FMA)...but I don't believe HotSpot generates these instructions yet.  With an FMA opcode the chain-length and operation count become 2:

  t00 = b - a
  t10 = t * t00 + a

The potentially big BUT here is this, if t=1:

a + 1.0*(b - a) = a + (b - a)

which generally in floating point does not result in 'b'.  So if having the exact values at the end-point is desired you want to avoid (3).  Both (1) & (2) are exact at the endpoints.  (2) must be computed as: (a - at) + bt for this to be true.

A note on Math.floor:  This has stricter contract than the problem requires and could be replaced with something like:

 floor = x >= 0 ? x : x-1

DISCLAIMER: I actually have though this through enough...the x-1 could a be problem...humm....
Also newer hardware have a floor opcode..don't know if HotSpot emits or not, the numbers above seem to be saying no.

6  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-10-06 12:34:49
What do you even think the purpose of this forum is?
Whatever you can make of it.

Even just explaining things to others helps me get a better grasp of those concepts myself.
This is worth pointing at...talking through stuff with someone often help clarify things to yourself.

Quote just literally told me that your time is extremely valuable,
Everybody's time is valuable that's the whole point of opportunity cost vs. utility comments above.

yet you expect every single person who read (and actually want to understand) your comments to spend a significant amount of time Googling to decode your posts.
Or simply post:  can you explain this?  Look above I talk about dependency chains.  Explaining that for the widest audience would require giving a complete overview of how modern CPUs work. Or dig up a bunch of URLs for people to wade through.  

...if you're half as knowledgeable as you claim...
I don't recall making such a claim.  

I may not be interested in learning everything...
That's part of my point in being terse, there's no point is spending time on something if nobody's interested.

EDIT: Hit post instead of preview.
7  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-10-06 11:39:09
Indeed, money here really means opportunity cost.  Personally I think it's a good idea to periodically think about the opportunity cost associated with any decision you make and decide from there if it's a good idea.  If you spend (say) an hour doing A, that's costing you two hours worth of doing B instead.  (You change to doing B, after the first hour that's how much of B you could have done if you had not done A.  But you're still one hour where would would have been if you hadn't done A at all.)

And another thing to take into account is Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.

Quote you contribute to open source software?
I used to quite a bit.  I more or less stop for years when Richard Stallman adopted his "I'm a f**king idiot" public persona.  I still refuse to contribute to any FSF licensed software (beyond bug reports).  RS is really just the tip of the iceberg...I stopped and thought:  I really don't like any of these figurehead people and I don't like how these communities are are attracting and promoting the creation of vocal dogmatic asses. Sure I know they are actually the minority, but I don't care.  (Oddly I just got a tweet to this:

Not so much these days mostly because projects I'd be willing to contribute to are complex and I don't have (or am unwilling to spend) the time to needed to understand the code base. Say LLVM or HotSpot.

A truly rational person would not, it seems, since it's a complete waste of time.
just wonder how you can justify your actions based solely on opportunity cost.
Because opportunity cost isn't the only consideration.  Another other important economic idea is utility.  Which may or may not be utility for the person in question that's spending their time.  I don't see any point in spending time typing up something where there are tons of resources on the subject.  Like locally trig identities.  On the other hand if I know of few to no resources on a particular topic I'm likely to write significantly more.  Recent examples: looking at N-d problems in 2D if that's the actual case. This information is scattered across different domains (I'm not aware of a single resource with this info).  And inequalities.  Time and time again I see very experience people missing some basic properties.  The wikipedia page seems to me to be somewhat understandable...but it does not walk through how they are related which is important for real understanding.
8  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-10-05 20:15:16
@ziozio: The real difference is going to be in dependency chains. (for x only shown below)

Table look up requires a sequence of 6
x0 = read x
x1 = x0 + RegM
x2 = x1 * K
x3 = int(x2)
x4 = x3 & M
x5 = table[x4]

Using sum-of-angles requires 3:
x00 = read cos(x) | x01 = read sin(x)
x01 = x00*RegM    | x11 = x01*RegN
x2  = x01+x11

@theagentd: the pre-computed sin/cos values have to be in an array.  Perhaps using jitwatch and careful layout you could get the computation into SIMD (packed) ops.
9  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-10-05 18:03:07
Fiber to the house...unlimited on the phone.  My time is the limiting factor.  Like I've said before I expect people can ask a question if they don't follow and/or can surf the web.
10  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-10-05 07:46:07
I said up front "for you to ignore".

but your "explanation" is like the...
I explained nothing...there should be no need.  Math transforms are legal or not.  Identities are always legal.  The math doesn't care how you're thinking about the input or output.

For the google impaired:

Every expression on this page is always true (for real input).

Any legal interpretation you can place on a mathematical expression is always legal.  Comparing two angles is always the same as comparing a point against a line through the origin.  It may or may not be worthwhile to consider other interpretations...either it's helpful in some way or it's not.  You brought up rotations, so yeah what you're doing is related to rotations.

EDIT: Pictures!

Click to Play

This one's slightly more fun:
Click to Play

..the worst possible professors at my uni...
They're paid to help you.  Any time I type in information here I'm putting my hand in my pocket and throwing cash out the window the entire time I'm typing.  Seems pretty understandable that my willingness to do so is rather limited.

I don't understand what you're whining about.  If you don't understand what, say, fold-symmetry means and you care then starting typing in google...I just did that and even before I completed my typing some pictures where popping up.  But you don't even need to do that...I typed in a brute force shader (rather poor visualization, but good enough) on the link.

too time consuming to decode your intentions
If you're using trig and/or inverse trig functions at any high rate, it's very likely you're missing some mathematical property that makes them disappear.  Using trig functions means you're manipulating angles...and angle are generally not interesting for computation.

11  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-10-04 17:28:18
No you're computing the y-component of two rotations.

EDIT: I'd expect the 2-fold symmetry to be obvious here.

12  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-10-04 13:37:18
sin(t+x) = cos(x)sin(t)+cos(t)sin(x)
sin(t+y) = cos(y)sin(t)+cos(t)sin(y)

per sim step is cos(t) & sin(t) which is really one trig op...not that it would matter.

{....cos(x),sin(x),cos(y),sin(y)...} packed array.  Speculate loading and skips the trig table lookup.  More accurate, but that probably doesn't matter either.  So 2x (2 look-up, 2 mul, 1 add) per entry.
13  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-10-04 12:39:24
That's for theagentd to ignore. For N objects he's performing 2N forward trig ops per simulation step.  The sim only requires two per step.
14  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-10-03 16:45:30
sum of angles.
15  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-10-03 14:41:09
That's when table-based is at it's gotta make that cache load pay off.  What's the math...I'm not seeing an obvious sin here?
16  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-10-03 14:06:41
KaiHH: I'd be in state of sin to attempt to generalize numbers. Where would you think you could get a performance increase in JOML via table look-up?
17  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-10-03 07:08:15
sine/cosine, et al large table based look-ups are only fast in naive benchmarks and very narrow cases of signal processing.
18  Java Game APIs & Engines / OpenGL Development / Re: What can and can't be done with shaders. on: 2015-10-02 01:46:20
But much of the complexity of brute-force shaders is because they're brute force.
19  Games Center / Showcase / Re: Christ on: 2015-10-01 23:10:04
You know.... Religious people can take these things quite seriously.
You could always add a tick box so you'd be Satan instead.   That'd be funny.
20  Discussions / Java Gaming Wiki / Re: Math: Inequality properties on: 2015-10-01 17:47:09
Yeah, I've started some (read one) examples that basically walks through the inequalities used in the "case studies" thread to use actual properties rather than hand-waving.
21  Discussions / Java Gaming Wiki / Re: Math: Inequality properties on: 2015-10-01 13:32:27
Thanks for the feedback.  Yeah that isn't very clear.  Reworked it and a couple a similar cases and added some more details.

22  Discussions / General Discussions / Re: Transitioning from Windows to Linux on: 2015-09-30 17:30:09
Somewhere I posted the "family tree".  Very funny that.  All that work to convert poop into more poop.
23  Discussions / Java Gaming Wiki / Re: Math: Inequality properties on: 2015-09-30 16:06:45
Incomplete first pass.  Feedback desired.
24  Discussions / General Discussions / Re: Transitioning from Windows to Linux on: 2015-09-30 11:51:27
For a data point, I randomly switch hit between mint and centos.
25  Game Development / Game Mechanics / Re: How to properly avoid ConcurrentModificationException when running two threads on: 2015-09-30 07:36:50
To generalize:  All functionality that is visualization only, then variable rate is "The Correct Way®".  It's also a pretty big knob one can turn to prevent and/or compensate for slowdowns.

Note that fixed-rate does not imply that all subsystems run at the same rate.  As an example some fast-paced many entities games might run simulation at 10 Hz and the blending of the rendering hides that from the user.  AIs might run faster or slower and there's no requirement that active entities update every tick.  The key thing is to be deterministic.  Easy to understand, design, read, write and debug.  Also there's no requirement that all events occur at the fixed rate.  If running simulation one could determine, say, where inside it a collision occurs and tweak the simulation state to reflect that.  Still the result is deterministic (if you're careful).

Note by deterministic I mean that in the weak way of locally...attempts to be floating-point deterministic across hardware, VMs and if the code is (for java) in interpreted vs. C1 vs. C2 vs. any future runtime compiler is completely nuts.  And a complete misunderstanding of how to write floating-point code.
26  Game Development / Game Mechanics / Re: How to properly avoid ConcurrentModificationException when running two threads on: 2015-09-29 22:58:07
The very short answer is variable time steps are an all-around bad idea IMHO.  The cost of a variable time-step update is much higher , likewise harder to write and it's non-deterministic.  The only downside of fixed time steps is that you either have to slow down or have specialized 'tick' routines for performing multiple update steps in one go.
27  Discussions / General Discussions / Re: Transitioning from Windows to Linux on: 2015-09-29 17:14:05
VirtualBox first would be my route.  I've never had anything but bad luck with Unpoopoo.
28  Game Development / Game Mechanics / Re: Case Studies on: 2015-09-28 16:16:17

Something that may not be clear is that these unit directions derived above are only needed if you're going to perform some 2D calculations and then take the 2D result and place it back into the original space of the problem.  If you're not going to do that then you don't even care about them or if the plane is not unique.  The axis unit directions in the 2D space are always what you expect:

X = (1,0)
Y = (0,1)

and the coordinates in the 2D plane are:

A = (|a|,0)
B = (a·b, sqrt((a·a)(b·b)-(a·b)2)

back to @theagentd's example we have (since a.a=1), the a in the plane is A, and b is B:

A = (1,0)
B = (a·b, sqrt((b·b)-(a·b)2)

then the n-D computation:


should be identical to the 2D:


(A·B) = dot((1,0), (a·b, sqrt((a·a)(b·b)-(a·b)2)) = a·b
|B| = sqrt((a·b)2 + (b·b)-(a·b)2) = sqrt(b·b)

So, as expected, they are identical. We're logically performing a rotation into a known plane since a rotation is n (number of dimensions) parallel projections into the target coordinate system.

In this 2D space we can think of the pre-computed value: k=cos(t) as the projection into 'x' (the axis of the cone) of the direction of the surface of the cone.  So in the 2D slice the surface of the cone is a line through the origin, the unit direction (C) of that line would dot with C·X = k.  And our test above is:  Is B on the positive side of this line.

Let me break it down by parts.  We have |B|.  That is how far from the origin the point B is.  'k' is how much in 'x', which is the same as how much in 'a'.  Some point on the line that has a distance of |B| from the origin will parallel project into 'a' as |B|k.  Our test point B projects into x as (A·B)=(a·b). The set of all point at a distance |B| from origin fall on a circle of radius B.  And those below our test line will have (a·b) > k|B|
29  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-09-28 13:41:44
The forum complained to me about talking to myself again.
30  Games Center / WIP games, tools & toy projects / Re: Skullstone - a dungeon crawler game on: 2015-09-26 19:33:25
Dungeon Master flash-backs.  Sigh....
Pages: [1] 2 3 ... 107
BurntPizza (32 views)
2015-10-08 03:11:46

BurntPizza (17 views)
2015-10-08 00:30:40

BurntPizza (19 views)
2015-10-07 17:15:53

BurntPizza (32 views)
2015-10-07 02:11:23

KaiHH (38 views)
2015-10-06 20:22:20

KaiHH (16 views)
2015-10-06 19:41:59

BurntPizza (32 views)
2015-10-06 19:04:48

basil_ (46 views)
2015-09-30 17:04:40

shadowstryker (26 views)
2015-09-29 15:55:06

TheSpaceHedgehog (32 views)
2015-09-29 01:58:48
Math: Inequality properties
by Roquen
2015-10-01 13:30:46

Math: Inequality properties
by Roquen
2015-09-30 16:06:05

HotSpot Options
by Roquen
2015-08-29 11:33:11

Rendering resources
by Roquen
2015-08-17 12:42:29

Rendering resources
by Roquen
2015-08-17 09:36:56

Rendering resources
by Roquen
2015-08-13 07:40:51

Networking Resources
by Roquen
2015-08-13 07:40:43

List of Learning Resources
by gouessej
2015-07-09 11:29:36 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‑
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!