I know there are trigger limits, and other stuff, but what about an imported script?
Using Andromeda as a compiler, all my dedicated code files (coded outside of editor) are compressed to one .galaxy file which is then imported into the map. But even after compilation my map is still 90 KB, and when I look at the overall manager thing, nothing about imported stuff is listed...
If there isn't a limit... why isn't everyone using this method? I have like 2.6k lines of code and I'm like less than 1% to the max file size...
Hm, does that mean it is possible to use almost unlimited amount of memory by just importing script that generate variables?
Vermore, the most reasonable answer to that question is that no one has officially revealed that solution to the public. Even if that was the case, the editor doesn't support it in a manner that would make users want to use it, we'll have to use third party applications in order to get this to work.
If only someone could create a better editor for us to use. Somewhat like how NewGen was to the official World Editor.
IF it's true. IF. I don't really think so. I don't see any reason why imported script wouldn't count towards the limit.
Probably it doesn't get registered by the editor if it doesn't parse imported files. I'm fairly certain that, even if you can circumvent the map editor error message that way, the game will still crash on your once you're out of memory.
IF it's true. IF. I don't really think so. I don't see any reason why imported script wouldn't count towards the limit.
Probably it doesn't get registered by the editor if it doesn't parse imported files. I'm fairly certain that, even if you can circumvent the map editor error message that way, the game will still crash on your once you're out of memory.
Yeah, I've been wondering about that myself. However, it would be nice to get a confirmation on if the memory limit is just an editor limit or a game limit.
Well, I can answer that already: It's a game limit. The virtual machine (the program that runs the Galaxy code while SC2 is running) uses a 21 byte long pointer. That means it can only point to memory addresses between 0 and 2^21 bytes (= 2 megabyte).
As long as this pointer doesn't become larger you just can't have more memory. And making the pointer larger isn't as easy as it might sound.
However, Galaxy partially draws stuff out of external sources. For example strings. Even large strings that take up lots of memory are saved outside of the 2MB area, so internally they only take up very little space. That doesn't happen for string literals though.
So using strings you can save way more info.
Now the question only is whether imported scripts are saved within the VM's memory or not. And I can't see a reason why it would be saved outside.
Yeah, as you guessed s3rius, there is a limit even on imported scripts. But would allowed size of my code drastically increase for me? It seems like triggers take a lot of space in the editor... I only have triggers for a few buttons and some debugging tools, the rest (the majority) of my code runs on functions.
What I'm scared of now, is to continue on coding until one day I reach a limit... but I wouldn't know how close I am. :(
Last question is... what are string literals? I know what strings are but "literals"? (I'm still a programming newbie)
Finally, I have a few questions concerning strings...
Character limit on strings?
I need around 600 strings 200 characters each and like another 600 strings 50 characters each, would I reach a limit?
See the Galaxy FAQ, you shouldn't have any problems, even with a lot of string literals. We're talking about extreme amounts of data here.
As for storing strings outside Galaxy, I believe s3rius means through the StringExternal() mechanism which returns a text. Ex: StringExternal("Unit/Name/Marine") returns a text holding "Marine."
Yes, string external or generation through algorithms (which is considerably hard when we're talking about random messages)
The point is - if you do this:
strings="this is a string literal"UIDisplayMessage(bla,bla,StringToText(s));
Then you still have the literal in there. Because you use the literal to set the variable. The literal doesn't disappear, you just change it's place.
While(i<10){s+=IntToString(i);i+=1;}
That doesn't involve a literal, for example. The string stored in here won't take up the full memory of "0123456789", but instead will only be as large as a handle, which is 4 bytes.
That being said you shouldn't trouble yourself too much. I keep almost everything as a string literal because I don't give a damn. If you're not absolutely wasteful with the memory space or unless you're making a really really big project you shouldn't give a damn too.
I know there are trigger limits, and other stuff, but what about an imported script?
Using Andromeda as a compiler, all my dedicated code files (coded outside of editor) are compressed to one .galaxy file which is then imported into the map. But even after compilation my map is still 90 KB, and when I look at the overall manager thing, nothing about imported stuff is listed...
If there isn't a limit... why isn't everyone using this method? I have like 2.6k lines of code and I'm like less than 1% to the max file size...
I don't know if there is a limit to imported script (but I'd believe so).
Just try it out - add a a couple of huge variables to your map:
int[500][500][500][500] x;
int[500][500][500][500] y;
int[500][500][500][500] z;
If your map compiles well and doesn't crash then you're good to go.
Hm, does that mean it is possible to use almost unlimited amount of memory by just importing script that generate variables?
Vermore, the most reasonable answer to that question is that no one has officially revealed that solution to the public. Even if that was the case, the editor doesn't support it in a manner that would make users want to use it, we'll have to use third party applications in order to get this to work.
If only someone could create a better editor for us to use. Somewhat like how NewGen was to the official World Editor.
@redmarine: Go
IF it's true. IF. I don't really think so. I don't see any reason why imported script wouldn't count towards the limit.
Probably it doesn't get registered by the editor if it doesn't parse imported files. I'm fairly certain that, even if you can circumvent the map editor error message that way, the game will still crash on your once you're out of memory.
Yeah, I've been wondering about that myself. However, it would be nice to get a confirmation on if the memory limit is just an editor limit or a game limit.
Well, I can answer that already: It's a game limit. The virtual machine (the program that runs the Galaxy code while SC2 is running) uses a 21 byte long pointer. That means it can only point to memory addresses between 0 and 2^21 bytes (= 2 megabyte).
As long as this pointer doesn't become larger you just can't have more memory. And making the pointer larger isn't as easy as it might sound.
However, Galaxy partially draws stuff out of external sources. For example strings. Even large strings that take up lots of memory are saved outside of the 2MB area, so internally they only take up very little space. That doesn't happen for string literals though.
So using strings you can save way more info.
Now the question only is whether imported scripts are saved within the VM's memory or not. And I can't see a reason why it would be saved outside.
Sorry for the late reply.
Here are the results: "Script load failed: Could not allocate Global Memory (try reducing the size)"
Using:
Yeah, as you guessed s3rius, there is a limit even on imported scripts. But would allowed size of my code drastically increase for me? It seems like triggers take a lot of space in the editor... I only have triggers for a few buttons and some debugging tools, the rest (the majority) of my code runs on functions.
What I'm scared of now, is to continue on coding until one day I reach a limit... but I wouldn't know how close I am. :(
Last question is... what are string literals? I know what strings are but "literals"? (I'm still a programming newbie)
Finally, I have a few questions concerning strings...
Character limit on strings?
I need around 600 strings 200 characters each and like another 600 strings 50 characters each, would I reach a limit?
Triggers in the editor take up more space, yes. But what counts is the compiled script. And that size is the same no matter where you write it.
Unless you're working on a really big project or you're messing up somewhere you shouldn't reach that limit anytime soon.
A string literal is a string which isn't in a variable.
This for example. The string isn't just stored in a variable by written down in the script. So it eats up space in the script, like everything else.
Yes I'm working on a project which is a bit large scale.
As for string literals, thanks. :) Is it wise to store all constant messages and display them via variables rather than string literals then?
See the Galaxy FAQ, you shouldn't have any problems, even with a lot of string literals. We're talking about extreme amounts of data here.
As for storing strings outside Galaxy, I believe s3rius means through the StringExternal() mechanism which returns a text. Ex: StringExternal("Unit/Name/Marine") returns a text holding "Marine."
Yes, string external or generation through algorithms (which is considerably hard when we're talking about random messages)
The point is - if you do this:
Then you still have the literal in there. Because you use the literal to set the variable. The literal doesn't disappear, you just change it's place.
That doesn't involve a literal, for example. The string stored in here won't take up the full memory of "0123456789", but instead will only be as large as a handle, which is 4 bytes.
That being said you shouldn't trouble yourself too much. I keep almost everything as a string literal because I don't give a damn. If you're not absolutely wasteful with the memory space or unless you're making a really really big project you shouldn't give a damn too.