Difference between revisions of "Category:Troubleshooting"

913 bytes added ,  17:54, 10 September 2007
→‎CPU-Hungry Script Functions: Only a problem if run every frame
imported>Dev akm
(→‎Gamemode Scripts: better block types)
imported>Haama
(→‎CPU-Hungry Script Functions: Only a problem if run every frame)
Line 368: Line 368:


== CPU-Hungry Script Functions ==
== CPU-Hungry Script Functions ==
There are a few CPU-hungry functions to watch out for and avoid at all costs:
Generally, scripts have little affect on FPS, especially compared to graphics. However, if run every frame there are a few functions that will cause a noticeable (>1) drop in FPS:
  GetSecondsPassed
# [[GetSecondsPassed]]
  GetDistance
# [[GetNumItems]]
# [[GetInventoryObject]]
# [[GetFPS]]
#* However, you can run this every few frames without a drop. This is most useful as an alternative to '''GetSecondsPassed''' as ((Number of frames passed) / GetFPS) approximates the amount of time passed.
# GetDistance
#* I have tested the others above, but not this one. However, I have seen it mentioned several times that GetDistance is a CPU heavy function, so I'm including it here.
#*--[[User:Haama|Haama]] 17:54, 10 September 2007 (EDT)
 
Note that for all of these, they are incredibly fast functions. Even the slowest, GetInventoryObject, can be run 1000 times and the next frame will come up in less than a second. They will only cause problems if run them constantly (every frame or so).
 
See [[Code Optimizing]] for more details (in planning/progress).


== AI Overload ==
== AI Overload ==
Anonymous user