• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Andromeda - Galaxy Extension

Status
Not open for further replies.
Level 40
Joined
Dec 14, 2005
Messages
10,532
Yes I do know what a typecast is.
Based on question 1, you don't seem to.

1. Why is (int)"42" bad?
It makes no sense. We cast in two general ways (I am making the names up):

  • Pointer cast: Leave the bits intact, change what we are referring to.
  • Number cast: Change the size or type of the number stored (for example, (float)someInt or (byte)someInt).

Edit: Here is a wiki article on the subject.

(int)"42" fits into neither definition. On the left side we have a number (int) and on the right we have either an object pointer (string *) or char array (char *). It looks like (int)"42" should be 42, but what does (int)s mean? It doesn't make any sense, unless you want the memory address of s (which you probably don't). (int *)s would make sense, but it would not mean what you think it would mean. For example,

Code:
char *s = "42";
int *i = (int *)s; //*i is 52 or undefined or 3407922 or whatever depending on the language's handling of chars

There's a good reason that I (and probably you) can't name a real language which allows you to do (int)"42". There might be some obscure one out there, but none that I've ever heard of can do that.

Keep in mind that string foo either means someStringObj foo (in an OOP language) or char *foo (in a non-OOP language). String is not a primitive type.

2. What is the difference between (int)"42" and int("42")?
While some languages allow the two interchangeably, (int)"42" implies a typecast while int("42") implies a function call.

I think that what you mean is that all paradigms are good depending on the use you want to give to them and depending on the problem you are trying to solve.
Exactly.
 
Level 8
Joined
Jun 28, 2008
Messages
356
Yes, ofcourse in C++ writing (int)"42" would be complete bullshit. I agree with that. But I don't see what's so bad about it being implemented in Andromeda?! After all it will probably just be pre-parsed to the string to integer conversion function... no?

On the second question, in C++ (type)value and type(value) would have the absolutely same effect. It's basically calling the constructor of the class, if we are not talking about primitives. int(3.1415) and (int)3.1415 would give us the same thing.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
It has nothing to do with C/++ (that code was C, not C++, by the way)—I was simply using it since it's a syntax most people recognize.

It's not wrong because it would make no sense in C/++. It's wrong because it makes no sense with relation to how strings are stored in memory.

--

Your second note only indicates that C/++'s syntax is inconsistent and that foo(bar) means different things depending on what foo is, which is probably not something to aspire to.
 
Level 8
Joined
Jun 28, 2008
Messages
356
Then would implementing it as int("42") make more sense? That's how it was done in Python, for example, if I remember right.

2. Yes, but in all cases it still means conversion. Whether it's the typecasting way you mention, or simply calling a constructor of another class which would do it's things.
 
Level 8
Joined
Jun 28, 2008
Messages
356
Galaxy is completely different to C. Both "int" and "string" are objects (not object pointers, at least at the level we see in the code), therefore casting between them is not changing a pointer to a value, merely changing the type of object.

1

If int is an overloaded function then yes, it would make sense, although toInt(s) may be a better name.

Yes, but then if you think about it in the end, the whole point of the implementation becomes pointless, since it just saves us about 4-5 characters for our function name...
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
How it appears on the front end is unimportant since casts have to do with how they are stored in memory (the only one that does not do a direct conversion is (int)float/(float)int, but those casts are necessary for arithmetic to make sense).

In C++ you use "string" objects, in java you use "String" objects, etc, but you still don't do (int)s because it makes no sense.
 
Level 9
Joined
Nov 28, 2008
Messages
704
I honestly dont get why the function is good, while (int) is bad.

Having programmed in C, yeah, it looks weird, but it isnt a type cast. It's a type conversion. Why not just rename it to that?
 
Level 2
Joined
May 14, 2010
Messages
22
I have two simple questions.
I know OOP from C++, but I've never heard the word "enrichment" when reading or hearing about OOP, what do you mean by it?
And you also mention generic, does this mean templates? Templates is a difficult subject to implement. I'm skeptic about this project, but I hope it'll work out :)
Also, I've never used Java or studied any of it, but I've heard it lacks speed. If this is true, then don't you think it's a problem?
 
Last edited:
Level 10
Joined
Nov 28, 2008
Messages
655
I have two simple questions.
I know OOP from C++, but I've never heard the word "enrichment" when reading or hearing about OOP, what do you mean by it?
And you also mention generic, does this mean templates? Templates is a difficult subject to implement. I'm skeptic about this project, but I hope it'll work out :)
Also, I've never used Java or studied any of it, but I've heard it lacks speed. If this is true, then don't you think it's a problem?

Java lacks speed in comparision to C, yes, but that speed is generally not the limiting factor.

In a situation like this^ the objects and stuff that would normally slow it down are compiled out, as this just goes down to galaxy code in the end.

OO is easier to "write" in, but they are not rewriting galaxy, so that means it is just a convenient way of organizing it and writing it.

The end result will still be Galaxy, just optimized to do what you want it to do via how these guys write it.
 
Level 10
Joined
Nov 28, 2008
Messages
655
I assume you mean program in. If so, no, it really isn't.

Ok, so OOP is not easier to program in.

BUT.

Every language that I have used that is OO, is easier because it has a lot of objects can do the work of multiple functions. So to me, it is less work, more often than in a strictly procedural language.

So no, it is not easier, but most applications of it tend to have "shortcuts" and objects that can be used to do tedious things for you.
 
Level 10
Joined
Nov 28, 2008
Messages
655
No, for you it's easier because that's all you have programmed in, as you admit.

You also don't seem to realize that there are other types of languages other than OO and procedural. Hell, those are both in the same category (imperative)!

I never said that I only program in OO...

I just like how java for example, I can have a class implement serializable, then with one method call, I can write the class to a binary file.

That is an example of how objects CAN make it easier.


I do like the idea of using them to make the code a little cleaner, but I still don't understand the need to write something like Andromeda before the full version is even out...
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Slightly misread your post.

Anyhow, why is that special? You could just as easily write a function in C which takes a (void *) and an int (the size of the struct/whatever) and write it to a file as well by directly copying from memory (although this doesn't work for char **s and stuff).

Sure, OO is great in some situations. Other paradigms are great in other situations. You are focusing on all the good aspects of one and none of the good aspects of the others.
 
Level 9
Joined
Nov 28, 2008
Messages
704
I still don't understand the need to write something like Andromeda before the full version is even out...

Because scripting at all is a pain now. A portable library that you can use while scripting is near impossible to implement. You can create GUI libraries which are plug and play - not so with scripting. You have to prefix everything, and naming conflicts are going to happen before long.

Personally, I just hate having to write a prefix like MfPr on every function. Andromeda removes that. I am happy! Also, enrichments/methods in structs are nice.
 
Level 10
Joined
Nov 28, 2008
Messages
655
Because scripting at all is a pain now. A portable library that you can use while scripting is near impossible to implement. You can create GUI libraries which are plug and play - not so with scripting. You have to prefix everything, and naming conflicts are going to happen before long.

Personally, I just hate having to write a prefix like MfPr on every function. Andromeda removes that. I am happy! Also, enrichments/methods in structs are nice.

But it is the BETA.

My point is not that it could be useful, my point is that waiting till the full version comes out might be a smart idea.

What we have might be similar to the final editor, but then again maybe some of these architectural "mistakes" that we are finding are just in this version, and the full one might have some significant changes.

That is all I am trying to say.
 
Level 9
Joined
Nov 28, 2008
Messages
704
But it is the BETA.

My point is not that it could be useful, my point is that waiting till the full version comes out might be a smart idea.

What we have might be similar to the final editor, but then again maybe some of these architectural "mistakes" that we are finding are just in this version, and the full one might have some significant changes.

That is all I am trying to say.

Q. Getting custom script into maps is currently complex. Are there plans to implement Galaxy scripting directly into the editor?

A. There are currently no plans for Galaxy script editing in the editor itself. However, through the Import Manager it should be pretty easy to add in your scripts as necessary. Are you having trouble doing it that way?

There are no ways to make non conflicting libraries with scripting besides putting a prefix on everything yourelf. Blizzard has no plans to add any way to make scripting less painful. Thus, phynGal and Andromeda are coming. Sooner is better than later. No reason to wait. Blizzard isn't going to do anything.
 
Level 4
Joined
Dec 14, 2004
Messages
85
I don't understand this debate, OOP is good in many circumstances, so having it helps us in those circumstances(Which aren't just a few textbook examples, As a maintenance programmer most bugs I fix can be attributed to not taking advantage of the paradigm(Ok duplicate code takes the 1st place spot but the other is 2nd(Plus many times duplicate code is best organized in OO)))

But my main point over all others would be, are we stopping you from using procedural programming? Are we stuffing OO down your throat?(Is it the other way around maybe???) or is he just an inviting you to try Andromeda out? Even if you were to use Andromeda would that stop you from procedural programming? Plus Andromeda has a fair amount of things that aren't meant for OO people anyway. So I would still use for any project. I don't see a reason for debating over apples and oranges when you can choose whichever you want either way
 
Level 10
Joined
Nov 28, 2008
Messages
655
I don't understand this debate, OOP is good in many circumstances, so having it helps us in those circumstances(Which aren't just a few textbook examples, As a maintenance programmer most bugs I fix can be attributed to not taking advantage of the paradigm(Ok duplicate code takes the 1st place spot but the other is 2nd(Plus many times duplicate code is best organized in OO)))

But my main point over all others would be, are we stopping you from using procedural programming? Are we stuffing OO down your throat?(Is it the other way around maybe???) or is he just an inviting you to try Andromeda out? Even if you were to use Andromeda would that stop you from procedural programming? Plus Andromeda has a fair amount of things that aren't meant for OO people anyway. So I would still use for any project. I don't see a reason for debating over apples and oranges when you can choose whichever you want either way

Poot is obsessed with arguing about it, :grin:
 
Level 8
Joined
Jun 28, 2008
Messages
356
Every way of programming has it's pros and cons. The best one depends on what you are doing imo. After all that's what it is being a programmer, "getting to the best solution in the least time". You just have to know which way to pick when you are doing your stuff.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Every way of programming has it's pros and cons. The best one depends on what you are doing imo. After all that's what it is being a programmer, "getting to the best solution in the least time". You just have to know which way to pick when you are doing your stuff.
Or, as these people seem to subscribe to, pitch reason out of the window and use OOP all the time.
 
What is this expansion? I never heard of it. Where can I find it?

@Zergleb: He is totally right. The cowboy knows.
Poot is obsessed with arguing about it,
And you are obsessed with making crappy criticism about it. You don't like OOP and you don't think Andromeda is useful. We get your point, now stop trying to proof something that is obviously wrong, stop trying to proof that Andromeda is useless.
 
Level 2
Joined
May 14, 2010
Messages
22
right. where did this debate come from? I just asked if the devs of the project really meant templates when they were talking about generic programming on the topic, and what they mean with "enrichment" :p
 
Level 9
Joined
Nov 28, 2008
Messages
704
right. where did this debate come from? I just asked if the devs of the project really meant templates when they were talking about generic programming on the topic, and what they mean with "enrichment" :p

http://www.sc2mod.com/board/index.php?page=Thread&threadID=13

All your answers are there.

As for phynGal:

http://phyngal.xgm.ru/

And finally, Moonlite! :D

http://www.thehelper.net/forums/showthread.php?t=146456

Soon as geX fixes Andromeda not working inside folders with spaces (Program Files (x86) comes to mind) Andromeda and phynGal get to work together and I will be happy. Moonlite will be icing on the cake.
 
Level 4
Joined
Jul 26, 2006
Messages
49
Guys OMG... I leave for a few days and have to read over 3 pages of OOP flamewar. Please can we stop that. Here are my final comments:

a) Andromeda allows OOP, it doesn't forces it like Java. So if you don't like OOP, just go on with functions, everything's fine here. For more discussion about OOP being good or bad or just one of many paradigms, use google and join one of the 100 billion discussion threads about that topic.

b) About the (int)"42" thingy. I get your point that such a cast doesn't smell like a whole function call with string parsing involved. But I don't think that this is sooo bad. Just like with OOP: If you don't like it, don't use it. Andromea will also have a "42".toInt() method in the string standard enrichment. And I agree that this might be even cleaner to use.

right. where did this debate come from? I just asked if the devs of the project really meant templates when they were talking about generic programming on the topic, and what they mean with "enrichment" :p

Generics: Yes, that will be like C++ templates, or lets rather say JAVA generics (which are less mighty and thus easier to implement than templates).
The basic idea I want this in the language is for container data types.
For type safety reasons, you want for example a list to be parameterizable with the type it may contain. So you would just write List<string> to create a list of strings for example.

Enrichments: The name was invented by me, since such a concept doesn't exist. For normal script languages, there is no need for such constructors. However, galaxy comes with a huge set of pseudo objects (all handle types: unit, unitgroup, ...). Since these and the corresponding native functions already look like objects, it would be nice to access them with OOP syntax. This is what enrichments are for.
 
Level 2
Joined
May 14, 2010
Messages
22
I did read that page Mooglefrooglian linked me, and I can I did not personally like the syntax, but that's just me. Everything looked really like you know what you are doing so hopefully people will enjoy the hard work :p

Also the "enrichments" idea seemed pretty clever, hope it all works out ;)
 
Level 9
Joined
Nov 28, 2008
Messages
704
phynGal doesn't need to be in the Support folder any more, so they can work together.

I can't find a way to get phynGal to give me the path to the actual map itself. It's just giving me the path to the script at this point.

Unofrtunately, Andromeda works with triggers defined as custom script hidden actions. These triggers' code is not placed into the map script, so yeah.

Edit: I just found out how the folder thing works. Makes a temp folder in same dir as map. Could just go up one dir (../map.SC2Map), hopefully by abusing lua string functions. Time to go learn about lua strings. :D

Edit2: How do you even run a .jar from lua? I fail completely. Need to learn lua and learn to use its win command line-ness.

Moar edits: Gonna wait on moar features for phynGal. os.execute works in lua.. except its not in the current directory, and there is no way currently available in the phynGal lua system to get the path, so yeah.
 
Last edited:
Level 8
Joined
Jun 28, 2008
Messages
356
This enrichnment thing is something I wanted to have so much in other programming languages. I always thought there were such things, just that I don't know how to do them... to add new members to existing objects and so.

However, maybe 'extensions' is a better name. I don't know. Enrichment sounds kinda strange o_O Or does it?
 
Level 2
Joined
May 14, 2010
Messages
22
Edit2: How do you even run a .jar from lua? I fail completely. Need to learn lua and learn to use its win command line-ness.

I havn't worked much with scripting myself, but I'm pretty sure Lua can't do that, and it's all coded by a programming language, which then might let Lua call a function to run a .jar :p
 
Level 4
Joined
Jul 26, 2006
Messages
49
I havn't worked much with scripting myself, but I'm pretty sure Lua can't do that, and it's all coded by a programming language, which then might let Lua call a function to run a .jar :p

You can just set up a normal command. So you can start the jar like you would start it from command line. Or create a .bat file that starts andromeda and call this one (this is how GMSI injected itself into JNGP).
 
Level 2
Joined
May 14, 2010
Messages
22
You can just set up a normal command. So you can start the jar like you would start it from command line. Or create a .bat file that starts andromeda and call this one (this is how GMSI injected itself into JNGP).

And Lua can start such a command on it's own? That kinda means Lua has the potential to do harm :S
 
What does that have to do with anything?
It is so safe that it practically doesn't need an anti-virus, thus not having problems like JNGP has.

There is no better way of doing this Water. JNGP also used memory injection methods to add new features and it also had the possibility of causing harm. However it doesn't cause harm because the people behind the project are trust worthy, like gekko and his team. You can build projects if you don't trust other people.
 
It is so safe that it practically doesn't need an anti-virus, thus not having problems like JNGP has.

There is no better way of doing this Water. JNGP also used memory injection methods to add new features and it also had the possibility of causing harm. However it doesn't cause harm because the people behind the project are trust worthy, like gekko and his team. You can build projects if you don't trust other people.

I never said there was a better way of doing it. I was just confused by what Akkernight was saying (probably because of the unclear English).
 
Level 2
Joined
May 14, 2010
Messages
22
meh, usually people tend to know what I'm saying.
Anyways, I found no link to download Andromeda? I checked the link here that leads to another SC2 modding site, but there was no download link there either :S
 
Level 9
Joined
Nov 28, 2008
Messages
704
The problem with passwords is that if anything asks you for one, you will automatically type one in. If you were running lua scripts, you would have entered a password without thinking most likely. The only thing passwords can protect are things you are unaware of happening automatically.

Also, Linux is incredibly easy to screw up if you do the wrong thing. I was working on getting my dual monitors to work properly (easy) and having the system save thhe changes (not so easy). I ended up modifying a config file, and it turns out it didnt parse it correctly and everything aslpoded.

That was fun. Happpy times for dual booting though.

Also, that other SC modding site has all of the Andromeda info on it, it shouldnt be hard to find at all if you just look.
 
Level 2
Joined
May 14, 2010
Messages
22
If you work as a administrator on Linux it's easier to screw it up than any other OS, but when you type in the password, or get prompted for a password, you accept that you know that what you are doing can harm your computer and should only be done if you know what you are doing :p
Also, still can't find that link
 
Status
Not open for further replies.
Top