@@ -63,15 +63,15 @@ either? Let's see an example:
6363 # with .new().
6464 #
6565 # 2. The preloaded value is inaccessible from the Script object alone. As
66- # such, preloading the value here actually does not benefit anyone .
66+ # such, preloading the value here actually does not provide any benefit .
6767 #
6868 # 3. Because the user exports the value, if this script stored on
6969 # a node in a scene file, the scene instantiation code will overwrite the
7070 # preloaded initial value anyway (wasting it). It's usually better to
71- # provide null, empty, or otherwise invalid default values for exports.
71+ # provide ` null ` , empty, or otherwise invalid default values for exports.
7272 #
73- # 4. It is when one instantiates this script on its own with .new() that
74- # one will load "office.tscn" rather than the exported value .
73+ # 4. Instantiating the script on its own with .new() triggers
74+ # ` load( "office.tscn") `, ignoring any value set through the export .
7575 @export var a_building : PackedScene = preload("office.tscn")
7676
7777 # Uh oh! This results in an error!
@@ -121,12 +121,11 @@ either? Let's see an example:
121121
122122Preloading allows the script to handle all the loading the moment one loads the
123123script. Preloading is useful, but there are also times when one doesn't wish
124- for it. To distinguish these situations, there are a few things one can
125- consider:
124+ to use it. Here are a few considerations when determining which to use:
126125
1271261. If one cannot determine when the script might load, then preloading a
128- resource, especially a scene or script, could result in further loads one
129- does not expect. This could lead to unintentional, variable-length
127+ resource ( especially a scene or script) could result in additional loads
128+ one does not expect. This could lead to unintentional, variable-length
130129 load times on top of the original script's load operations.
131130
1321312. If something else could replace the value (like a scene's exported
@@ -142,21 +141,21 @@ consider:
142141 perhaps not even initialized until later).
143142
144143 2. If the script requires a great many dependencies, and one does not wish
145- to consume so much memory, then one may wish to, load and unload various
144+ to consume so much memory, then one may wish to load and unload various
146145 dependencies at runtime as circumstances change. If one preloads
147146 resources into constants, then the only way to unload these resources
148147 would be to unload the entire script. If they are instead loaded
149- properties, then one can set them to ``null `` and remove all references
150- to the resource entirely (which, as a
148+ as properties, then one can set these properties to ``null `` and remove
149+ all references to the resource (which, as a
151150 :ref: `RefCounted <class_RefCounted >`-extending type, will cause the
152151 resources to delete themselves from memory).
153152
154153Large levels: static vs. dynamic
155154--------------------------------
156155
157156If one is creating a large level, which circumstances are most appropriate?
158- Should they create the level as one static space? Or should they load the
159- level in pieces and shift the world's content as needed?
157+ Is it better to create the level as one static space? Or is it better to load
158+ the level in pieces and shift the world's content as needed?
160159
161160Well, the simple answer is, "when the performance requires it." The
162161dilemma associated with the two options is one of the age-old programming
@@ -173,21 +172,21 @@ creation/loading and deletion/unloading of resources and nodes in real-time.
173172Games with large and varied environments or procedurally generated
174173elements often implement these strategies to avoid wasting memory.
175174
176- On the flip side, coding a dynamic system is more complex, i.e. uses more
177- programmed logic, which results in opportunities for errors and bugs. If one
175+ On the flip side, coding a dynamic system is more complex; it uses more
176+ programmed logic which results in opportunities for errors and bugs. If one
178177isn't careful, they can develop a system that bloats the technical debt of
179178the application.
180179
181180As such, the best options would be...
182181
183- 1. To use a static level for smaller games.
182+ 1. Use static levels for smaller games.
184183
1851842. If one has the time/resources on a medium/large game, create a library or
186- plugin that can code the management of nodes and resources. If refined
187- over time, so as to improve usability and stability, then it could evolve
185+ plugin that can manage nodes and resources with code . If refined
186+ over time so as to improve usability and stability, then it could evolve
188187 into a reliable tool across projects.
189188
190- 3. Code the dynamic logic for a medium/large game because one has the coding
189+ 3. Use dynamic logic for a medium/large game because one has the coding
191190 skills, but not the time or resources to refine the code (game's
192191 gotta get done). Could potentially refactor later to outsource the code
193192 into a plugin.
0 commit comments