Jump to content


Photo

Game Maker Suggestions


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

#21 sabriath

sabriath

    12013

  • GMC Member
  • 3147 posts

Posted 26 October 2010 - 10:33 PM

It's also a Delphi thing, they aren't reconstructing the string each time. Maybe when GM9 comes YYG will take control over your pointers like you'd like. I'm looking forward to the day when returning a pointer means I have to make myself a copy since GM needs it.

Wow, you really are lost aren't you? It is not only speed efficient, it is memory efficient. This is what GM does:

//str = external_call(ec); where ec is an external_define returning a 'char*'

char* (*ftn)(void) = external_defines->item[ec];
if(ftn == NULL)
  report("Error with the 'ec' not being a properly defined item");
char* ret = (*ftn)();
int retlen = strlen(ret);

string* rtn = new string();
rtn->expand(retlen);
memcpy(rtn->data, ret, retlen);

return rtn;                    //at which point 'ret' is lost

This is what I propose GM to do:

//str = external_call(ec);

char* (*ftn)(void) = external_defines->item[ec];
if(ftn == NULL)
  report("Error with the 'ec' not being a properly defined item");
char* ret = (*ftn)();
int retlen = strlen(ret);

string* rtn = new string();
rtn->size = retlen;
rtn->data = ret;

return rtn;      //which contains 'ret' so it is not lost

But then I proposed by-reference, which would be like this:

//str = external_call(ec);

string* arg0 = strings->item[argument0];
if(arg0 == NULL)
  report("Error with the 'argument0' not being a string");

double (*ftn)(string*) = external_defines->item[ec];
if(ftn == NULL)
  report("Error with the 'ec' not being a properly defined item");

return (*ftn)(arg0);

This would force DLL writers to need to know the "string" structure, which can easily be made and distributed with GM-Pro. Although this 'might' make it more strict, at least there would efficiency and proper communication between GM and links.

Although the above is pseudo-C and doesn't allow multiple arguments, it was only an example. I don't have time right now to show the assembly of what I really want to implement, which allows ANY argument types and return ANY argument type without limitation (including by-reference)...and yes, it can be done without bloating the runner.
  • 1

#22 paul23

paul23

    GMC Member

  • Global Moderators
  • 3355 posts
  • Version:GM8

Posted 26 October 2010 - 11:09 PM

The problem with passing-by-pointer is: "who is the owner? of the data?" - Gamemaker or your dll?

Really I think memory management should stay outside of the scope of the GML: while it might sound great I believe it will cause more troubles than it is worth.
  • 0

#23 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 26 October 2010 - 11:54 PM

This would force DLL writers to need to know the "string" structure, which can easily be made and distributed with GM-Pro. Although this 'might' make it more strict, at least there would efficiency and proper communication between GM and links.

I've already said it, GMAPI, it's already on the list, so quit whining.

Now, I just remembered this suggestion I forgot a while ago, code completion for scripts. I checked the list of current suggestions, but I don't know if better code completion would include this.
  • 0

#24 Rusky

Rusky

    GMC Member

  • New Member
  • 2450 posts

Posted 27 October 2010 - 01:13 AM

This would force DLL writers to need to know the "string" structure, which can easily be made and distributed with GM-Pro. Although this 'might' make it more strict, at least there would efficiency and proper communication between GM and links.

For the third time, sabriath:

Maybe if there were a better-defined interface between [GM and DLLs], which would be required for DLL access to game resources, things would be more clear.


@TheMagicNumber: Scripts would need a formal parameter list for that to work, which I believe is already supported in extensions. The list includes "argument number-checked scripts," but I could also add argument names for intellisense if that's what you're asking for. However, it might be better to include it in some kind of extension/editor unification section- does anyone have any other ideas for how that might be accomplished before I add it?
  • 0

#25 ADHDguitar

ADHDguitar

    GMC Member

  • New Member
  • 79 posts

Posted 27 October 2010 - 01:38 AM

I'd like to see a cube root function. I'd articulate further but this one's pretty obvious.
  • 0

#26 BBGaming

BBGaming

    Programmer

  • GMC Member
  • 2455 posts
  • Version:GM7

Posted 27 October 2010 - 01:48 AM

I'd like to see a cube root function. I'd articulate further but this one's pretty obvious.

Not that this is an impossible idea, but you can do any root using the power function: power(x,1/n) is the nth root of x.

That and the fact that cube root is virtually useless when it comes to game math.
  • 0

#27 ADHDguitar

ADHDguitar

    GMC Member

  • New Member
  • 79 posts

Posted 27 October 2010 - 03:12 AM


I'd like to see a cube root function. I'd articulate further but this one's pretty obvious.

Not that this is an impossible idea, but you can do any root using the power function: power(x,1/n) is the nth root of x.

That and the fact that cube root is virtually useless when it comes to game math.

You'd think I would have thought of that having taken Pre-Calculus, but.... Thanks! :lol:
  • 0

#28 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 27 October 2010 - 07:39 PM

@TheMagicNumber: Scripts would need a formal parameter list for that to work, which I believe is already supported in extensions. The list includes "argument number-checked scripts," but I could also add argument names for intellisense if that's what you're asking for. However, it might be better to include it in some kind of extension/editor unification section- does anyone have any other ideas for how that might be accomplished before I add it?

Yes, extensions have the option for this. Scripts don't, unless scripts are going to be removed (I doubt it), they should be supported. It sucks having to open the script when GM tells you it's parameters are "...".
  • 0

#29 xot

xot

    media multimixer

  • Global Moderators
  • 4648 posts
  • Version:GM:Studio

Posted 29 October 2010 - 12:28 PM

I suggested named script arguments during the GM8 beta but it was shot down.

Even though it is possible it would complicate the interface. Also it is against the design of GML in which functions do not have named arguments. (I know that this is a weakness of GML but it was done this way to make things easy for beginners. We might at some moment give GML an update but not in this version of Game Maker.


  • 0

#30 paul23

paul23

    GMC Member

  • Global Moderators
  • 3355 posts
  • Version:GM8

Posted 29 October 2010 - 02:23 PM

I suggested named script arguments during the GM8 beta but it was shot down.

Even though it is possible it would complicate the interface. Also it is against the design of GML in which functions do not have named arguments. (I know that this is a weakness of GML but it was done this way to make things easy for beginners. We might at some moment give GML an update but not in this version of Game Maker.

Thus actually a good candidate to (keep) it on the suggestion list!

I saw that arguments indeed.. Made me REALLY wonder how named arguments would complicate thigns for beginners.
  • 0

#31 Drara

Drara

    GMC Member

  • GMC Member
  • 294 posts

Posted 29 October 2010 - 05:15 PM

I'd suggest another ting which isn't on the list I think.
You should be able to chose the index of every object and ressource by yourself. Yust put a field where to type in a new index. The thinked index could be default set and when you give a number which is already in use by the same ressource type the field should just get red (for invalid input).

Another suggestion which means in fact the same: There should be a function like: instance_set_id(oldid, newid)
if the input is already in use it should just fail (and return -1 or whatever).
I'm not experienced in this domain but it could be usefull syncronyzing games for multiplayer because there is a problem when on one computer a new instance is created and on the oother ones not, you can refer right anymore with the same idnumber for all computers.
  • 0

#32 IsmAvatar

IsmAvatar

    Good Samaritan

  • GMC Member
  • 2411 posts
  • Version:GM8

Posted 29 October 2010 - 05:33 PM

I'd suggest another ting which isn't on the list I think.
You should be able to chose the index of every object and ressource by yourself. Yust put a field where to type in a new index. The thinked index could be default set and when you give a number which is already in use by the same ressource type the field should just get red (for invalid input).

Another suggestion which means in fact the same: There should be a function like: instance_set_id(oldid, newid)
if the input is already in use it should just fail (and return -1 or whatever).
I'm not experienced in this domain but it could be usefull syncronyzing games for multiplayer because there is a problem when on one computer a new instance is created and on the oother ones not, you can refer right anymore with the same idnumber for all computers.

Aside from multiplayer synchronization, which can be achieved other ways, I don't see a use for this. The id numbers of objects is supposed to be a hidden underlying mechanism which is subject to change at any moment - you really shouldn't be referencing the IDs in such a direct manner.
(For the record, I'm the one who developed the ID defragger, which is now available in my GM-compatible program, LGM)

Edited by IsmAvatar, 29 October 2010 - 05:35 PM.

  • 2

#33 Rusky

Rusky

    GMC Member

  • New Member
  • 2450 posts

Posted 29 October 2010 - 07:56 PM

Alright, I've added named script arguments to the list. I don't see how that could possibly make things harder for beginners- people who write scripts already have to think about what arguments they're taking so they may as well name them.
  • 0

#34 Drara

Drara

    GMC Member

  • GMC Member
  • 294 posts

Posted 29 October 2010 - 08:11 PM

Alright, I've added named script arguments to the list. I don't see how that could possibly make things harder for beginners- people who write scripts already have to think about what arguments they're taking so they may as well name them.

Yes but it should be optional. So that you can still use different ammounts aof Arguments in a script.

@IsmAvatar Yes, I know LGM :) I was even in the forum.
But I can't programm in it just because it doesn't compile the game :/
And I'm normaly testing my project every 5-10 minutes.

So the funktion in GM would be nice.

Edited by Drara, 29 October 2010 - 08:15 PM.

  • 0

#35 IsmAvatar

IsmAvatar

    Good Samaritan

  • GMC Member
  • 2411 posts
  • Version:GM8

Posted 29 October 2010 - 10:12 PM

@Drara, LGM isn't relevant here. I was simply mentioning it to cite my expertise in the area. My point is, I don't see the ability to specify object IDs as a particularly useful one, and I believe it *should* be kept under the hood and not touched because of how volatile it is.
  • 0

#36 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 30 October 2010 - 12:35 AM

I suggested named script arguments during the GM8 beta but it was shot down.

Even though it is possible it would complicate the interface. Also it is against the design of GML in which functions do not have named arguments. (I know that this is a weakness of GML but it was done this way to make things easy for beginners. We might at some moment give GML an update but not in this version of Game Maker.

I was actually thinking of a comment at the beginning of scripts (optional, of course) to contain parameter information.
  • 0

#37 Rusky

Rusky

    GMC Member

  • New Member
  • 2450 posts

Posted 30 October 2010 - 01:52 AM

Putting information like that in comments is really not a good idea. The contents of a comment should never affect the semantics of a program, which it would unless you only named arguments in intellisense and didn't allow code to use the games, which would be pretty useless.
  • 0

#38 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 30 October 2010 - 04:41 AM

I would actually rather have the code completion information for scripts in a comment than more format changes and added UI. Though, if having an editor like the extension maker does is easier in YYG's eyes, they'd go with that. Either way, code completion for scripts should be done.
  • 0

#39 paul23

paul23

    GMC Member

  • Global Moderators
  • 3355 posts
  • Version:GM8

Posted 30 October 2010 - 10:55 AM

Putting information like that in comments is really not a good idea. The contents of a comment should never affect the semantics of a program, which it would unless you only named arguments in intellisense and didn't allow code to use the games, which would be pretty useless.

Matlab has a similar structure.. And I have to say, it works very well:

-first line of "script" is the way a function is called (return variable(s), parameters & function name)
-The next line -if it is a comment- is used for the intellisense when typing the function.

It works amazingly easy as you can type everything "1 go". (instead having to fill in a lot of forms such as how gamemaker works now).
  • 0

#40 GearGOD

GearGOD

    Deus Verus

  • GMC Member
  • 2153 posts

Posted 30 October 2010 - 02:30 PM

Metadata should never go in comments.
  • 1




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users