While looking through Xelerus I found some functions that the function database was unable to give me any useful explanation of and I was wondering if someone could explain them to me.
(objGetDestiny spaceObject)
returns a number from 0 to 359
Neat, eh? Unfortunately, "objGetDestiny" is about as vague as it sounds cool. I don't even know where to begin. What exactly is the "Destiny" of an object in a computer game which (to my knowledge) does not have any means of seeing into the future? The "comments" section on the function reads "I am not sure what the destiny refers to."
(objGetCombatPower spaceObject)
returns a number from 1 to 100
This function looks like a good way to figure out if one ship is more powerful than another. However, It would be hard to use this effectively without knowing the scale of the combat power rating.
Could someone shed some light on these two functions?
explanation requests
-
- Developer
- Posts: 2998
- Joined: Thu Jul 24, 2003 9:53 pm
- Contact:
At create time, every object in the universe gets a random number from 0-359. That number is called the "destiny" number and stays with the object for its whole life.
The AI (and other code) uses that number to vary behavior across different objects. For example, how close should a ship get to its target before it opens fire? The AI code uses the destiny number in its calculations so that different ships behave differently.
For the AI, which has to do many such calculations per ship per tick, having a single number is useful. In practice, script code doesn't need this as much.
Combat power is used by the fleet AI to figure out the relative threat posed by one fleet vs another. For AI ships, the combat power is proportional to the ship's score (the points you get for killing a ship of the given type). For player ships, the combat power is proportional to the reactor output.
In both cases it is just a heuristic. In practice I think it is useful in limited circumstances. For example, the Teratons use that to figure out whether they should try to steal your stuff or not.
[Note: If you use objGetCombatPower don't make assumptions about its implementation. It might change in the future.]
The AI (and other code) uses that number to vary behavior across different objects. For example, how close should a ship get to its target before it opens fire? The AI code uses the destiny number in its calculations so that different ships behave differently.
For the AI, which has to do many such calculations per ship per tick, having a single number is useful. In practice, script code doesn't need this as much.
Combat power is used by the fleet AI to figure out the relative threat posed by one fleet vs another. For AI ships, the combat power is proportional to the ship's score (the points you get for killing a ship of the given type). For player ships, the combat power is proportional to the reactor output.
In both cases it is just a heuristic. In practice I think it is useful in limited circumstances. For example, the Teratons use that to figure out whether they should try to steal your stuff or not.
[Note: If you use objGetCombatPower don't make assumptions about its implementation. It might change in the future.]
- Mutos
- Militia Lieutenant
- Posts: 218
- Joined: Thu Aug 14, 2008 3:31 am
- Location: Near Paris, France
- Contact:
Hi F50 hi George,
I was just about to post threads about these two functions ^-^ So thanks F50 for posting and George for answering !
For objGetCombatPower, I'll reword what I think I understood : the right use is to always compare two objects, but never assume anything as to the actual scale used. Is this right ?
I was just about to post threads about these two functions ^-^ So thanks F50 for posting and George for answering !
For objGetCombatPower, I'll reword what I think I understood : the right use is to always compare two objects, but never assume anything as to the actual scale used. Is this right ?