Jump to content

  • Log In with Google      Sign In   
  • Create Account

HappyCoder

Member Since 28 Apr 2007
Offline Last Active Today, 01:31 PM

Posts I've Made

In Topic: ddx, ddy reuse for better performance?

06 July 2016 - 10:46 AM

calculating ddx ddy is as cheap as a subtraction. I would recalculate it. tex2Dgrad is mostly useful for when you have branching paths in your shader. If you ever branch you cannot cacluate ddx and ddy. If you need to sample a texture inside an if statement, you need to calculate ddx and ddy before the branch and pass them into tex2Dgrad.

In Topic: What phone should I get?

27 June 2016 - 11:34 PM

I have a Nexus 5 and really like it. It doesn't come with any carrier software which is great. I actually get android updates as they come out. My previous phone was a Galaxy and definitely prefer the Nexus.

In Topic: [Solved] Rotate towards a target angle

19 June 2016 - 11:01 PM

Use complex numbers with modulus 1 instead of angles. That would be z = cos(alpha) + i * sin(alpha).

if (imag(desired / current) > 0.0)
  current *= Complex(cos(0.1), sin(0.1));
else
  current *= Complex(cos(0.1), -sin(0.1));
It's not just this piece of code: Pretty much anything you want to do with angles is easier with complex numbers.


I would upvote this twice if I could.

i have no idea what complex numbers are


You should learn them. They will benefit you greatly in game development and aren't that difficult to pick up.
http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/complex/transforms/
It make take a bit of effort to learn them, but I will pay off big time.

In Topic: Jitter when interpolating sprite from previous position to current physics po...

17 June 2016 - 07:27 PM

Sounds like a floating point precision error. There is probably a division happening somewhere where the denominator is really close to 0

In Topic: gameplay programming: when to use lua and when to use c++

10 June 2016 - 05:12 PM

Lua scripts are easier to treat a resource. You can have a file represent an enemy type or another dynamic object in your game. This file can include the name of a script to use as the object's behavior.
This makes extending the game easy to do, and you really begin to see the benefit when your game has many different types of dynamic objects. You do pay the cost of having to create a binding layer between lua and c++. So the benefit may not be worth it if you aren't going to have many types of objects in your game.

PARTNERS