Home Forums Programming Havok

Welcome to our forums. These forums were active from 2003-2014. We have now decided to close them down, but will leave them here as an archive.

Remember you can send us feedback, news, jobs and content ideas by clicking here.

If you're really stuck for time, email news@gamedevelopers.ie.

You can also follow us on Twitter @gamedev_ie 

 

 

This topic contains 5 replies, has 4 voices, and was last updated by  Bodb Dearg 8 years, 10 months ago.

  • Author
    Posts
  • #6957

    Bodb Dearg
    Participant

    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

    david4482
    Participant
  • #42450

    Pete
    Participant

    Are you guys going in for the competition then?

  • #42452

    Bodb Dearg
    Participant

    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

    peter_b
    Participant

    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

    Bodb Dearg
    Participant

    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.

The forum ‘Programming’ is closed to new topics and replies.