Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 20 Jan 2003
Offline Last Active Nov 19 2014 01:22 AM

Posts I've Made

In Topic: Unique ID for every objects using reinterpret_cast

19 November 2012 - 07:01 AM

Why on earth would you ever sort a container of pointers by their address values? What is that even going to accomplish?

Maybe there are duplicate entries in the container, and you want to correlate them. Programming is a mysterious world, with many mysterious tasks.

In Topic: Unique ID for every objects using reinterpret_cast

18 November 2012 - 07:16 PM

if you need a very shortlived unqiueness, then the memory address will work fine.

Say you're sorting a handful of pointers, you can simply use the address.

One problem is if these are allocated non-continuous, each ptr is heap allocated, then the sort result will not be deterministic.
Your tools may sort your ai nodes in one order and the build process in another, so when you go to debug node 25 in your tool, it's not the same node 25 that the build process created.

A problem with incrementing IDs is that they wrap. For small tests it may appear that everything works fine. But after soaking your game for a couple days you will very likely wrap your IDs, then you need to deal with "well where do i get the next id from?" you'd need to returned freed ids to a list.

So if you need short lived, automatically recycling ids that simply guarantee uniqueness (locally) and are not deterministic, the memory address is perfectly applicable.
In most other cases, with multiple machines, or multiple runs, where the ids much be the same.. the memory address will fail miserably.

In Topic: 3D Rigid Body Animation (Not Physics) - Recommendations and Resources?

17 November 2012 - 04:41 AM

you can start with toying with some simple kinematic chains.

For example, you may start with a simple barrel attached to the tank.
You'll need a point between the two shapes to use at the reference point for articulation.

Have the tank oriented to the terrain and reorient the barrel so that it points at the terrain.

However the learning curve is steep. once you reach this point, you are practically ready for full on skinning. the leap is not far from there.

You can probably find many references on .3ds format for hierarchical bone transformations. personally i learned with the milkshape 3d tutorial from a while back.
I have since then implemented my own exporter and dump the scene information to my own format.

In Topic: Stopping my skybox from "Blooming out"

17 November 2012 - 04:37 AM

you may want to go so far as to mask the skybox, you may use one of the channels of your GBuffer, or a stencil buffer, or something to indicate which pixels of the screens should be eligible for bloom.

blooming the sky is an intutive way to make a homogenous look to the effect. but your artists will likely want more control over what the player sees, even in the extremely bright sky.

We haven't added masking yet, but we want to. we want to mask other post effects.

In Topic: 2D driving physics woes (problems) 2D Vector Math questions

29 October 2012 - 06:50 AM

Silly author, Y u no explain things?

The reason the dot product is used instead of the vector magnitude, is because we are looking for the magnitude _in the forward direction_. Which means the result is signed. You could have a velocity _not_ in the forward direction, for which the dot product result would be negative. In other case, you may have some gigantic relative velocity, magnitude 1000, but if the vector is perpendicular to the forward direction, the dot product, and forward velocity magnitude, will be zero.

Sorry, this article is extremely dated. Good to see it's still got some legs though!

The correct projection is

Vec Project( Vec a, Vec onto )
Vec norm = onto.Normalized( );
return norm * Dot( a, norm ); //dot product against normalized "onto" vector.

You likely _dont_ want to use the magnitude of this vector, you likely just want the dot product result which is signed. (positive if vectors originally pointed in same direction, negative if not, zero if perpendicular)