docs_writing_guidelines.rst 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. .. _doc_docs_writing_guidelines:
  2. Docs writing guidelines
  3. =============================
  4. The Godot community is rich and international. Users come from all
  5. around the world. Some of them are young, and many aren't native English
  6. speakers. That's why we must all write using a clear and a common
  7. language. For the class reference, the goal is to make it easy to read
  8. for everyone and precise.
  9. In summary, always try to:
  10. 1. Use the direct voice
  11. 2. Use precise action verbs
  12. 3. Avoid verbs that end in -ing
  13. 4. Remove unnecessary adverbs and adjectives.
  14. 5. Ban these 8 words: obvious, simple, basic, easy, actual, just, clear, and however
  15. 6. Use explicit references
  16. 7. Use 's to show possession
  17. There are 3 rules to describe classes:
  18. 1. Give an overview of the node in the brief description
  19. 2. Mention what methods return if it's useful
  20. 3. Use "if true" to describe booleans
  21. .. note::
  22. A technical writer's job is to pack as much information as possible into
  23. the smallest and clearest sentences possible. These guidelines will help
  24. you work towards that goal.
  25. 7 rules for a clear english
  26. ---------------------------
  27. Use the direct voice
  28. ~~~~~~~~~~~~~~~~~~~~
  29. Use the direct voice when possible. Take the classes, methods, and
  30. constants you describe as the subject. It's natural to write using the
  31. passive voice, but it's harder to read and produces longer sentences.
  32. .. highlight:: none
  33. Passive:
  34. ::
  35. The man **was bitten** by the dog.
  36. Active:
  37. ::
  38. The dog bit the man.
  39. **Don't** use the passive voice:
  40. ::
  41. void edit_set_pivot ( Vector2 pivot )
  42. [...] This method **is implemented** only in some nodes that inherit Node2D.
  43. **Do** use the node's name as a noun:
  44. ::
  45. void edit_set_pivot ( Vector2 pivot )
  46. [...] Only some Node2Ds **implement** this method.
  47. Use precise action verbs
  48. ~~~~~~~~~~~~~~~~~~~~~~~~
  49. Favor precise yet common verbs over generic ones like ``make``, ``set``,
  50. and any expression you can replace with a single word.
  51. **Don't** repeat the method's name. It already states it sets the pivot
  52. value to a new one:
  53. ::
  54. void edit_set_pivot ( Vector2 pivot )
  55. Set the pivot position of the 2D node to [code]pivot[/code] value. [...]
  56. **Do** explain what's the consequence of this "set": use precise verbs
  57. like ``place``, ``position``, ``rotate``, ``fade``, etc.
  58. ::
  59. void edit_set_pivot ( Vector2 pivot )
  60. Position the node's pivot to the [code]pivot[/code] value. [...]
  61. Avoid verbs that end in -ing
  62. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  63. The progressive forms describe continuous actions. E.g. "is calling",
  64. "is moving".
  65. **Don't** use the progressive form for instant changes.
  66. ::
  67. Vector2 move ( Vector2 rel_vec )
  68. Move the body in the given direction, **stopping** if there is an obstacle. [...]
  69. **Do** use simple present, preterit or future.
  70. ::
  71. Vector2 move ( Vector2 rel_vec )
  72. Moves the body in the vector's direction. The body **stops** if it collides with an obstacle. [...]
  73. You may use the progressive tense to describe actions that are
  74. continuous in time. Anything like animation or coroutines.
  75. .. tip::
  76. Verbs can turn into adjectival nouns with -ing. This is not a
  77. conjugation, so you may use them: ``the remaining movement``,
  78. ``the missing file``, etc.
  79. Remove unnecessary adverbs and adjectives
  80. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  81. Write as few adjectives and adverbs as possible. Only use them if they
  82. add key information to the description.
  83. **Don't** use redundant or meaningless adverbs. Words that lengthen the
  84. documentation but don't add any information:
  85. ::
  86. **Basically** a big texture [...]
  87. **Do** write short sentences in a simple, descriptive language:
  88. ::
  89. A big texture [...]
  90. Ban these 8 words
  91. ~~~~~~~~~~~~~~~~~
  92. **Don't** ever use these 8 banned words:
  93. 1. obvious
  94. 2. simple
  95. 3. basic
  96. 4. easy
  97. 5. actual
  98. 6. just
  99. 7. clear
  100. 8. however (some uses)
  101. Game creation and programming aren't simple, and nothing's easy to
  102. someone learning to use the API for the first time. Other words in the
  103. list, like ``just`` or ``actual`` won't add any info to the sentence.
  104. Don't use corresponding adverbs either: obviously, simply, basically,
  105. easily, actually, clearly.
  106. **Don't** example. The banned words lengthen the description and take
  107. attention away from the most important info:
  108. ::
  109. **TextureRect**
  110. Control frame that **simply** draws an assigned texture. It can stretch or not. It's a **simple** way to **just** show an image in a UI.
  111. **Do** remove them:
  112. ::
  113. **TextureRect**
  114. [Control] node that displays a texture. The texture can stretch to the node's bounding box or stay in the center. Useful to display sprites in your UIs.
  115. "Simple" never helps. Remember, for other users, anything could be
  116. complex or frustrate them. There's nothing like a good old *it's simple*
  117. to make you cringe. Here's the old brief description, the first sentence
  118. on the Timer node's page:
  119. ::
  120. **Timer**
  121. A **simple** Timer node.
  122. **Do** explain what the node does instead:
  123. ::
  124. **Timer**
  125. Calls a function of your choice after a certain duration.
  126. **Don't** use "basic", it is too vague:
  127. ::
  128. **Vector3**
  129. Vector class, which performs **basic** 3D vector math operations.
  130. **Do** use the brief description to offer an overview of the node:
  131. ::
  132. **Vector3**
  133. Provides essential math functions to manipulate 3D vectors: cross product, normalize, rotate, etc.
  134. Use explicit references
  135. ~~~~~~~~~~~~~~~~~~~~~~~
  136. Favor explicit references over implicit ones.
  137. **Don't** use words like "the former", "the latter", etc. They're not
  138. the most common in English, and they require you to check the reference.
  139. ::
  140. [code]w[/code] and [code]h[/code] define right and bottom margins. The **latter** two resize the texture so it fits in the defined margin.
  141. **Do** repeat words. They remove all ambiguity:
  142. ::
  143. [code]w[/code] and [code]h[/code] define right and bottom margins. **[code]w[/code] and [code]h[/code]** resize the texture so it fits the margin.
  144. If you need to repeat the same variable name 3 or 4 times, you probably
  145. need to rephrase your description.
  146. Use 's to show possession
  147. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  148. Avoid "The milk **of** the cow". It feels unnatural in English. Write "The cow's
  149. milk" instead.
  150. **Don't** write "of the X":
  151. ::
  152. The region **of the AtlasTexture that is** used.
  153. **Do** use ``'s``. It lets you put the main subject at the start of the
  154. sentence, and keep it short:
  155. ::
  156. The **AtlasTexture's** used region.
  157. How to write methods and classes
  158. --------------------------------
  159. Give an overview of the node in the brief description
  160. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  161. The brief description is the reference's most important sentence. It's
  162. the user's first contact with a node:
  163. 1. It's the only description in the "Create New Node" dialog.
  164. 2. It's at the top of every page in the reference
  165. The brief description should explain the node's role and its
  166. functionality, in up to 200 characters.
  167. **Don't** write tiny and vague summaries:
  168. ::
  169. **Node2D**
  170. Base node for 2D system.
  171. **Do** give an overview of the node's functionality:
  172. ::
  173. **Node2D**
  174. 2D game object, parent of all 2D related nodes. Has a position, rotation, scale and z-index.
  175. Use the node's full description to provide more information, and a code
  176. example, if possible.
  177. Mention what methods return if it's useful
  178. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  179. Some methods return important values. Describe them at the end of the
  180. description, ideally on a new line. No need to mention the return values
  181. for any method whose name starts with ``set`` or ``get``.
  182. **Don't** use the passive voice:
  183. ::
  184. Vector2 move ( Vector2 rel_vec )
  185. [...] The returned vector is how much movement was remaining before being stopped.
  186. **Do** always use "Returns".
  187. ::
  188. Vector2 move ( Vector2 rel_vec )
  189. [...] Returns the remaining movement before the body was stopped.
  190. Notice the exception to the "direct voice" rule: with the move method,
  191. an external collider can influence the method and the body that calls
  192. ``move``. In this case, you can use the passive voice.
  193. Use "if true" to describe booleans
  194. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  195. For boolean member variables, always use ``if true`` and/or
  196. ``if false``, to stay explicit. ``Controls whether or not`` may be
  197. ambiguous and won't work for every member variable.
  198. Also surround boolean values, variable names and methods with [code][/code].
  199. **Do** start with "if true":
  200. ::
  201. Timer.autostart
  202. If [code]true[/code] the timer will automatically start when it enters the scene tree. Default value: [code]false[/code].
  203. Use [code] around arguments
  204. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  205. In the class reference, always surround arguments with [code][/code]. In the documentation and in Godot, it will display like ``this``. When you edit XML files in the Godot repository, replace existing arguments written like 'this' or \`this\` with [code]this[/code].
  206. Common vocabulary to use in godot's docs
  207. ----------------------------------------
  208. The developers chose some specific words to refer to areas of the
  209. interface. They're used in the sources, in the documentation, and you
  210. should always use them instead of synonyms, so the users know what
  211. you're talking about.
  212. .. figure:: /img/editor-vocabulary-overview.png
  213. :alt: Overview of the interface and common vocabulary
  214. Overview of the interface and common vocabulary
  215. In the top left corner of the editor lie the ``main menus``. In the
  216. center, the buttons change the ``workspace``. And together the buttons
  217. in the top right are the ``playtest buttons``. The area in the center,
  218. that displays the 2D or the 3D space, is the ``viewport``. At its top,
  219. you find a list of ``tools`` inside the ``toolbar``.
  220. The tabs or dockable panels on either side of the viewport are
  221. ``docks``. You have the ``FileSystem dock``, the ``Scene dock`` that
  222. contains your scene tree, the ``Import dock``, the ``Node dock``, and
  223. the ``Inspector`` or ``Inspector dock``. With the default layout you may
  224. call the tabbed docks ``tabs``: the ``Scene tab``, the ``Node tab``...
  225. The Animation, Debugger, etc. at the bottom of the viewport are
  226. ``panels``. Together they make up the ``bottom panels``.
  227. Foldable areas of the Inspector are ``sections``. The node's parent
  228. class names, which you can't fold, are ``Classes`` e.g. the
  229. ``KinematicBody2D class``. And individual lines with key-value pairs are
  230. ``properties``. E.g. ``position`` or ``modulate color`` are both
  231. ``properties``.