OFFICIAL GMS 2.3.0 BETA ANNOUNCEMENT

kburkhart84

Firehammer Games
Anyone has an opinion on using the native data structures vs wrapping them into custom structs to turn them more like objects?
list.append(x)
list.pop() etc

Having to ds_blabla everywhere is a bit annoying, but I don't know if that minor annoyance is worth coding a simple (at least in my head) wrapper. also maybe I'm missing some potential issues with such an approach.
I don't think there would be any issues except errors if you code it wrong. There would be a slight performance hit just from the slight overhead, similar to the overhead you get just calling a function.

That said, I don't know where it is if it exists, but it seems to me that someone(maybe on the Discord) mentioned having coded one or more data structures just using the native GML with structs.
 

Niften

Member
I don't think there would be any issues except errors if you code it wrong. There would be a slight performance hit just from the slight overhead, similar to the overhead you get just calling a function.

That said, I don't know where it is if it exists, but it seems to me that someone(maybe on the Discord) mentioned having coded one or more data structures just using the native GML with structs.
JujuAdams made struct variants of all of the data structures with json encode and deep copy - I think FrostyCat did the same as well
 
Anyone has an opinion on using the native data structures vs wrapping them into custom structs to turn them more like objects?
I believe you're describing what FrostyCat has already taken care of here, check it out:
The lightweight data structures library that I have been working on since the beginning of the month is finally complete: https://github.com/dicksonlaw583/LightweightDataStructures

There are a couple of regressions from the last runtime to the current one that prevents the library from showing its full potential. But at the very least it's ready for an open beta showing what the new OOP features can offer.
I think FrostyCat did the same as well
And FrostyCat's version for JSONs as structs is here: https://github.com/dicksonlaw583/JsonStruct I'm definitely going to be using these.
 
Is anyone else upset about the removal of 2d arrays? When I started to read the article I thought that it was going to say we now have 3d arrays. I thought yessss finally. But no they have gone the other way.
 
Sorry, dumb question but how do I get the beta. I switched to the beta channel but it says v2.2 still.
Very first post in this thread has a link to the blog where you can apply:
You have to apply as it is a closed beta. Also from the blog it explains:
Just to note, there is no longer a separate “beta branch” to opt into – this Beta install is a secondary installation and does not share info with your 2.2.5 install, so you don't need to modify your existing GMS2 setup in order to take part.
So setting your v2.2 IDE to opt into the beta is nothing related to v2.3.
 

drandula

Member
Is anyone else upset about the removal of 2d arrays? When I started to read the article I thought that it was going to say we now have 3d arrays. I thought yessss finally. But no they have gone the other way.
They are now 1D arrays, but you can use chained accessories, so in practice they can be any dimension. Like "Array[0][5][3][9][12] = 0;" would be 5 dimensional array.
 
Does anyone know if the new error catching functions will connect to a sentry account or will I still have to use tools like yellow afterlife and other market place tools?
 

gnysek

Member
Does anyone know if the new error catching functions will connect to a sentry account or will I still have to use tools like yellow afterlife and other market place tools?
Those are error catching, not error reporting functions. I don't know any programming language which offers it out of box. You still need to write "report" part by yourself, but that would be much much easier now.
 

FrostyCat

Member
GML:
a = function() { }
typeof( a ) // method

function b() { }
typeof( b ) // number
What the hack is going on here?
Only functions declared the first way becomes methods (i.e. anonymous functions). Functions declared the second way with a name become scripts, which are referenced using IDs.

I've raised this issue before at the beta forums, and the answer is that YoYo is doing this for backwards compatibility with code relying on scripts being numeric IDs. I'm not satisfied with the answer any more than you are, but that's the way it'll be for GMS 2.3.
 
Only functions declared the first way becomes methods (i.e. anonymous functions). Functions declared the second way with a name become scripts, which are referenced using IDs.

I've raised this issue before at the beta forums, and the answer is that YoYo is doing this for backwards compatibility with code relying on scripts being numeric IDs. I'm not satisfied with the answer any more than you are, but that's the way it'll be for GMS 2.3.
Are there any substantial advantages to saving the function as a variable apart getting the id?
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Just noticed that these went unanswered... so:

1) How long will there be support for what is now the current version of GMS2 beyond release of the new version?
If you don't update to the 2.3.0 version when it goes stable and you find a bug in 2.5.x, if that bug exists in 2.3.x then it will be fixed in 2.3.x. If it doesn't then it won't be fixed in 2.5.x as it's already been fixed (or doesn't exist) in the current 2.3.x version. Either way, you'll need to update or work around it, as YYG are not going to support two versions of the same software going forward.

2) Regarding the new origin marker for sprites in the sprite editor, will changing a project over to the new version disrupt the placement of assets which had previously been dragged into rooms in the former GMS2 version?
Everything should be the same as before and you shouldn't notice any difference.

3) Will the grid/grid "snapping" means of manual room/sprite editing still be available in the new version...? For example, I have the room grid set on snap 128x128 for my assets layer and 64x64 for my instances layer... Will that still work?
As above! Should all be the same...
 

kburkhart84

Firehammer Games
Are there any substantial advantages to saving the function as a variable apart getting the id?
The only reason I can think of that it is advantageous as a variable is simply to be able to copy the reference around. Previously you could copy around the name of the script in a variable and then execute it with script_execute(). Now you can simply copy the function variable and call it directly with parenthesis. Both of these things are quite useful.

One use is in a state machine kind of thing. Instead of making multiple objects for the different states your thing is in, and instead of running different code based on a switch statement, you can simply set a variable equal to whatever function should be getting called each step, and then call that each step based on the variable. Then, if you change states(jumping turning to falling), you can simply change that variable.

Another use is if you use parent/child objects (or a single object and instnace creation created variables) for things like enemies or buttons. In the case of the buttons, you can make a parent button that has the event handling for mousing over, etc... and then the children objects(or the instance creation code) sets variables for what function to call when the button is actually clicked. This lets you keep only one copy of all the code for buttons, and then the code that varies can be kept separate.

Last example...callbacks. In my input system for example, you set it to be searching for an input(so they player hits the key they want to use for the jump action for example). The game doesn't freeze, rather an object just does the search behind the scenes. Then, it calls a function depending on whether it eventually got a key pressed and set the input, or if the search timed out because it took too long. And when you start the searching, you pass in as arguments what functions you made for that purpose, and it then calls them using those references, so you can remove the text telling the user to hit a key.
 
The only reason I can think of that it is advantageous as a variable is simply to be able to copy the reference around. Previously you could copy around the name of the script in a variable and then execute it with script_execute(). Now you can simply copy the function variable and call it directly with parenthesis. Both of these things are quite useful.

One use is in a state machine kind of thing. Instead of making multiple objects for the different states your thing is in, and instead of running different code based on a switch statement, you can simply set a variable equal to whatever function should be getting called each step, and then call that each step based on the variable. Then, if you change states(jumping turning to falling), you can simply change that variable.

Another use is if you use parent/child objects (or a single object and instnace creation created variables) for things like enemies or buttons. In the case of the buttons, you can make a parent button that has the event handling for mousing over, etc... and then the children objects(or the instance creation code) sets variables for what function to call when the button is actually clicked. This lets you keep only one copy of all the code for buttons, and then the code that varies can be kept separate.

Last example...callbacks. In my input system for example, you set it to be searching for an input(so they player hits the key they want to use for the jump action for example). The game doesn't freeze, rather an object just does the search behind the scenes. Then, it calls a function depending on whether it eventually got a key pressed and set the input, or if the search timed out because it took too long. And when you start the searching, you pass in as arguments what functions you made for that purpose, and it then calls them using those references, so you can remove the text telling the user to hit a key.
thanks for the full-bodied answer, I hope a full tutorial will come out later that shows the full potential of this new version.

I also wonder if in the next versions they also implement an intuitive tool to easily manage artificial intelligence such as behavior tree, a special states management panel would be fantastic in the future.
 

gnysek

Member
Changes too room editor and sprite editor only extends what was already, doesn't remove nor change existing features. Those may look different (especially sprites, where one subimage can take up several frames of display), but nothing was removed.

I didn't noticed anything to be removed in fact, so all games are compatible with new version.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Oh, you can post things! That's not an issue... I think we already have a couple of tutorials on 2.3 stuff. :) However, the forum doesn't really permit or have a place to just showcase "things" that aren't full games, so I was planning on making a showcase topic for sequences so you can just post videos and projects and GIFs showcasing some of the things you've found you can do.
 
i am trying to create an engine with nested structures but i am failing ... is there a way to fix this piece of code? Thank you all!

Code:
//Create Event
inputs=
{
    dir :
    {
        right=
        {
            key : ord("D"),
            chk : false,
        };

        left=
        {
            key : ord("A"),
            chk : false,
        };
    }
};
 
Last edited:
Got into beta today, ticket number is around 170 000 . Being able to create method variables is like a night and day difference for this language. About to look through structs
 
Last edited:
I got a chance to tinker around with the beta yesterday. I used an animation curve to control jump characteristics like Super Mario 2. Just by changing the curve, and a jumptime variable, I made my object jump like Princess Peach. Very cool!
 

kburkhart84

Firehammer Games
I got a chance to tinker around with the beta yesterday. I used an animation curve to control jump characteristics like Super Mario 2. Just by changing the curve, and a jumptime variable, I made my object jump like Princess Peach. Very cool!
Nice way to do to that, I hadn't thought of it. You just have to add on the falling part either when the curve ends or the button is release, and check for collisions.

I added a feature to my Easing system(will release when 2.3 is out) that uses an animcurve instead of the regular equations as well. I'm also planning to use them for a gradient coloring system, and probably for the particle system too(gradients to have more control instead of just the 3 values).
 
Nice way to do to that, I hadn't thought of it. You just have to add on the falling part either when the curve ends or the button is release, and check for collisions.

I added a feature to my Easing system(will release when 2.3 is out) that uses an animcurve instead of the regular equations as well. I'm also planning to use them for a gradient coloring system, and probably for the particle system too(gradients to have more control instead of just the 3 values).
For the falling part, I kept track of the last y, and subtracted that from current y, and that gave me a fall speed, or offset that I could then apply naturally. That way, even when the curve was done, or my jump time was exceeded, the object can continue to fall whatever speed it was falling at the end of the curve. Obviously if I want to go this route, I'll have to work out what happens when you release the jump button early, and animation curves let you retrieve values at any time along the curve, so there's plenty of options. But the more I think about it, It's probably easier just to break out of the curve and begin a natural fall. :) I like to work with vectors for movement a lot. But I thought it was neat how you could use animation curves to get those jump velocities exactly like you want. I'm real excited about where GMS is going and look forward to more experiments.
 

Joh

Member
Is there a way to delete a struct and execute a cleanup (say destroy all contained DS) all in one?
i can think of: creating a script that run a cleanup function from struct and then delete it. but is it even possible to check for a function existence? (see if struct has a cleanup function)
Running the cleanup function on/from the struct and delete at the end of it. but how does a struct reference itself?
Manually cleanup before deleting every time but that is awful.
 

NXDIAZ

Member
Are there any plans in the future to incorporate a visualization of a room into the sequence editor? Like, lets say I want to create a cut scene. Right now to do that, I either need an image of the whole room and set it as a background, do it blind, or constantly check for the coordinates your looking for. I think it would be much more convenient to do it in a way where you can have the current set up of the room as the background, and you can edit the sequence from there. It's just a suggestion, other than that, this new version, even as a beta has been incredible to use.
 

rytan451

Member
I am now able to access the beta (170331). The highest ticket id who has access to the beta, as reported on this thread, is 170356 (DanTheCan).
 
For those with access to 2.3Beta I'm experiencing a weird behavior I needed someone to reproduce... (I'm able to reproduce it 100% of the time but it's so weird I really need other people to try it out)

So these are the steps:
1) close everything you have opened
2) run an empty project (with show_debug_overlay(true))
3) check the FPS rate
4) open the browser and go to YouTube (I swear I’m not making fun of you)
5) run the same project again while the YouTube tab is active (it must be the active one)
6) check the FPS rate (see if it changes)

My goes from 5000 without YouTube open to 27000fps with YouTube opened
(okay I have a slightly fast computer but this is the normal run speed in 2.2.5)

[MY Humble Guess] Opening a site like youtube that requires some more processing power "turns on" something on the CPU and the GMS2 runner gets the ride... but it's strange that YoYo runner isn't able to do that on its own.

[NOTICED] The framerate gets a huge increment, it's a lot steadier, actual code being run is also faster!
 
Last edited:

Zeo666

Member
I've got a script file vec2 with the following code:

GML:
Vector2 = function(_x, _y) constructor
{
    x = _x;
    y = _y;
    
    static Add = function(_other)
    {
        x += _other.x;
        y += _other.y;
    }
}
Now when I use this code in the create event of an object:

Code:
var pos = new Vector2(1,0);

show_debug_message(pos);

var move = new Vector2(1,0);

show_debug_message(move);

pos.Add(move);

show_debug_message(pos);
I get an error message:

Code:
___________________________________________
############################################################################################
ERROR in
action number 1
of Create Event
for object o_player:

Variable o_player.Vector2(100040, -2147483648) not set before reading it.
 at gml_Object_o_player_Create_0 (line 15) - var pos = new Vector2(1,0);
############################################################################################
gml_Object_o_player_Create_0 (line 15)
gml_Script_spawn_player (line 19)
gml_Object_o_gameplay_manager_Step_0 (line 19) -               spawn_player(player_id);
I thought structs are declared globally? Or have I missed something?
 

Arvel

Member
I've got a script file vec2 with the following code:

GML:
Vector2 = function(_x, _y) constructor
{
    x = _x;
    y = _y;
  
    static Add = function(_other)
    {
        x += _other.x;
        y += _other.y;
    }
}
Now when I use this code in the create event of an object:

Code:
var pos = new Vector2(1,0);

show_debug_message(pos);

var move = new Vector2(1,0);

show_debug_message(move);

pos.Add(move);

show_debug_message(pos);
I get an error message:

Code:
___________________________________________
############################################################################################
ERROR in
action number 1
of Create Event
for object o_player:

Variable o_player.Vector2(100040, -2147483648) not set before reading it.
at gml_Object_o_player_Create_0 (line 15) - var pos = new Vector2(1,0);
############################################################################################
gml_Object_o_player_Create_0 (line 15)
gml_Script_spawn_player (line 19)
gml_Object_o_gameplay_manager_Step_0 (line 19) -               spawn_player(player_id);
I thought structs are declared globally? Or have I missed something?
They are declared globally if they're on Scripts. Which means you're gonna need the global. prefix to use Vector2.
 
Is your PC a laptop?
If it is: it may be sensible to check if there is any aggressive power management profile active.
No it's a desktop and quite powerful one... the problem seems to be that the GMS2 runner isn't powerful enough for the graphics card to kick in... when open a more heavy program (browser with youtube open) the graphics card kick in and GMS2 runner will take the ride... would be greatif the GMS2 runner would "call the GPU for help" by default... or at least allow to set that as an option :)
 

gnysek

Member
No it's a desktop and quite powerful one... the problem seems to be that the GMS2 runner isn't powerful enough for the graphics card to kick in... when open a more heavy program (browser with youtube open) the graphics card kick in and GMS2 runner will take the ride... would be greatif the GMS2 runner would "call the GPU for help" by default... or at least allow to set that as an option :)
And if you try a lot, lot of draw code to drop FPS a little, does it switch? I also noticed, that GMS uses "main" card only, maybe it's executable needs some flag to be marked as "game" and use proper GPU? The same issue is with IDE, which likes to lag for me when more windows are opened, but it uses Intel card instead of my GTX.
 

Zeo666

Member
They are declared globally if they're on Scripts. Which means you're gonna need the global. prefix to use Vector2.
This fixed my issue:

GML:
var pos = new global.Vector2(1,0);

show_debug_message(pos);

var move = new global.Vector2(1,0);

show_debug_message(move);

pos.Add(move);

show_debug_message(pos);
Thanks :)
 

saffeine

Member
This fixed my issue:

GML:
var pos = new global.Vector2(1,0);

show_debug_message(pos);

var move = new global.Vector2(1,0);

show_debug_message(move);

pos.Add(move);

show_debug_message(pos);
Thanks :)
alternatively, rather than doing it like this:
GML:
Vector2 = function(_x, _y) constructor
it might be wise to start doing it like this:
GML:
function Vector2(_x, _y) constructor
the former declares it locally ( or in the event of a script, inside a global variable ).
the latter declares it as a standalone constructor that can be called in the way you intended 👍
 
And if you try a lot, lot of draw code to drop FPS a little, does it switch? I also noticed, that GMS uses "main" card only, maybe it's executable needs some flag to be marked as "game" and use proper GPU? The same issue is with IDE, which likes to lag for me when more windows are opened, but it uses Intel card instead of my GTX.
I reported this in the BETA forums but don't know if they will address it...
 

Zeo666

Member
alternatively, rather than doing it like this:
GML:
Vector2 = function(_x, _y) constructor
it might be wise to start doing it like this:
GML:
function Vector2(_x, _y) constructor
the former declares it locally ( or in the event of a script, inside a global variable ).
the latter declares it as a standalone constructor that can be called in the way you intended 👍
Yeah I figured that out just after. /facepalm lol
 
Top