Home Forums Programming Havok

Viewing 5 reply threads
  • Author
    Posts
    • #6957
      Anonymous
      Inactive

      Hey everyone. Has anyone here had any experience working with the Havok physics engine ? I just have two quick questions about it..

      (1) – What is the correct way to manage memory / allocated objects ?
      I notice that none of the demos use delete on allocated physics objects, instead using only removeReference() to do the cleanup. Is it safe to assume that these object’s being cleaned up accordingly by the base system or self deleting themselves when the reference count is zero?

      (2) – I’m running a multi-threaded simulation, but I let it finish before proceeding with game logic that requires access to the sim data. However, I do have some phantom objects with call-backs in the world.

      Say if I wanted to modify/read the world within these callbacks whilst the simulation is still running in parallel, what is the correct procedure to follow in order to do this ? Is it just a case of calling lock() and unlock() on the world (and markForRead() etc. in debug) or is there more to it than that ?

      Thanks.

    • #42448
      Anonymous
      Inactive
    • #42450
      Anonymous
      Inactive

      Are you guys going in for the competition then?

    • #42452
      Anonymous
      Inactive

      Thanks for the help Dave. That’s pretty handy actually- kinda like COM objects and their reference counting mechanism.

      Yeah I’m gonna have a pop at the competition with the lads from Carlow. We’re still finalizing our idea but we’ve got a few knocking around atm.

    • #42455
      Anonymous
      Inactive

      Thanks for the help Dave. That’s pretty handy actually- kinda like COM objects and their reference counting mechanism.

      Yeah I’m gonna have a pop at the competition with the lads from Carlow. We’re still finalizing our idea but we’ve got a few knocking around atm.[/quote:75955a19a3]

      Its essentially the smart pointer concept. They’re found in the boost library if you wanted to use in your own code. Presumably in Havok you can hook up your own heap to malloc and free the smart pointers from right?

    • #42457
      Anonymous
      Inactive

      Presumably in Havok you can hook up your own heap to malloc and free the smart pointers from right?[/quote:3496b90b8e]

      Looks possible anyhow. Memory management is done through the hkMemory interface so it would just be a case of implementing the functions to roll your own. You also have to create the memory manager at startup, allocate stacks etc. so you could use your own there.

Viewing 5 reply threads
  • The forum ‘Programming’ is closed to new topics and replies.