i don't know about DarkGame SDK, but in dark basic pro it's rather simple...
first you need your objects position, (OX, OY, OZ), and it's angles (OAX, OAY, OAZ).
then get the camera positions (CX, CY, CZ)
in dbpro:
CX = newxvalue(OX,wrapvalue(OAY + 180),<distance from the ship> )
CZ = newzvalue(OZ,wrapvalue(OAY + 180),<distance from the ship> )
CY = OY + <height above the ship>
that will give you the camera position in 2 Dimensions (around the ship when it's not pitching up or yawning).that's basically good for third person camera, but in "space" it get a helluva lot trickier.
then you position your camera to CX, CY, CZ
and then point it at OX, OY, OZ.
now if you would like to put the camera so that your camera isn't entirely centered on the object, you can change the OY to (OY + value above the ship). this will position the ship alittle bit underneath the camera centerpoint, and changes the camera focus to something further away (you don't want to restrict the players view, with the ship, or make aiming harder because the ship is entirely infront of the camera, and thus you can't see the spot you are aiming at.)
i've never done the camera thing in "space" (where "space" means a gaming area where the player can go up or down), and i'm not entirely sure as to how to compleate it.
all those should be available on DarkGameSDK too i think, and there propably is some sort of command listing, or something with darkgame SDK.
and yes, use a function, the beauty of C++ is headers and assosiated Cpp files, that you can use... so i suggest to make your own headers for those camera handling thingies... then you can just copy the headerfiles into your projects and just #include them in your code, so you don't have to write them everydamned time, you want to try out something...
also i also suggest using structures to store your player position and camera positions, so you'll have everything you need within a
single variable...
i ordered DGSDK a few days ago, still waiting for it to come, and waiting to get my hands on changing DBPro code to C++... so that's why i don't know the names of those commands in DGSDK... but i think they should be there... (if they aren't, i'm gonna get some rope and ladders...)