Jump to content


Photo

Game Maker Suggestions


  • This topic is locked This topic is locked
1176 replies to this topic

#1021 Big J

Big J

    GMC Member

  • GMC Member
  • 2852 posts
  • Version:GM8.1

Posted 27 February 2012 - 01:31 AM

So the -> thing de-references things? No... for Game Maker, it should just be the dot. We don't want to de-reference anything, therefore we don't want ->. For example:
inst = instance_create(x, y, object);
dist = inst.point_distance(x, y, 32, 32);
We don't want to derefrence the variable that has the instance ID, therefore it would seem to me the dot is more appropriate. Instance.method() is pretty much a "normal reference". So yeah, there's no reason to complicate things with a dot vs ->. This is Game Maker, just keep it simple.
  • 0

#1022 iam1me

iam1me

    GMC Member

  • GMC Member
  • 380 posts
  • Version:GM8

Posted 27 February 2012 - 01:49 AM

So the -> thing de-references things? No... for Game Maker, it should just be the dot. We don't want to de-reference anything, therefore we don't want ->. For example:

inst = instance_create(x, y, object);
dist = inst.point_distance(x, y, 32, 32);
We don't want to derefrence the variable that has the instance ID, therefore it would seem to me the dot is more appropriate. Instance.method() is pretty much a "normal reference". So yeah, there's no reason to complicate things with a dot vs ->. This is Game Maker, just keep it simple.


Actually - you ARE dereferencing inst. What value does inst contain? It contains a # which represents the new instances position in memory. It is thus functioning as a pointer. A further testament to this is the fact that you can change the value contained in inst and thus point to different instances in memory.
  • 0

#1023 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 1921 posts
  • Version:GM:Studio

Posted 27 February 2012 - 02:58 AM


So the -> thing de-references things? No... for Game Maker, it should just be the dot. We don't want to de-reference anything, therefore we don't want ->. For example:

inst = instance_create(x, y, object);
dist = inst.point_distance(x, y, 32, 32);
We don't want to derefrence the variable that has the instance ID, therefore it would seem to me the dot is more appropriate. Instance.method() is pretty much a "normal reference". So yeah, there's no reason to complicate things with a dot vs ->. This is Game Maker, just keep it simple.


Actually - you ARE dereferencing inst. What value does inst contain? It contains a # which represents the new instances position in memory. It is thus functioning as a pointer. A further testament to this is the fact that you can change the value contained in inst and thus point to different instances in memory.


I see where you try to compare an object id to a C pointer, but that is the breaking point. If you change the number, and then try to use it as an object, unless by luck it happens to be the id of another object instance, you are breaking things, because GM won't be able to find said object in its array.

On the other hand, trying to de-reference a "bad" pointer in C also leads to crashes, so in this they are similar, but different, see what I mean. The "bad" pointer does indeed point to a memory location, even if said memory is not belonging to the program in question, whereas the "bad" GM instance ID does not point to anything, rather it is like a simple bad index to an array/data structure.

And lastly, some people could argue that a computer's RAM is of sorts a massive array of spaces for values to be stored, therefore making instance IDs and C pointers that much more similar, but regardless of all of this, I'd still say for GM, just use a dot.
  • 1

#1024 iam1me

iam1me

    GMC Member

  • GMC Member
  • 380 posts
  • Version:GM8

Posted 27 February 2012 - 05:11 AM

I see where you try to compare an object id to a C pointer, but that is the breaking point. If you change the number, and then try to use it as an object, unless by luck it happens to be the id of another object instance, you are breaking things, because GM won't be able to find said object in its array.


It would break in C/C++ as well - changing a pointers location to some random place in memory is a dangerous practice. These are known as wild pointers, and are a side affect of BAD programming. While the C/C++ program might not crash, you can expect strange results, memory leaks, and even damage to files (though I believe the OS will limit the range of damage a wild pointer can inflict). That GM automatically crashes when you try to use a wild pointer is simply a handy run-time error checking feature.

On the other hand, trying to de-reference a "bad" pointer in C also leads to crashes, so in this they are similar, but different, see what I mean. The "bad" pointer does indeed point to a memory location, even if said memory is not belonging to the program in question, whereas the "bad" GM instance ID does not point to anything, rather it is like a simple bad index to an array/data structure.


An array IS a pointer, when you get down to it. Hence in C/C++ you can take any pointer and use it as if it were an array. Likewise, you can take any array and use it like a pointer.

And lastly, some people could argue that a computer's RAM is of sorts a massive array of spaces for values to be stored, therefore making instance IDs and C pointers that much more similar, but regardless of all of this, I'd still say for GM, just use a dot.


Again, an array is simply a pointer.
  • 0

#1025 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 1921 posts
  • Version:GM:Studio

Posted 27 February 2012 - 04:48 PM

Yes, an array is a pointer in C/C++, but any given index of the array is similar to an iterator, and is not a pointer. So GM's object IDs, since they are more like indices to the array(I believe they are actually more like the keys to a map/dictionary data structure), and so aren't all that similar to pointers in that sense. Though in C/C++, the array itself is a pointer, which points to the first index in said array.

And yes, you quoted the first part I said, and then quoted the second part that I said, but you were trying to "correct" me about wild pointers, when the second part of what I said stated exactly that. Lovely....
  • 1

#1026 Dark Matter

Dark Matter

    RPG Expert

  • GMC Member
  • 3196 posts
  • Version:GM:Studio

Posted 27 February 2012 - 05:34 PM

Is there really any point in arguing about this? The dot syntax wouldn't work for GM because it's not OOP. If you made it OO, they'd be a whole lot more you'd have to change than just that...
  • 0

#1027 Big J

Big J

    GMC Member

  • GMC Member
  • 2852 posts
  • Version:GM8.1

Posted 27 February 2012 - 05:41 PM

It would work just fine because YoYo would program to work. There's no point in claiming that it "won't work" when it could be made to work. How preposterous.
  • 0

#1028 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 1921 posts
  • Version:GM:Studio

Posted 27 February 2012 - 06:27 PM

Yes it could work. We already have the "with" construct, which is essentially what the dot would do. Now, you are right that GM isn't really OOP, but that doesn't prohibit them from using the dot if they want to.
  • 0

#1029 iam1me

iam1me

    GMC Member

  • GMC Member
  • 380 posts
  • Version:GM8

Posted 27 February 2012 - 09:43 PM

Yes, an array is a pointer in C/C++, but any given index of the array is similar to an iterator, and is not a pointer. So GM's object IDs, since they are more like indices to the array(I believe they are actually more like the keys to a map/dictionary data structure), and so aren't all that similar to pointers in that sense. Though in C/C++, the array itself is a pointer, which points to the first index in said array.

And yes, you quoted the first part I said, and then quoted the second part that I said, but you were trying to "correct" me about wild pointers, when the second part of what I said stated exactly that. Lovely....


An index is merely an offset into memory. By incrementing the index, you can indeed iterate through an array - but each index is itself essentially a pointer. The same doesn't hold true for other data structures where they explicitly require you to use a special iterator instance. They are thus exactly like pointers, because they are pointers.

As for responding to different parts of your message - I should have probably responded to it all together vs responding to each part, but I had already written my response to the first part before reading the second, and figured it would be a waste to delete it :P
  • 0

#1030 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 1921 posts
  • Version:GM:Studio

Posted 27 February 2012 - 10:02 PM

An index is an integer, for example 0, 1, 2, so how is that a pointer. You can't use it by itself as such, whereas the array name itself you can use on its own for various things. The object ids that GM creates/uses are similar to both indices and pointers, for example with the "with" construct you can operate script directly on said object instance, and using the current '.' operator you can modify variables of said instance. And considering GM stores all the object instances in a massive array/data structure, the object IDs also have similarity to indices.

Regardless of all of this, you can't say that indices are the same as pointers in C/C++.

And lastly, I still say the '.' operator would be a nice alternative to the 'with' construct in GM, instead of '->' but that isn't even based on whether the things are more similar to pointers or variables or whatever you want, rather it is quite simpe(which GM is supposed to be) and that it flows with how the dot can already be used to change variables on specific object instances.
  • 0

#1031 fawful

fawful

    dear leader

  • GMC Member
  • 1321 posts
  • Version:GM8

Posted 27 February 2012 - 10:12 PM

I think gamemaker as a program would greatly benefit from increased developmental capabilities without basic errors causing difficulties in the simplist of tasks.

The best way to work around this as a developer is to build his or her own development engine over a core programming language such as C++, a personal 'gamemaker' if you will. Unfortunately, many of users of GameMaker are too incompetent to carry this out, and I think it's an issue that is vastly ignored.

The solution?

It's very simple, all that needs to be done is to add a single function to Gamemaker to assist in the development of another game making system.

generate_program_gamemaker(3d,GTF,col,GM)

Using procedural generation and voxels this would have gamemaker generate a specially designed version of gamemaker except it would be personalized using four variables.

-3d would determin exactly how 3d this version of gamemaker is.

-GTF stands for "glitch to function" ratio, which is used to set how annoyed you will be by it.

-col is the colour it would be. e.g c_red.

-GM decides if this version of Gamemaker can use the function 'generate_program_gamemaker(3d,GTF,col,GM)' in case an additional version of Gamemaker is needed.
  • 0

#1032 iam1me

iam1me

    GMC Member

  • GMC Member
  • 380 posts
  • Version:GM8

Posted 27 February 2012 - 11:42 PM

An index is an integer, for example 0, 1, 2, so how is that a pointer.


That's all a pointer is - an integer.

You can't use it by itself as such, whereas the array name itself you can use on its own for various things. The object ids that GM creates/uses are similar to both indices and pointers, for example with the "with" construct you can operate script directly on said object instance, and using the current '.' operator you can modify variables of said instance. And considering GM stores all the object instances in a massive array/data structure, the object IDs also have similarity to indices.


Again, array = pointer.

Regardless of all of this, you can't say that indices are the same as pointers in C/C++.


Yes you can - all they are is integers that are offsets into memory.

And lastly, I still say the '.' operator would be a nice alternative to the 'with' construct in GM, instead of '->' but that isn't even based on whether the things are more similar to pointers or variables or whatever you want, rather it is quite simpe(which GM is supposed to be) and that it flows with how the dot can already be used to change variables on specific object instances.


Both are simple - but "->" is more accurate and would be handy for real programmers, especially those working on dlls and thus switching between C/C++ and GML, such that they wouldn't have to keep switching syntax.

Edited by iam1me, 27 February 2012 - 11:42 PM.

  • 0

#1033 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 1921 posts
  • Version:GM:Studio

Posted 28 February 2012 - 01:39 AM

Yes, under the hood, an index could be casted to a pointer, but then it would be completely wild, and useless. Whereas the actual name of the array is a valid pointer. I'm not disagreeing with that part. But remember, the way an index is used is not as a pointer, rather as an offset from a valid pointer(the array), therefore, the index itself is not a pointer, though you could attempt to cast it to a pointer, and get something invalid. You could also add an integer to a pointer a likely get a valid pointer, assuming you have allocated that amount of memory to the array, or it would then be another wild pointer. But the integer index itself, though "technically" castable to a pointer, is not a valid pointer, unless used in the context of the offset of an array.

By your logic, the integer '1' when put into a variable is instantly a pointer, just because it would technically point to the second unit into the array of RAM? Technically, yes, but that doesn't make it useful, hence why I'm saying that an index(integer) is not the same as an actual usable pointer, like the array name is.

And about -> vs. '.', we can agree to disagree here. Each side has valid points, and is will be up to Yoyo if they want to even implement such a thing, and if so to decide which one.
  • 0

#1034 Big J

Big J

    GMC Member

  • GMC Member
  • 2852 posts
  • Version:GM8.1

Posted 28 February 2012 - 01:47 AM

up to Yoyo if they want to even implement such a thing, and if so to decide which one.

I suppose they could implement both. Problem solved.

You all must think you're really cool talking endlessly about pointers. This isn't about pointers/integers, just language syntax.
  • 0

#1035 iam1me

iam1me

    GMC Member

  • GMC Member
  • 380 posts
  • Version:GM8

Posted 28 February 2012 - 02:05 AM

Yes, under the hood, an index could be casted to a pointer, but then it would be completely wild, and useless. Whereas the actual name of the array is a valid pointer. I'm not disagreeing with that part. But remember, the way an index is used is not as a pointer, rather as an offset from a valid pointer(the array), therefore, the index itself is not a pointer, though you could attempt to cast it to a pointer, and get something invalid. You could also add an integer to a pointer a likely get a valid pointer, assuming you have allocated that amount of memory to the array, or it would then be another wild pointer. But the integer index itself, though "technically" castable to a pointer, is not a valid pointer, unless used in the context of the offset of an array.


An index is an offset from the start pointer, and thus points to a very specific place in memory - it is a pointer, but a relative vs absolute pointer.

By your logic, the integer '1' when put into a variable is instantly a pointer, just because it would technically point to the second unit into the array of RAM? Technically, yes, but that doesn't make it useful, hence why I'm saying that an index(integer) is not the same as an actual usable pointer, like the array name is.


No - any integer value would not be a pointer, it explicitly must be used to point to a specific location in memory to be a pointer, which is what an index does.

And about -> vs. '.', we can agree to disagree here. Each side has valid points, and is will be up to Yoyo if they want to even implement such a thing, and if so to decide which one.


;)
  • 0

#1036 iam1me

iam1me

    GMC Member

  • GMC Member
  • 380 posts
  • Version:GM8

Posted 28 February 2012 - 02:07 AM

You all must think you're really cool talking endlessly about pointers.


No, just not ignorant.

This isn't about pointers/integers, just language syntax.


Its about both: its about the syntax for pointers.
  • 0

#1037 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 1921 posts
  • Version:GM:Studio

Posted 28 February 2012 - 03:22 AM

An index is an offset from the start pointer, and thus points to a very specific place in memory - it is a pointer, but a relative vs absolute pointer.

In that sense, you could call an index a pointer, but my point is that is doesn't work along as such, rather in relation a "real" pointer, like the array name.

***

And yes, Yoyo could use both of these pieces of syntax if they wanted to. At the moment, both single and double '=' are working as valid equality comparisons. I think you can still use some delphi constructs, but I seem to remember that this kind of thing was going to end up being removed by Yoyo. Maybe I'm wrong though.
  • 0

#1038 iam1me

iam1me

    GMC Member

  • GMC Member
  • 380 posts
  • Version:GM8

Posted 28 February 2012 - 03:59 AM

And yes, Yoyo could use both of these pieces of syntax if they wanted to. At the moment, both single and double '=' are working as valid equality comparisons. I think you can still use some delphi constructs, but I seem to remember that this kind of thing was going to end up being removed by Yoyo. Maybe I'm wrong though.


Hopefully they fix it and make people use "==" for comparisons only. It's horrible programming practice to use a single "="
  • 0

#1039 Desert Dog

Desert Dog

    GMC Member

  • GMC Elder
  • 6409 posts
  • Version:Unknown

Posted 28 February 2012 - 04:09 AM

Hopefully they fix it and make people use "==" for comparisons only. It's horrible programming practice to use a single "="


Hardly horrible programming practice. Lazy at worst.
  • 0

#1040 Dark Matter

Dark Matter

    RPG Expert

  • GMC Member
  • 3196 posts
  • Version:GM:Studio

Posted 28 February 2012 - 07:12 AM


Hopefully they fix it and make people use "==" for comparisons only. It's horrible programming practice to use a single "="

Hardly horrible programming practice. Lazy at worst.

Yeah. GML's made to be easy to use, so people don't have to bother with == vs =, or use semi-colons, or whatnot. It makes things easier for new coders. If you want a stricter syntax, use a different language.
  • 0

#1041 Big J

Big J

    GMC Member

  • GMC Member
  • 2852 posts
  • Version:GM8.1

Posted 28 February 2012 - 08:24 AM


Hopefully they fix it and make people use "==" for comparisons only. It's horrible programming practice to use a single "="


Hardly horrible programming practice. Lazy at worst.

Perhaps one could call it "Visual Basic Style". :lol:
  • 0

#1042 Drandula

Drandula

    Mister Pixel

  • GMC Member
  • 269 posts
  • Version:GM8

Posted 28 February 2012 - 01:18 PM

Time which you have spent making the game.

I would like to have some counter in Game Maker, which counts how many hours you have been making specific game. Also some this kind of information would be nice to be able to check :)

Tero Hannula
  • 1

#1043 connor4312

connor4312

    www.connorpeet.com

  • GMC Member
  • 896 posts
  • Version:None

Posted 28 February 2012 - 05:52 PM

1. Array functions. Been using PHP for a bit, and am sorely missing its lovely array functions in GM, especially foreach() http://php.net/manual/en/ref.array.php
2. Named arguments in functions. Instead of:
show_message(argument0+argument2+argument1);
have
show_message(question+divider+answer);
3. Ternary operators. Instead of:
str="Hello ";
if (world)
  str+="World";
else
  str+="City";
str+="!";
Just have:
str="Hello "+(world ? "World" : "City")+"!";
It makes writing and maintaining code a lot easier. Obviously, these are only simplistic examples and not a real-world scenario.
  • 0

#1044 Big J

Big J

    GMC Member

  • GMC Member
  • 2852 posts
  • Version:GM8.1

Posted 28 February 2012 - 09:07 PM

2. Named arguments in functions. Instead of:

show_message(argument0+argument2+argument1);
have
show_message(question+divider+answer);

Like this?
var question, divider, answer;
question = argument0;
divider = argument2;
answer = argument1;
show_message(question + divider + answer);

Edited by Big J, 28 February 2012 - 09:09 PM.

  • 0

#1045 Dark Matter

Dark Matter

    RPG Expert

  • GMC Member
  • 3196 posts
  • Version:GM:Studio

Posted 28 February 2012 - 10:23 PM

Like this?

var question, divider, answer;
question = argument0;
divider = argument2;
answer = argument1;
show_message(question + divider + answer);

It's not hard to do, we all realise that. We're looking for things to make programming easier/simpler though, and that's just an annoyance.
  • 0

#1046 IceMetalPunk

IceMetalPunk

    InfiniteIMPerfection

  • GMC Elder
  • 9328 posts
  • Version:Unknown

Posted 29 February 2012 - 04:37 AM

1. Array functions. Been using PHP for a bit, and am sorely missing its lovely array functions in GM, especially foreach() http://php.net/manual/en/ref.array.php

While native support for that would be nice, it's easy to do something similar with ds_lists (and can be modified to work with arrays, though I prefer ds_lists or ds_linklists anyway :P ):

foreach(list, script_id):
var p;
for (p = 0; p < ds_list_size(argument0); p += 1) {
  script_execute(argument1, p, ds_list_find_value(argument0, p));
}

Then your script would just take the index and the value as its arguments. Similar methods can be used for maps if you want the associativity.

I do agree that native syntactic support would be nice, though.

-IMP
  • 0

#1047 Big J

Big J

    GMC Member

  • GMC Member
  • 2852 posts
  • Version:GM8.1

Posted 29 February 2012 - 05:06 AM

I'd like to be able to turn this:
var question, divider, answer;
question = argument0;
divider = argument1;
answer = argument2;
Into this:
var question = argument0, divider = argument1, answer = argument2;
I'm sorry if this was already mentioned, assignment within declaration.
Same for globalvar of course:
globalvar Health = 0;

Edited by Big J, 29 February 2012 - 05:07 AM.

  • 0

#1048 Dark Matter

Dark Matter

    RPG Expert

  • GMC Member
  • 3196 posts
  • Version:GM:Studio

Posted 29 February 2012 - 07:03 AM

I'm sorry if this was already mentioned, assignment within declaration.[/code]

Yep, loads of times. It's quite an obvious one, so lots of people bring it up.
  • 0

#1049 Shadowrend

Shadowrend

    Master of Shadows

  • GMC Member
  • 3023 posts
  • Version:GM8

Posted 03 March 2012 - 05:24 PM

Time which you have spent making the game.

I would like to have some counter in Game Maker, which counts how many hours you have been making specific game. Also some this kind of information would be nice to be able to check :)

Tero Hannula


Code lines also :D
  • 1

#1050 kikjezrous

kikjezrous

    Seer of Spaaace

  • GMC Member
  • 637 posts
  • Version:GM8.1

Posted 03 March 2012 - 05:42 PM

Oh, yeah!
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users