Alright I guess this is manageable. The biggest things for me is going to be the explicit type casting and pointers. However, I should be able to adjust and get much better performance doing galaxy. Also, I hate browsing through those dumb dialogs lol. I will begin to try to understand galaxy and how implement it.
You would only disallow user made code. Not the whole engine lol. After all the engine was written in c not galaxy. They could even not include standard libraries and just allow what they have built. Yes pointers could point to invalid stuff, however it would be restricted enough not to be dangerous.The worst that would happen is a possible game crash. In such a case, nobody would play the map. But, I guess playing it safe is usually better.
"In any case there is limited use for pointers in SC2. The main ones I hear are for dynamic memory allocation systems but that is really about it."
I could probably name a list of 25 things that can only be done with pointers, however more than half of them are useless in making a map. Pointers are only used whenever they are required.( at least if they know what they are doing )
Personally, I feel they should allow restricted pointers and restricted type casting. Putting a huge warning label on it to only use if you know what you are doing. They could probably even write a script to test the safety of your map before allowing you to publish.
Yes references are safer than pointers, I use references if possible. However, there are many cases were pointers are required. I am not going to through the list of how many things you cant do without pointers, but it is long. About the trojan thing, that is a very easy fix. DISALLOW including anything but standard libraries and remove file access. This would prevent any kind of virus from being made. Sc2 was written in c++ and therefore, they could make a userCode class and hide all sc2 core data from the user.( several ways of doing it ) There would be no way to exploit the user, other than possibly crashing the game. DLL injects, windows libraries, COM, writing to memory addresses, and everything particularity dangerous would be hidden and unusable.
Thanks for the reply. Guess I will just typedef fixed as float. I have used pointers for years and have never had any real issues. Pointers are only bad in the hands of bad programmers( in the case they shouldn't be programming in the first place ) I would be perfectly fine with pointers and am disappointed they aren't supported.
"They only do bad things if written badly. Which is easy to do but shouldn't we bear that responsibility?"
Agreed.
"If they wanted to ensure that we didn't accidentally mess with any of the core SC2 data/code then couldn't they just check the location every time a pointer is dereferenced to make sure it is within the memory section allocated to our own code and data? Better a child safe dumned down pointer than no pointer at all."
No that would give very poor performance, what they could do is set compile time restrictions on pointers, like prevent accessing pointers or taking address of sc2 core data.
What does a lack of float/double have to do with the inability to do maths?
Well it feels like a waste of space to typedef an int[2] to use it as a float/double. It also takes more cpu to do the math this way. If I recall the editor had floats, are they just an int[2]? Also what is the fixed type?
How are strings defined? In C it is just an array of characters: char buffer[255];
How are strings done here? Are the strings NULL terminated?
Thanks for the reply. I still have a few questions though.
For security reason pointers are disabled.
Can I still do pointer arithmetic with arrays?((an array is practically a pointer) get a new array starting at an index without copying)
EX: int* i = new int[50];
*(i+2)
or
&i[2]
Explicit typecasting is not supported
Wow...
Arrays are defined as a type.
Getting pointer to array at element possible?
There are no C standard libraries.
No dynamic memory allocation? Run out of memory?
There is no native floating point support.
How are you supposed to do any sort of math?(float,double)
Are enums, ctors, dtors supported?
Does the this pointer exist?
Is there some kind of documentation on all the different functions/methods there are in galaxy? Some documentation on syntax and comparisons to other programming languages would be nice.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
@ImperialGood: Go
Yea, I guess I just assumed since the first however many files were filed with garbage all of them would be.
I thought I was looking in the right place, they were all named natives.galaxy. Anyways, thanks that helps a lot!
@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? )
@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.
@ImperialGood: Go
Thanks for the reply. Which file do I need from the mpq?
@ImperialGood: Go
Which mpq do I extract from? Can you give relative file path?
@ImperialGood: Go
Thanks for the reply! I think I almost have galaxy down( except for function/method names ).
Does implicit casting from char to int work?(want to store player as a char)
Alright I guess this is manageable. The biggest things for me is going to be the explicit type casting and pointers. However, I should be able to adjust and get much better performance doing galaxy. Also, I hate browsing through those dumb dialogs lol. I will begin to try to understand galaxy and how implement it.
@ImperialGood: Go
You would only disallow user made code. Not the whole engine lol. After all the engine was written in c not galaxy. They could even not include standard libraries and just allow what they have built. Yes pointers could point to invalid stuff, however it would be restricted enough not to be dangerous.The worst that would happen is a possible game crash. In such a case, nobody would play the map. But, I guess playing it safe is usually better.
"In any case there is limited use for pointers in SC2. The main ones I hear are for dynamic memory allocation systems but that is really about it." I could probably name a list of 25 things that can only be done with pointers, however more than half of them are useless in making a map. Pointers are only used whenever they are required.( at least if they know what they are doing )
Personally, I feel they should allow restricted pointers and restricted type casting. Putting a huge warning label on it to only use if you know what you are doing. They could probably even write a script to test the safety of your map before allowing you to publish.
Yes references are safer than pointers, I use references if possible. However, there are many cases were pointers are required. I am not going to through the list of how many things you cant do without pointers, but it is long. About the trojan thing, that is a very easy fix. DISALLOW including anything but standard libraries and remove file access. This would prevent any kind of virus from being made. Sc2 was written in c++ and therefore, they could make a userCode class and hide all sc2 core data from the user.( several ways of doing it ) There would be no way to exploit the user, other than possibly crashing the game. DLL injects, windows libraries, COM, writing to memory addresses, and everything particularity dangerous would be hidden and unusable.
Thanks for the reply. Guess I will just typedef fixed as float. I have used pointers for years and have never had any real issues. Pointers are only bad in the hands of bad programmers( in the case they shouldn't be programming in the first place ) I would be perfectly fine with pointers and am disappointed they aren't supported.
"They only do bad things if written badly. Which is easy to do but shouldn't we bear that responsibility?" Agreed.
"If they wanted to ensure that we didn't accidentally mess with any of the core SC2 data/code then couldn't they just check the location every time a pointer is dereferenced to make sure it is within the memory section allocated to our own code and data? Better a child safe dumned down pointer than no pointer at all."
No that would give very poor performance, what they could do is set compile time restrictions on pointers, like prevent accessing pointers or taking address of sc2 core data.
Thanks for the reply.
What does a lack of float/double have to do with the inability to do maths?
Well it feels like a waste of space to typedef an int[2] to use it as a float/double. It also takes more cpu to do the math this way. If I recall the editor had floats, are they just an int[2]? Also what is the fixed type?
How are strings defined? In C it is just an array of characters: char buffer[255]; How are strings done here? Are the strings NULL terminated?
Thanks for the reply. I still have a few questions though.
Can I still do pointer arithmetic with arrays?((an array is practically a pointer) get a new array starting at an index without copying)
EX: int* i = new int[50];
*(i+2)
or
&i[2]
Wow...
Getting pointer to array at element possible?
No dynamic memory allocation? Run out of memory?
How are you supposed to do any sort of math?(float,double)
Are enums, ctors, dtors supported?
Does the this pointer exist?
Is there some kind of documentation on all the different functions/methods there are in galaxy? Some documentation on syntax and comparisons to other programming languages would be nice.