Game Maker Suggestions
#921
Posted 30 August 2011 - 08:52 PM
#922
Posted 30 August 2011 - 09:49 PM
Sorry if I misunderstood you, but if I did that's not the way to handle it.
#923
Posted 31 August 2011 - 12:44 AM
#924
Posted 31 August 2011 - 04:25 AM
#925
Posted 31 August 2011 - 10:50 AM
-4 what? With statements that may include noone, you're either using one of these constants, or an instance id. Instance ids are always positive. Therefore, using -4 will always be incorrect.But numbers are completely valid. You may mean -4 SOMETHING. So are you just not going to be able to type -4 there because it will say "no can do, you might mean that to be noone"?
Sorry if I misunderstood you, but if I did that's not the way to handle it.
#926
Posted 31 August 2011 - 12:06 PM
#927
Posted 31 August 2011 - 01:00 PM
Yes you can. If GM is running through each statement the moment before it executes them, it can also check whether you use noone or -4.And what if you put noone in a variable sometime before, possibly as an argument to a script? Do you want GM to do flow analysis to sometimes guess whether you're using -4 or noone? This comes back to the halting problem again- you cannot know in the general case which one someone used unless you store the information at runtime, by doing exactly what I've said twice now: adding a new "instance" type to GML.
#928
Posted 31 August 2011 - 01:55 PM
var inst;
if (random(10) < 5)
inst = noone
else
inst = -4
call_some_function(inst)You cannot tell, without storing at runtime (preferably in inst's type), whether inst is noone or -4.This is a proven fact about computing. There is no way around it, no matter how clever you think GM can be. You can't make noone identical to -4 and still have GM enforce its usage.
Edited by Rusky, 31 August 2011 - 01:56 PM.
#929
Posted 31 August 2011 - 05:36 PM
For example, if I wanted to change the score every time I showed a message (useless, I know, but just as an example), I would be able to create a script called "show_message", yet still be able to use the function show_message. Something like this:
//script show_message
score += 10;
function_execute("show_message",argument0);or something like that.
#930
Posted 31 August 2011 - 09:31 PM
Actually, in the case of GM, it can. GM variables are set up with a "type" constraint, and at the moment it is either string or real. If you added the other types such as data structures and pointer references, then "noone" would be a pointer reference that specifically contains "-4" to denote it. This would mean you would no longer be able to use "inst = -4" to mean "noone" because "-4" will store a 'real' type and not a 'reference' type.You cannot tell, without storing at runtime (preferably in inst's type), whether inst is noone or -4.
This means that '-4' would be stored in the "value" of the variable in both instances, and at the same time mean 2 different things. It would force the programmer to stop using direct values when referencing instances like:
(10010).x = 5; (10010).y = 10;
To me, that's stupid and should not be allowed. Mike has also agreed on this point and has made it clear that he _wishes_ that he could just use references for those types of variables, but it seems he'd rather complain about so-called "broken delphi" than to actually do anything about it. Obviously it's as simple as adding different types to the enum/defines and adding overload functions for it, then doing some basic checks....done....but I guess that would be too easy. Instead let's make a bunch of html5 demos for various devices to run smoothly, that's progress!! (seems more like painting a dog turd to cover up the smell, but whatever)
#931
Posted 31 August 2011 - 09:34 PM
I sort of agree, as I've had that desire before, but really, it doesn't make logical sense. That'd be like putting this in any other language:I'd like a better way to override functions in GameMaker.
For example, if I wanted to change the score every time I showed a message (useless, I know, but just as an example), I would be able to create a script called "show_message", yet still be able to use the function show_message. Something like this://script show_message score += 10; function_execute("show_message",argument0);or something like that.
function DoSomething() {
some_code_here();
}
function DoSomething() {
some_other_code();
call_previous_DoSomething();
}It's redefining a previous function while still keeping the previous function around, and I don't know of any language that allows that.
Of course, if you argue that GM doesn't have to match other languages, perhaps it could have a function like call_default("function_name", argument0, argument1,...). But what happens if someone then tries to override call_default() with a custom script?
-IMP
#933
Posted 31 August 2011 - 10:28 PM
Which is exactly what I said- "storing at runtime (preferably in inst's type), whether inst is noone or -4"Actually, in the case of GM, it can. GM variables are set up with a "type" constraint, and at the moment it is either string or real. If you added the other types such as data structures and pointer references, then "noone" would be a pointer reference that specifically contains "-4" to denote it. This would mean you would no longer be able to use "inst = -4" to mean "noone" because "-4" will store a 'real' type and not a 'reference' type.You cannot tell, without storing at runtime (preferably in inst's type), whether inst is noone or -4.
#934
Posted 01 September 2011 - 05:18 AM
#935
Posted 01 September 2011 - 07:01 AM
I don't know if this was said in the past 47 pages but I would love GM to handle collisions better. Right now it moves by jumping around at the speed you give it when it works better to move 1px at a time until it collides with something. I know there are ways to do that manually like I found in some examples but since GM is designed to be really easy for new people to use shouldn't it handle that kind of basic collision itself?
if(collision_line(x, y, x + hspeed, y + vspeed, solids, true, true))
1. The above function or similar does basically what you want, and is more versatile
2. pixel-by-pixel collision detection is exhausting on the cpu....why waste the cycles?
3. if you really want to detect at that rate, simply increase the room speed and decrease your speed values (if you are moving at speed 3 in a 30 fps, then do speed 1 at 90 fps)....meaning, the game CAN do pixel-by-pixel if you want it to.
#936
Posted 01 September 2011 - 07:21 AM
Yeah, other languages don't have it (that I'm aware of), but in other languages, you're not limited like GM is. For example, you can use draw_set_circle_precision() but not get it after that. It'd be useful to be able to override it so you could store the argument each time it was called. Your point about overriding the call_default() is a good one, but it should be easy enough to not allow that to be overridden, or make it a sort of command/keyword instead of a function.I sort of agree, as I've had that desire before, but really, it doesn't make logical sense. That'd be like putting this in any other language:
I'd like a better way to override functions in GameMaker.
For example, if I wanted to change the score every time I showed a message (useless, I know, but just as an example), I would be able to create a script called "show_message", yet still be able to use the function show_message. Something like this://script show_message score += 10; function_execute("show_message",argument0);or something like that.function DoSomething() { some_code_here(); } function DoSomething() { some_other_code(); call_previous_DoSomething(); }
It's redefining a previous function while still keeping the previous function around, and I don't know of any language that allows that.
Of course, if you argue that GM doesn't have to match other languages, perhaps it could have a function like call_default("function_name", argument0, argument1,...). But what happens if someone then tries to override call_default() with a custom script?
-IMP
#937
Posted 01 September 2011 - 09:35 PM
It's redefining a previous function while still keeping the previous function around, and I don't know of any language that allows that.
int operator+(int left, int right)
{
teehee
}Although this isn't really redefining a *function* since addition is not a conventional parenthetical function, but it is an overriding feature of most professional languages (and we all know how professional GM is right?).
However, I think the point is not overriding, but rather referencing built-in functions as you can scripts. This is done in other languages similar to this:
int add1(int a, int b); int add2(int a, int b); int (*afunction)(int,int) = &add1; //afunction is now pointing to add1 afunction = &add2; //afunction is now pointing to add2
I haven't coded function references in a long time, so it might be a little wrong, but you get the point hopefully. At the moment, you can only reference scripts and not built-in functions...but here's an example of its use:
if(gm_is_registered) mdsl_create = ds_list_create; else mdsl_create = uds_list_create;
(Some may be familiar with unregistered data structures made by creativebunch) Other areas of interest is d3d ability "plugins" where if you don't have the plugin installed, it could divert back to the built-in d3d functions of GM. At the moment, you have to write a script that calls the function and only THEN can you reference the built-in.....this method slows down processing.
#938
Posted 01 September 2011 - 11:52 PM
Right. But now try doing something like this, which is akin to the request mentioned here:It's redefining a previous function while still keeping the previous function around, and I don't know of any language that allows that.
int operator+(int left, int right) { teehee }
Although this isn't really redefining a *function* since addition is not a conventional parenthetical function, but it is an overriding feature of most professional languages (and we all know how professional GM is right?).
int operator+(int left, int right) {
return left+right;
}Recursion happens. There's no way to overload the operator and still somehow call the original definition of that operator, which is kind of what the suggestion here is: overload a function with a script, but still somehow call the original function anyway.
-IMP
#939
Posted 02 September 2011 - 01:16 AM
Yeah but all collision handling should be done per pixel not only if you have a really high room speed and move slow. Maybe it doesn't have to be really per pixel but at least it could use the collision_line thing just so it handles collisions better than the way it does now.I don't know if this was said in the past 47 pages but I would love GM to handle collisions better. Right now it moves by jumping around at the speed you give it when it works better to move 1px at a time until it collides with something. I know there are ways to do that manually like I found in some examples but since GM is designed to be really easy for new people to use shouldn't it handle that kind of basic collision itself?
if(collision_line(x, y, x + hspeed, y + vspeed, solids, true, true))
1. The above function or similar does basically what you want, and is more versatile
2. pixel-by-pixel collision detection is exhausting on the cpu....why waste the cycles?
3. if you really want to detect at that rate, simply increase the room speed and decrease your speed values (if you are moving at speed 3 in a 30 fps, then do speed 1 at 90 fps)....meaning, the game CAN do pixel-by-pixel if you want it to.
#940
Posted 02 September 2011 - 01:18 AM
Recursion happens. There's no way to overload the operator and still somehow call the original definition of that operator,
*sighs*
int operator+(int left, int right) {
return super(left,right);
}
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users



This topic is locked





