Jump to content


Photo

GameMaker Studio - obsolete functions


  • Please log in to reply
128 replies to this topic

#21 xXNeoREXx

xXNeoREXx

    GMC Member

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

Posted 24 April 2012 - 04:06 PM

This is such a buzz kill for me!
I am programing since like "ever" in game maker and I got used to use those "obsolete" functions...
I think this is totally a reason for me to not upgrade to Studio with more money, if there is no way to use those functions.

I really miss the functions "variable_local_exists" and "variable_local_set", I used them a lot and I don't think there is an alternative...
Also "execute_string" function was highly useful for me for converting strings into a variable name. for example: variable = execute_string("return "+"c_black")

YoYo Games should really make an extension that has all the wanted functions (like what other people listed, and I totally agree with them).

Edited by xXNeoREXx, 24 April 2012 - 04:13 PM.

  • 0

#22 Destron

Destron

    GMC Member

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

Posted 24 April 2012 - 06:57 PM


...it's probably a good idea to stop using them and consider them deprecated...

If they work in my current version of GM, I'll use them.

I'm that guy who stays in the right lane, even after it says "right lane closed 1 mile ahead." ... and then cuts you off when the lane ends. :tongue:


I hate you :verymad: ... JK :tongue:

In all seriousness though I would love to see platform specific context highlighting, that would make it much easier to steer clear of unsupported functions on your target platform

Edited by Destron, 24 April 2012 - 06:58 PM.

  • 0

#23 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 17013 posts
  • Version:GM:Studio

Posted 25 April 2012 - 09:18 PM

In all seriousness though I would love to see platform specific context highlighting, that would make it much easier to steer clear of unsupported functions on your target platform


Although we can't promise in editor highlighting, we can promise that each function will have a compatibility table at the top of the page so you can see at a glance which platform is supported as well as any platform specific details that you should know...
  • 1

#24 xXNeoREXx

xXNeoREXx

    GMC Member

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

Posted 26 April 2012 - 07:34 AM


In all seriousness though I would love to see platform specific context highlighting, that would make it much easier to steer clear of unsupported functions on your target platform


Although we can't promise in editor highlighting, we can promise that each function will have a compatibility table at the top of the page so you can see at a glance which platform is supported as well as any platform specific details that you should know...


That will be very useful, because I was shocked when I imported my HTML5 project into Studio Beta and found out some functions are not compatible with even the Windows platform.
And I do encourage that YoYo Games would put alternative ways to handle the obsolete functions in the help document.
  • 0

#25 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 17013 posts
  • Version:GM:Studio

Posted 26 April 2012 - 08:02 AM

That will be very useful, because I was shocked when I imported my HTML5 project into Studio Beta and found out some functions are not compatible with even the Windows platform.
And I do encourage that YoYo Games would put alternative ways to handle the obsolete functions in the help document.


That's coming too... but only for some very specific stuff, like the messages and things as they are going to be available, but handled in an asynchronous way...
  • 1

#26 paul23

paul23

    GMC Member

  • Global Moderators
  • 3383 posts
  • Version:GM8

Posted 27 April 2012 - 09:06 PM

Most of the stuff I see on this list is predictable and reasonable. I'm a bit surprised and disappointed to see some particle functions go, it will rather limit what you can do with them. I hope alternatives are going to be provided for.

I'll also really miss the pop-up menu and the file dialogs. They're not interesting from the perspective of a game, but I do use them when building a level editor and I need a quick selection box or a simple way to load and save external files. I hope they're at least going to push them into extensions, so we can keep on using them.

One other thing:

set_automatic_draw


This isn't a display-specific function, it's a engine-level control function. It was very useful to be able to decide ourselves whether to draw or skip drawing a certain step, so that the game could be throttled somewhat if a game step couldn't be made. Again, I hope some alternative throttling method is going to be provided.


In one of the older blog posts from mike he already hinted at this - and I asked for more information about it. - But this has to do with their decision to go to opengl, I don't remember the specifics, but in opengl they liked to use a mode where drawing happens at regular intervals -ONLY-. This forced drawing to happen always and only during the draw-event. And that in turn would make manual drawing obsolete.

As long as the file_find_* functions are still there however, it can be replicated with scripts.

However it is impossible to replicate NATIVE pop-up menus with scripts. And now that I read a bit more about application development I learned that this is one of the main important things in applications. (And something like a map-editor is useful for a game yet should behave like an application).

variable_local_exists and variable_local_set are also completely useless, at no point should you have undeclared variables, that's a terrible and silly practice.

I've already said it - but I guess it needs saying again. In programming passing a VARIABLE to a function is often much better than passing a value. There are many paradigms that depend on this: ie a function might have a failure condition, in which case one would return whether the function succeeds, and the actual value gets set in one of the passed variables. Sometimes it is semantically more correct to change a variable (ie think about the function "+=" - it add the right hand side to the left hand side semantically, that's semantically different from making a copy first). And many other times one wishes to have a "output variable" (speed considerations). There are several ways language use this:
  • Older languages often used pointers. Simply pointing to memory where a variable is located & then changing that memory
  • Newer languages like the pass-by-reference idiom (used in VB, C#, JAVA). Here you actually tell the compiler directly "that argument IS a variable, not a copy"
  • If these are not possible sometimes arrays are used instead (only language I can think of are older version of fortran)
In C & basic family the programmer has total control over this by language keywords. - In java pass-by-reference was always applied, except for build in types in which pass-by-value was used. (Leading to types such as "Double"). In gamemaker a similar behaviour to JAVA is used - simple types (real, string) are passed by value; while when you pass an instance index/list it acts as a pass by reference.
The problem however is that there is no easy encapsulation of simple types possible in GM. You can't feasibly create a list with 1 value and then use that. That's just way too ugly, error prone, to even think about: GM lacks the OO capabilities for this. Previously one could pass the variable as (literal) string, and use variable_get_* functions to get the actual contents. But now I really don't see any way to pass-by-reference.



The other option - to pass arrays to functions - is even not possible at all in gm.

This certainly is my biggest objection to the new versions of GM & something I honestly don't know how/if I will work around yet.
  • 1

#27 Desert Dog

Desert Dog

    GMC Member

  • Global Moderators
  • 6409 posts
  • Version:Unknown

Posted 27 April 2012 - 10:55 PM

I'm looking forward to the particle revamp/curb, for html5 at least.

Really wanting the extra speed.
  • 0

#28 Zombie_Plan

Zombie_Plan

    GMC Member

  • New Member
  • 22 posts

Posted 29 April 2012 - 09:48 AM

I've just started using Studio, and ported my game from 8.0 to it. Of course, there are some teething problems that I'm trying to work out.

One of my objects used the Step Towards Point function to make it move towards the player, but move around solid objects it encounters. That D&D/function is now obsolete, and being a novice I'm having trouble finding a replacement that does everything I need it to.

I was wondering if anyone knew of the replacement or a way around?
  • 0

#29 kburkhart84

kburkhart84

    GMC Member

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

Posted 29 April 2012 - 07:56 PM

I've just started using Studio, and ported my game from 8.0 to it. Of course, there are some teething problems that I'm trying to work out.

One of my objects used the Step Towards Point function to make it move towards the player, but move around solid objects it encounters. That D&D/function is now obsolete, and being a novice I'm having trouble finding a replacement that does everything I need it to.

I was wondering if anyone knew of the replacement or a way around?


1. I would look up gmlscripts, which I understand has a few pathfinding functions, which may help you.

2. I don't think those functions are going, because I don't see a reason for them to go. They should be fine for all the platforms, though speed may be an issue. I didn't see them on the list from NPT's first post, though I know it isn't all inclusive so I may be wrong here. But I'm guessing that if you are having trouble with those functions, it may that they have simply not been implemented yet, though that doesn't mean they won't be.
  • 0

#30 Smarty

Smarty

    GMC Member

  • Retired Staff
  • 7262 posts
  • Version:GM:Studio

Posted 29 April 2012 - 08:32 PM

In one of the older blog posts from mike he already hinted at this - and I asked for more information about it. - But this has to do with their decision to go to opengl, I don't remember the specifics, but in opengl they liked to use a mode where drawing happens at regular intervals -ONLY-. This forced drawing to happen always and only during the draw-event. And that in turn would make manual drawing obsolete.

Isn't that just about not being able to draw outside of the draw event? How does that decision help with our need to let the game catch up by dropping frames? From your story it sounds as if it will simply draw always, regardless of whether it has time. The (better) alternative to go about solving this is delta timing, of course, but it's such a drag.
  • 0

#31 Mike.Dailly

Mike.Dailly

    Evil YoYo Games Employee

  • Administrators
  • 1608 posts
  • Version:GM:Studio

Posted 30 April 2012 - 07:15 AM

This certainly is my biggest objection to the new versions of GM & something I honestly don't know how/if I will work around yet.


What ARE you on about??? 1st, you should never need it for "normal" variables. If you need to set something "unknown" in another object, you can use a script to set it.

If you really REALLY need it, use a map in each object holding the variables you require.

And if you feel you need to access an array in an object, use a script to get/set, and that way you'll pass around the ID, of the object - OR use an ID for the array and use a switch in the script to pick the right one.

It's not that complicated really. Outside of the old room creation code issue (where it set a variable the instance creation code didn't know about) which is now fixed, you should NEVER need this - ever. If you do, you're doing it wrong.
  • 0

#32 paul23

paul23

    GMC Member

  • Global Moderators
  • 3383 posts
  • Version:GM8

Posted 30 April 2012 - 10:37 AM

Well let's just focus on the arrays first - say I have a function which does some array modifying. (IE a floodfill in the array).

FloodFill(x, y) would take 2 arrays where the second array corresponds to a collision map, holding negative values for impassable terrain, positive values for passable terrain (probably the value corresponds to how easy to move over it is). Now the first array I wish to create -using floodfill- a list of "islands" so that in a pathfinding algorithm later one can simply check if 2 parts of the map can actually reach each other.

If one could simply pass arrays to scripts it would be easily done. And currently I did it by passing the name of the array -slow, but above script is only executed at map-loading anyways-. Now the 3rd option, pass the id of the instance holding the array is suggested, well that's quite a strain on the programmer. As now you are forcing inside the function to let the "user" of the function correspond to a certain nomenclature...

Other option is obvious using a grid, but that's a bit overkill if the only thing you do is reading & writing single cells?
  • 1

#33 Mike.Dailly

Mike.Dailly

    Evil YoYo Games Employee

  • Administrators
  • 1608 posts
  • Version:GM:Studio

Posted 30 April 2012 - 07:16 PM

I know passing array references around would be great, no one is disagreeing that. But it's not going to happen in the current code base.

And using the variable_local_array set things is very slow, and if you don't really care about the speed - as it's VERY slow, then going through a script isn't an issue.

Now, as has been said a lot.... these functions aren't coming back, so you can either figure a way around it, or you can stay with GM8.x and windows only, it's your choice, but a good programmer does what he needs to to make things work and I've given you several alternatives.
I'm also 99.9999% sure you don't "have" to do it the way you are, but without knowing exactly what your doing, it's impossible to give an alternative. Out of curiosity, can these arrays be global, or does each instance have it's own set of arrays?

Your choice, go with the flow and adapt, or stick with an old, slower model.
  • 0

#34 Smarty

Smarty

    GMC Member

  • Retired Staff
  • 7262 posts
  • Version:GM:Studio

Posted 30 April 2012 - 07:25 PM

Other option is obvious using a grid, but that's a bit overkill if the only thing you do is reading & writing single cells?

It's slightly more unwieldy, but the fact that grids have more functionality doesn't necessarily make them an overkill choice, especially if you aren't using that functionality.

Arguably, you may be overlooking how useful grids could be for path-finding. For example you mention flood-filling one array with another, where grids have a function to copy (part of) the content of one grid into another. And if you e.g. use negative values for impassable areas, you can use ds_grid_get_min on a row or column to see if it contains impassable areas. And if the value of a cell indicates a speed penalty, you can use ds_grid_get_sum to see just how much of a penalty a certain row or column takes, etc. Grids can actually help do some mundane array tasks you'd otherwise have to spell out yourself.
  • 0

#35 xXNeoREXx

xXNeoREXx

    GMC Member

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

Posted 01 May 2012 - 11:13 AM

I used to use this function before it was obsolete...
Can someone help me do it without using the variable_local... functions?
I need to create a new variable not in the create even (in a all time event, like draw) and that it would execute this statement once.
Like the following (this was made obsolete)
var name,numb;
 name = "newvar"; // the name of the created variable.
 numb = "4"; // random number
if !(variable_local_exists(name+"_"+numb)) then variable_local_set(name+"_"+numb,false);
if keyboard_check_pressed(vk_enter) then variable_local_set(name+"_"+numb,true)

I thought it would work with == but it didn't...
please find a solution, thanks...
  • 0

#36 paul23

paul23

    GMC Member

  • Global Moderators
  • 3383 posts
  • Version:GM8

Posted 01 May 2012 - 12:54 PM

I used to use this function before it was obsolete...
Can someone help me do it without using the variable_local... functions?
I need to create a new variable not in the create even (in a all time event, like draw) and that it would execute this statement once.
Like the following (this was made obsolete)

var name,numb;
 name = "newvar"; // the name of the created variable.
 numb = "4"; // random number
if !(variable_local_exists(name+"_"+numb)) then variable_local_set(name+"_"+numb,false);
if keyboard_check_pressed(vk_enter) then variable_local_set(name+"_"+numb,true)

I thought it would work with == but it didn't...
please find a solution, thanks...

You'd use arrays for that -.-, along with an initializers script.

//initializers has already run, so each position does contain a value.
//values are stored in array "myArray", and the number is "N"
if (keyboard_check_pressed(vk_enter) {
    myArray[N] = true;
}

  • 1

#37 xXNeoREXx

xXNeoREXx

    GMC Member

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

Posted 01 May 2012 - 04:18 PM


I used to use this function before it was obsolete...
Can someone help me do it without using the variable_local... functions?
I need to create a new variable not in the create even (in a all time event, like draw) and that it would execute this statement once.
Like the following (this was made obsolete)

var name,numb;
 name = "newvar"; // the name of the created variable.
 numb = "4"; // random number
if !(variable_local_exists(name+"_"+numb)) then variable_local_set(name+"_"+numb,false);
if keyboard_check_pressed(vk_enter) then variable_local_set(name+"_"+numb,true)

I thought it would work with == but it didn't...
please find a solution, thanks...

You'd use arrays for that -.-, along with an initializers script.

//initializers has already run, so each position does contain a value.
//values are stored in array "myArray", and the number is "N"
if (keyboard_check_pressed(vk_enter) {
    myArray[N] = true;
}

That's soo not what I meant...
Your code is WRONG, It uses a keyboard key as a trigger and I don't want that...
  • 0

#38 Smarty

Smarty

    GMC Member

  • Retired Staff
  • 7262 posts
  • Version:GM:Studio

Posted 01 May 2012 - 05:34 PM

That's soo not what I meant...
Your code is WRONG, It uses a keyboard key as a trigger and I don't want that...

Either you're trolling, or you haven't the slightest clue what your original script does.
  • 1

#39 xXNeoREXx

xXNeoREXx

    GMC Member

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

Posted 01 May 2012 - 06:58 PM


That's soo not what I meant...
Your code is WRONG, It uses a keyboard key as a trigger and I don't want that...

Either you're trolling, or you haven't the slightest clue what your original script does.

The original script execute a statement ONCE in a alltime event, like draw and does not repeat it...
and so you can set a variable and when you change it for a second it wont return to the first value...
+what paul23 said isn't that similar to my example...

Edited by xXNeoREXx, 01 May 2012 - 07:00 PM.

  • 0

#40 Smarty

Smarty

    GMC Member

  • Retired Staff
  • 7262 posts
  • Version:GM:Studio

Posted 01 May 2012 - 08:34 PM

The original script execute a statement ONCE in a alltime event, like draw and does not repeat it...
and so you can set a variable and when you change it for a second it wont return to the first value...
+what paul23 said isn't that similar to my example...

Fine, making a difference between not defined, 0 and 1 is important to you. But why can't you use an array or a list and use 3 values for these states?
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users