reasonable. I had no idea struct references and function references were even possible. I use the GUI only because I have a LOT of trouble learning new languages and the GUI just makes it so much easier. I know the purists will hate it but with shortcut keys I think I can program even quicker with the GUI than writing it out.
Writing pure Galaxy is not about productivity, it is about performance and functionality. For example my Imperial Bank system used in the new versions of Undead Assault 3 was written with probably a thousand or so lines of pure Galaxy script because it involved implementing both an AES style encryption and SHA-1 hashes which require a lot of bitwise operations.
Quote:
It really sucks that NONE of this kind of stuff is documented or made easy. Without hearing other people talk about it I would probably have no idea that half the things in the editor even existed or were possible. For example is there somewhere I can learn about the syntax of function references?
Well I was planning on slowly updating the Wiki about it. However I was told that they were in the process of migrating so doing so might result in changes being lost.
Galaxy seems to have use Java style meanings regarding "char" and "byte".
The "char" type represents a single character of a string. It does not evaluate numerically and appears to be a type that was intended for string manipulation purposes but never fully implemented (it appears to have no purpose). It might be used internally by various string natives.
The "byte" type is a non standard C/C++ type representing a 8 bit signed numeric value. It appears to operate similar to the byte type from Java except slightly more restrictive.
There appears to be no 16bit signed type unfortunately meaning you need to waste 2 bytes using an "int". If space is a concern for 16bit types you could always use bit operators to pack 2 different 16bit values into a single int in bitfield style.
Galaxy has very poor implicit type casting. Mixing byte and int with an operator results in a syntax error as only int on int or byte on byte operators are defined. There is also no explicit type casting to get around this. The only way to typecast mid-function appears to be an implicit typecast as a result of variable assignment (int a; a = byte;, byte b; b = int;). This is crucial for array indices as they are only defined for "int" so raise a syntax error when supplied with a byte. Next to these type casting annoyances bytes both function and are packed in memory as expected.
Unless you plan to store a lot of player values so space is an issue, you really should not concern yourself about packing them in a byte rather than an int. SC2 capable systems have so much memory that the maximum heap size of the Galaxy virtual machine is insignificant so memory optimizations are only a concern if the heap limit is a concern.
You can use the native list (extract from the MPQs (CASC in version 3.0 onwards)) for all the native functions to call. Do note that AI natives are declared in separate files from the general trigger natives although they exist in the same pool of available functions for you to call.
For the latest version of the native list at time of posting get it from \StarCraft II\Updates\base\s2-update-base-33553.MPQ where "StarCraft II" is the installation folder.
I meant that the reason they are filled with junk is because it was the wrong patch file. Somewhere should be ones which allow you to extract a non-garbage native list. I think I told you the wrong path to look but I am sure you tried looking for other patch files in other paths right?
Writing pure Galaxy is not about productivity, it is about performance and functionality. For example my Imperial Bank system used in the new versions of Undead Assault 3 was written with probably a thousand or so lines of pure Galaxy script because it involved implementing both an AES style encryption and SHA-1 hashes which require a lot of bitwise operations.
Well I was planning on slowly updating the Wiki about it. However I was told that they were in the process of migrating so doing so might result in changes being lost.
It basically goes as follows.
Does implicit casting from char to int work?(want to store player as a char)
Galaxy seems to have use Java style meanings regarding "char" and "byte".
The "char" type represents a single character of a string. It does not evaluate numerically and appears to be a type that was intended for string manipulation purposes but never fully implemented (it appears to have no purpose). It might be used internally by various string natives.
The "byte" type is a non standard C/C
++
type representing a 8 bit signed numeric value. It appears to operate similar to the byte type from Java except slightly more restrictive.There appears to be no 16bit signed type unfortunately meaning you need to waste 2 bytes using an "int". If space is a concern for 16bit types you could always use bit operators to pack 2 different 16bit values into a single int in bitfield style.
Galaxy has very poor implicit type casting. Mixing byte and int with an operator results in a syntax error as only int on int or byte on byte operators are defined. There is also no explicit type casting to get around this. The only way to typecast mid-function appears to be an implicit typecast as a result of variable assignment (int a; a = byte;, byte b; b = int;). This is crucial for array indices as they are only defined for "int" so raise a syntax error when supplied with a byte. Next to these type casting annoyances bytes both function and are packed in memory as expected.
Unless you plan to store a lot of player values so space is an issue, you really should not concern yourself about packing them in a byte rather than an int. SC2 capable systems have so much memory that the maximum heap size of the Galaxy virtual machine is insignificant so memory optimizations are only a concern if the heap limit is a concern.
@ImperialGood: Go
Thanks for the reply! I think I almost have galaxy down( except for function/method names ).
You can use the native list (extract from the MPQs (CASC in version 3.0 onwards)) for all the native functions to call. Do note that AI natives are declared in separate files from the general trigger natives although they exist in the same pool of available functions for you to call.
@ImperialGood: Go
Which mpq do I extract from? Can you give relative file path?
For the latest version of the native list at time of posting get it from \StarCraft II\Updates\base\s2-update-base-33553.MPQ where "StarCraft II" is the installation folder.
@ImperialGood: Go
Thanks for the reply. Which file do I need from the mpq?
You need "natives.galaxy". This is in "TriggerLibs" of the "base" mod.
@ImperialGood: Go
Thanks I have the file now. How am I supposed to read from it though? It is filed with garbage characters and such.
I had a similar issue, keep trying different latest patch file MPQs until you find one that works.
@ImperialGood: Go
I tried all of them, all the files are filled with junk. Can you provide me with the native list?( dropbox/pastebin link? )
They are not all filled with junk, you must just be looking in the wrong place.
I thought I was looking in the right place, they were all named natives.galaxy. Anyways, thanks that helps a lot!
I meant that the reason they are filled with junk is because it was the wrong patch file. Somewhere should be ones which allow you to extract a non-garbage native list. I think I told you the wrong path to look but I am sure you tried looking for other patch files in other paths right?
@ImperialGood: Go
Yea, I guess I just assumed since the first however many files were filed with garbage all of them would be.