Engine.xml 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Engine" inherits="Object" version="3.4">
  3. <brief_description>
  4. Access to engine properties.
  5. </brief_description>
  6. <description>
  7. The [Engine] singleton allows you to query and modify the project's run-time parameters, such as frames per second, time scale, and others.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <methods>
  12. <method name="get_author_info" qualifiers="const">
  13. <return type="Dictionary">
  14. </return>
  15. <description>
  16. Returns engine author information in a Dictionary.
  17. [code]lead_developers[/code] - Array of Strings, lead developer names
  18. [code]founders[/code] - Array of Strings, founder names
  19. [code]project_managers[/code] - Array of Strings, project manager names
  20. [code]developers[/code] - Array of Strings, developer names
  21. </description>
  22. </method>
  23. <method name="get_copyright_info" qualifiers="const">
  24. <return type="Array">
  25. </return>
  26. <description>
  27. Returns an Array of copyright information Dictionaries.
  28. [code]name[/code] - String, component name
  29. [code]parts[/code] - Array of Dictionaries {[code]files[/code], [code]copyright[/code], [code]license[/code]} describing subsections of the component
  30. </description>
  31. </method>
  32. <method name="get_donor_info" qualifiers="const">
  33. <return type="Dictionary">
  34. </return>
  35. <description>
  36. Returns a Dictionary of Arrays of donor names.
  37. {[code]platinum_sponsors[/code], [code]gold_sponsors[/code], [code]silver_sponsors[/code], [code]bronze_sponsors[/code], [code]mini_sponsors[/code], [code]gold_donors[/code], [code]silver_donors[/code], [code]bronze_donors[/code]}
  38. </description>
  39. </method>
  40. <method name="get_frames_drawn">
  41. <return type="int">
  42. </return>
  43. <description>
  44. Returns the total number of frames drawn. If the render loop is disabled with [code]--disable-render-loop[/code] via command line, this returns [code]0[/code]. See also [method get_idle_frames].
  45. </description>
  46. </method>
  47. <method name="get_frames_per_second" qualifiers="const">
  48. <return type="float">
  49. </return>
  50. <description>
  51. Returns the frames per second of the running game.
  52. </description>
  53. </method>
  54. <method name="get_idle_frames" qualifiers="const">
  55. <return type="int">
  56. </return>
  57. <description>
  58. Returns the total number of frames passed since engine initialization which is advanced on each [b]idle frame[/b], regardless of whether the render loop is enabled. See also [method get_frames_drawn].
  59. </description>
  60. </method>
  61. <method name="get_license_info" qualifiers="const">
  62. <return type="Dictionary">
  63. </return>
  64. <description>
  65. Returns Dictionary of licenses used by Godot and included third party components.
  66. </description>
  67. </method>
  68. <method name="get_license_text" qualifiers="const">
  69. <return type="String">
  70. </return>
  71. <description>
  72. Returns Godot license text.
  73. </description>
  74. </method>
  75. <method name="get_main_loop" qualifiers="const">
  76. <return type="MainLoop">
  77. </return>
  78. <description>
  79. Returns the main loop object (see [MainLoop] and [SceneTree]).
  80. </description>
  81. </method>
  82. <method name="get_physics_frames" qualifiers="const">
  83. <return type="int">
  84. </return>
  85. <description>
  86. Returns the total number of frames passed since engine initialization which is advanced on each [b]physics frame[/b].
  87. </description>
  88. </method>
  89. <method name="get_physics_interpolation_fraction" qualifiers="const">
  90. <return type="float">
  91. </return>
  92. <description>
  93. Returns the fraction through the current physics tick we are at the time of rendering the frame. This can be used to implement fixed timestep interpolation.
  94. </description>
  95. </method>
  96. <method name="get_singleton" qualifiers="const">
  97. <return type="Object">
  98. </return>
  99. <argument index="0" name="name" type="String">
  100. </argument>
  101. <description>
  102. Returns a global singleton with given [code]name[/code]. Often used for plugins, e.g. [code]GodotPayment[/code] on Android.
  103. </description>
  104. </method>
  105. <method name="get_version_info" qualifiers="const">
  106. <return type="Dictionary">
  107. </return>
  108. <description>
  109. Returns the current engine version information in a Dictionary.
  110. [code]major[/code] - Holds the major version number as an int
  111. [code]minor[/code] - Holds the minor version number as an int
  112. [code]patch[/code] - Holds the patch version number as an int
  113. [code]hex[/code] - Holds the full version number encoded as a hexadecimal int with one byte (2 places) per number (see example below)
  114. [code]status[/code] - Holds the status (e.g. "beta", "rc1", "rc2", ... "stable") as a String
  115. [code]build[/code] - Holds the build name (e.g. "custom_build") as a String
  116. [code]hash[/code] - Holds the full Git commit hash as a String
  117. [code]year[/code] - Holds the year the version was released in as an int
  118. [code]string[/code] - [code]major[/code] + [code]minor[/code] + [code]patch[/code] + [code]status[/code] + [code]build[/code] in a single String
  119. The [code]hex[/code] value is encoded as follows, from left to right: one byte for the major, one byte for the minor, one byte for the patch version. For example, "3.1.12" would be [code]0x03010C[/code]. [b]Note:[/b] It's still an int internally, and printing it will give you its decimal representation, which is not particularly meaningful. Use hexadecimal literals for easy version comparisons from code:
  120. [codeblock]
  121. if Engine.get_version_info().hex &gt;= 0x030200:
  122. # Do things specific to version 3.2 or later
  123. else:
  124. # Do things specific to versions before 3.2
  125. [/codeblock]
  126. </description>
  127. </method>
  128. <method name="has_singleton" qualifiers="const">
  129. <return type="bool">
  130. </return>
  131. <argument index="0" name="name" type="String">
  132. </argument>
  133. <description>
  134. Returns [code]true[/code] if a singleton with given [code]name[/code] exists in global scope.
  135. </description>
  136. </method>
  137. <method name="is_in_physics_frame" qualifiers="const">
  138. <return type="bool">
  139. </return>
  140. <description>
  141. Returns [code]true[/code] if the game is inside the fixed process and physics phase of the game loop.
  142. </description>
  143. </method>
  144. </methods>
  145. <members>
  146. <member name="editor_hint" type="bool" setter="set_editor_hint" getter="is_editor_hint" default="true">
  147. If [code]true[/code], the script is currently running inside the editor. This is useful for [code]tool[/code] scripts to conditionally draw editor helpers, or prevent accidentally running "game" code that would affect the scene state while in the editor:
  148. [codeblock]
  149. if Engine.editor_hint:
  150. draw_gizmos()
  151. else:
  152. simulate_physics()
  153. [/codeblock]
  154. See [url=https://docs.godotengine.org/en/stable/tutorials/misc/running_code_in_the_editor.html]Running code in the editor[/url] in the documentation for more information.
  155. [b]Note:[/b] To detect whether the script is run from an editor [i]build[/i] (e.g. when pressing [code]F5[/code]), use [method OS.has_feature] with the [code]"editor"[/code] argument instead. [code]OS.has_feature("editor")[/code] will evaluate to [code]true[/code] both when the code is running in the editor and when running the project from the editor, but it will evaluate to [code]false[/code] when the code is run from an exported project.
  156. </member>
  157. <member name="iterations_per_second" type="int" setter="set_iterations_per_second" getter="get_iterations_per_second" default="60">
  158. The number of fixed iterations per second. This controls how often physics simulation and [method Node._physics_process] methods are run. This value should generally always be set to [code]60[/code] or above, as Godot doesn't interpolate the physics step. As a result, values lower than [code]60[/code] will look stuttery. This value can be increased to make input more reactive or work around tunneling issues, but keep in mind doing so will increase CPU usage.
  159. </member>
  160. <member name="physics_jitter_fix" type="float" setter="set_physics_jitter_fix" getter="get_physics_jitter_fix" default="0.5">
  161. Controls how much physics ticks are synchronized with real time. For 0 or less, the ticks are synchronized. Such values are recommended for network games, where clock synchronization matters. Higher values cause higher deviation of in-game clock and real clock, but allows smoothing out framerate jitters. The default value of 0.5 should be fine for most; values above 2 could cause the game to react to dropped frames with a noticeable delay and are not recommended.
  162. </member>
  163. <member name="target_fps" type="int" setter="set_target_fps" getter="get_target_fps" default="0">
  164. The desired frames per second. If the hardware cannot keep up, this setting may not be respected. A value of 0 means no limit.
  165. </member>
  166. <member name="time_scale" type="float" setter="set_time_scale" getter="get_time_scale" default="1.0">
  167. Controls how fast or slow the in-game clock ticks versus the real life one. It defaults to 1.0. A value of 2.0 means the game moves twice as fast as real life, whilst a value of 0.5 means the game moves at half the regular speed.
  168. </member>
  169. </members>
  170. <constants>
  171. </constants>
  172. </class>