24 votes
Accepted

Consistent cross platform procedural generation

The best resource I've found on this topic is Bruce Dawson's blog article "Floating-Point Determinism" It establishes that yes, in theory, you could get cross-platform determinism out of ...
  • 117k
7 votes

Consistent cross platform procedural generation

What I would be trying to do is to generate on multiple levels, where things at one level could be calculated from the level above with integer math. For example, at the top level I might draw a bunch ...
5 votes
Accepted

Is it possible to calculate a direction vector without sqrt?

If you want a correct mathematical result (correctly rounded to within floating point precision), a square root is the way to go. It's true that it's more expensive than a multiply, but it's still ...
  • 117k
2 votes

Consistent cross platform procedural generation

As others pointed out, if you want true determinism, then avoid floating point variables and use integer math instead. If you need a large universe, use 64bit integers. Their resolution is good enough ...
  • 113k
2 votes
Accepted

Compute the difference between two quaternions and iterate with the difference

Quaternion difference: C = Quaternion.Inverse(B) * A; Quaternion division by a scalar: ...
  • 117k
2 votes

Move player towards screen

I've thought of a possible solution to this, but it feels really inelegant, so I would be interested in hearing other people's take on this. My idea is as follows: Take the position of the player in ...
  • 326
2 votes

Increasing Recoil Over Time With 'Diminishing Returns'

Whenever I need a formula that describes a curve, and the curve isn't extremely simple to describe with code, I use an Animation Curve. Despite the name, this feature is useful for any kind of 2D ...
  • 3,753
2 votes
Accepted

How do I determine if a given grid coordinate is fully within a triangle?

You seem to be using the centre point of your square as the reference, so I will follow that convention (I'm not familiar with Unity's conventions about this). You just need to check three ...
  • 348
1 vote
Accepted

How to calculate Lv(Xp), Xp(Lv) and NextLvXp(Lv) generically?

I understand that when the progression is defined consequently the XP table is too, even using an algorithm. Most common is to store the values initial character level ...
1 vote

Consistent cross platform procedural generation

Using a noise-based RNG might be an option? It seems to work well, and generates its numbers via bit shifting, so there's no precision issues to get in the way. Not sure where the slides are, but the ...
  • 121
1 vote

Consistent cross platform procedural generation

Rather than designing your PCG around real number arithmetic and then trying to make it deterministic, it may be easier to start from this constraint and design around it. There are a wide variety of ...
  • 151
1 vote

Barycentric coordinates outputting coordinate outside of triangle

It looks to me like you've taken a Barycentric coordinate function designed for determining the coordinates of a point known to be inside the triangle. It does not account for the way the sign of the ...
  • 117k
1 vote
Accepted

τ = r × F, In unity3d/PhysX how do we define r?

This depends on how you are applying the torque. The AddTorque method (by default) interprets the Vector3 parameter as a torque in world space. That means the ...
  • 117k

Only top scored, non community-wiki answers of a minimum length are eligible