• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Discussion Converting Compatibility scripts

csanyk

Member
After importing my project, I decided to have a look through the compatibility scripts.

In my project, it happens that mostly the compatibility scripts that were generated for me had to do with wrapping calls to the deprecated instance_create() function. Also some scripts that replace the old view system.

I quickly went through my project and replaced all calls to the instance_create() compatibility script with calls to the new instance_create_layer() function, then once I was satisfied that I'd updated the entire project, I got rid of the compatibility script for instance_create() and tested the project, and all is well. Once I knew that was working, I was able to get rid of the helper scripts that set up the legacy object depth system, as well.

I haven't yet tried to get rid of the compatibility scripts for the view system, but only because I've yet to get into the new camera-based system. I'll likely get to that later.

I am wondering whether there's any great advantage to doing this post-import cleanup maintenance.

From what I can see, from this little bit of exposure to it, it's not that hard to get the imported project completely off of the compatibility scripts. I imagine that larger, more complicated projects may not be so simple to do this for, depending on what deprecated functions they used.

I believe that there are a few advantages, and would like to hear other people's opinions.
  1. I just feel better knowing that I've written every line of code in the project. It gives me confidence, knowing that I've built everything, so I understand how it all works, and I'm not afraid of touching any of the code if I need to. Reducing the amount of code in a project always feels like a good thing to me. I'm pretty obsessive about keeping my code clean and simple and understanding everything in my projects.
  2. I would think that there's likely some tiny amount of performance improvement from removing the wrapping around instance_create_layer() and calling it directly, rather than through the instance_create() compatibility script. And likely with other functions as well, if there had been others in my project that needed to compatibility scripts to be generated for them. I'm sure it doesn't matter in the vast majority of cases, and I did not any performance differences to be at all noticeable, but I wasn't expecting to, either. It may even be that the compiler optimizes this stuff so it doesn't matter even a little bit.
 

Mike

nobody important
GMC Elder
Personally, if you can get rid of them and totally convert over to GMS2's API, I think it's better. Should be faster as well. I've been doing it why my own projects. Same as you, I've only got view/camera stuff left to replace....

The compatibility scripts are there to get your project into GMS2, so you don't face a daunting task of a massive rewrite before you even get going. And although you can keep them... you'll never fully utilise GMS2 until you fully swap.
 

Llama_Code

Member
I have actually been doing this as well, at least for smaller more manageable projects.

I didn't know if it would actually make a difference but it made me feel better o_O
 

nesrocks

Member
I have just finished removing all compatibility scripts. I also had left view settings for last. This is just what I do once at the game start (may not be ideal for you):
Code:
gamewidth = 424;
gameheight = 240;
zoom = 3
camera_set_view_size(camera_get_active(), gamewidth, gameheight)
window_set_size(gamewidth * zoom,gameheight * zoom);
display_set_gui_size(gamewidth * zoom,gameheight * zoom);
 
Top