Difference between revisions of "AGIWiki/Managing resources"

Jump to navigation Jump to search
m
Text replacement - "<source lang=" to "<syntaxhighlight lang="
m
m (Text replacement - "<source lang=" to "<syntaxhighlight lang=")
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
{{AGIWiki}}
{{AGIWiki}}


Line 23: Line 24:
=== Be mindful of view sizes ===
=== Be mindful of view sizes ===


When you [[AGIWiki/Load.view|load a view resource]], the ''entire'' resource gets loaded into memory. It doesn't matter if you are using only one [[AGIWiki/Loop|loop]] or even just one [[AGIWiki/Cel|cel]]<nowiki>! If you find you are exhausting your memory, check for views that are being loaded in the </nowiki>[[AGIWiki/Room|room]] that have unused loops or cels in them. If you can move those parts out of that view, you can save ''a lot'' of memory.
When you [[AGIWiki/load.view|load a view resource]], the ''entire'' resource gets loaded into memory. It doesn't matter if you are using only one [[AGIWiki/Loop|loop]] or even just one [[AGIWiki/Cel|cel]]<nowiki>! If you find you are exhausting your memory, check for views that are being loaded in the </nowiki>[[AGIWiki/Room|room]] that have unused loops or cels in them. If you can move those parts out of that view, you can save ''a lot'' of memory.


=== Be concise ===
=== Be concise ===
Line 29: Line 30:
When you are [[AGIWiki/Print|printing]] a [[AGIWiki/Message|message]] to the screen, ''every single letter'' adds a byte to the total amount of memory that the [[AGIWiki/Logic|logic resource]] is using. This means you can't write like a student who's been assigned a 5-page paper and only has 3 pages of content. You must cut the fat.
When you are [[AGIWiki/Print|printing]] a [[AGIWiki/Message|message]] to the screen, ''every single letter'' adds a byte to the total amount of memory that the [[AGIWiki/Logic|logic resource]] is using. This means you can't write like a student who's been assigned a 5-page paper and only has 3 pages of content. You must cut the fat.


<syntax type="C++">
<syntaxhighlight lang="cpp">
print("I do not know whether or not he will come.");
print("I do not know whether or not he will come.");
print("I didn't actually do that in reality.");
print("I didn't actually do that in reality.");
</syntax>
</syntaxhighlight>


The above two print commands are wasting memory! They use far too many characters to say what they're trying to say. Compare to these far better versions:
The above two print commands are wasting memory! They use far too many characters to say what they're trying to say. Compare to these far better versions:


<syntax type="C++">
<syntaxhighlight lang="cpp">
print("I don't know whether he'll come.");
print("I don't know whether he'll come.");
print("I didn't do that."); // OR
print("I didn't do that."); // OR
print("I didn't really do that.");
print("I didn't really do that.");
</syntax>
</syntaxhighlight>


The sentence ''I don't know whether he'll come.'' is 10 bytes less memory than ''I do not know whether or not he will come.'' and it says the same thing. Similarly, ''I didn't do that.'' is 20 bytes less memory than ''I didn't actually do that in reality.''
The sentence ''I don't know whether he'll come.'' is 10 bytes less memory than ''I do not know whether or not he will come.'' and it says the same thing. Similarly, ''I didn't do that.'' is 20 bytes less memory than ''I didn't actually do that in reality.''
Line 47: Line 48:


So, yes, good writing skills can help you avoid an [[AGIWiki/Out of memory error|out of memory error]]. Go figure.
So, yes, good writing skills can help you avoid an [[AGIWiki/Out of memory error|out of memory error]]. Go figure.
== Related links ==
* [[AGIWiki/Memory and Script|Memory and Script]]


[[Category:AGIWiki/Tutorials]]
[[Category:AGIWiki/Tutorials]]
TrustedUser
2,147

edits

Navigation menu