Engine.xml 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Engine" inherits="Object" version="3.3">
  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. <description>
  15. Returns engine author information in a Dictionary.
  16. [code]lead_developers[/code] - Array of Strings, lead developer names
  17. [code]founders[/code] - Array of Strings, founder names
  18. [code]project_managers[/code] - Array of Strings, project manager names
  19. [code]developers[/code] - Array of Strings, developer names
  20. </description>
  21. </method>
  22. <method name="get_copyright_info" qualifiers="const">
  23. <return type="Array" />
  24. <description>
  25. Returns an Array of copyright information Dictionaries.
  26. [code]name[/code] - String, component name
  27. [code]parts[/code] - Array of Dictionaries {[code]files[/code], [code]copyright[/code], [code]license[/code]} describing subsections of the component
  28. </description>
  29. </method>
  30. <method name="get_donor_info" qualifiers="const">
  31. <return type="Dictionary" />
  32. <description>
  33. Returns a Dictionary of Arrays of donor names.
  34. {[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]}
  35. </description>
  36. </method>
  37. <method name="get_frames_drawn">
  38. <return type="int" />
  39. <description>
  40. 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].
  41. </description>
  42. </method>
  43. <method name="get_frames_per_second" qualifiers="const">
  44. <return type="float" />
  45. <description>
  46. Returns the frames per second of the running game.
  47. </description>
  48. </method>
  49. <method name="get_idle_frames" qualifiers="const">
  50. <return type="int" />
  51. <description>
  52. 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].
  53. </description>
  54. </method>
  55. <method name="get_license_info" qualifiers="const">
  56. <return type="Dictionary" />
  57. <description>
  58. Returns Dictionary of licenses used by Godot and included third party components.
  59. </description>
  60. </method>
  61. <method name="get_license_text" qualifiers="const">
  62. <return type="String" />
  63. <description>
  64. Returns Godot license text.
  65. </description>
  66. </method>
  67. <method name="get_main_loop" qualifiers="const">
  68. <return type="MainLoop" />
  69. <description>
  70. Returns the main loop object (see [MainLoop] and [SceneTree]).
  71. </description>
  72. </method>
  73. <method name="get_physics_frames" qualifiers="const">
  74. <return type="int" />
  75. <description>
  76. Returns the total number of frames passed since engine initialization which is advanced on each [b]physics frame[/b].
  77. </description>
  78. </method>
  79. <method name="get_physics_interpolation_fraction" qualifiers="const">
  80. <return type="float" />
  81. <description>
  82. 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.
  83. </description>
  84. </method>
  85. <method name="get_singleton" qualifiers="const">
  86. <return type="Object" />
  87. <argument index="0" name="name" type="String" />
  88. <description>
  89. Returns a global singleton with given [code]name[/code]. Often used for plugins, e.g. [code]GodotPayment[/code] on Android.
  90. </description>
  91. </method>
  92. <method name="get_version_info" qualifiers="const">
  93. <return type="Dictionary" />
  94. <description>
  95. Returns the current engine version information in a Dictionary.
  96. [code]major[/code] - Holds the major version number as an int
  97. [code]minor[/code] - Holds the minor version number as an int
  98. [code]patch[/code] - Holds the patch version number as an int
  99. [code]hex[/code] - Holds the full version number encoded as a hexadecimal int with one byte (2 places) per number (see example below)
  100. [code]status[/code] - Holds the status (e.g. "beta", "rc1", "rc2", ... "stable") as a String
  101. [code]build[/code] - Holds the build name (e.g. "custom_build") as a String
  102. [code]hash[/code] - Holds the full Git commit hash as a String
  103. [code]year[/code] - Holds the year the version was released in as an int
  104. [code]string[/code] - [code]major[/code] + [code]minor[/code] + [code]patch[/code] + [code]status[/code] + [code]build[/code] in a single String
  105. 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:
  106. [codeblock]
  107. if Engine.get_version_info().hex &gt;= 0x030200:
  108. # Do things specific to version 3.2 or later
  109. else:
  110. # Do things specific to versions before 3.2
  111. [/codeblock]
  112. </description>
  113. </method>
  114. <method name="has_singleton" qualifiers="const">
  115. <return type="bool" />
  116. <argument index="0" name="name" type="String" />
  117. <description>
  118. Returns [code]true[/code] if a singleton with given [code]name[/code] exists in global scope.
  119. </description>
  120. </method>
  121. <method name="is_in_physics_frame" qualifiers="const">
  122. <return type="bool" />
  123. <description>
  124. Returns [code]true[/code] if the game is inside the fixed process and physics phase of the game loop.
  125. </description>
  126. </method>
  127. </methods>
  128. <members>
  129. <member name="editor_hint" type="bool" setter="set_editor_hint" getter="is_editor_hint" default="true">
  130. 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:
  131. [codeblock]
  132. if Engine.editor_hint:
  133. draw_gizmos()
  134. else:
  135. simulate_physics()
  136. [/codeblock]
  137. See [url=https://docs.godotengine.org/en/3.3/tutorials/misc/running_code_in_the_editor.html]Running code in the editor[/url] in the documentation for more information.
  138. [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.
  139. </member>
  140. <member name="iterations_per_second" type="int" setter="set_iterations_per_second" getter="get_iterations_per_second" default="60">
  141. 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.
  142. </member>
  143. <member name="physics_jitter_fix" type="float" setter="set_physics_jitter_fix" getter="get_physics_jitter_fix" default="0.5">
  144. 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 the in-game clock and real clock but smooth 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.
  145. [b]Note:[/b] For best results, when using a custom physics interpolation solution, the physics jitter fix should be disabled by setting [member physics_jitter_fix] to [code]0[/code].
  146. </member>
  147. <member name="target_fps" type="int" setter="set_target_fps" getter="get_target_fps" default="0">
  148. The desired frames per second. If the hardware cannot keep up, this setting may not be respected. A value of 0 means no limit.
  149. </member>
  150. <member name="time_scale" type="float" setter="set_time_scale" getter="get_time_scale" default="1.0">
  151. 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.
  152. </member>
  153. </members>
  154. <constants>
  155. </constants>
  156. </class>