Should I switch back to the old function system?

0 favourites
From the Asset Store
Design for game, asset for game, game kit, UI design, completed design for game, mobile game, Dashify Switch
  • The old function system was more rudimentary but in some ways a lot more flexible. I used to take full advantage of the fact that you could call a function willy-nilly just using a string and the fact that parameters were not restricted to number/string/boolean.

    Now if I want to build the same kind of flexible functionality for my scripts I have to use a much more elaborate and clunky build.

    My question is, would it be safe enough to switch back to the old system? And by that I mean starting my projects in Construct 2 and then converting them to Construct 3 but without the new functions. My fear is the old functions will become completely deprecated in the future and I'll have to switch back to C3 functions anyway.

  • The old function system was more rudimentary but in some ways a lot more flexible. I used to take full advantage of the fact that you could call a function willy-nilly just using a string and the fact that parameters were not restricted to number/string/boolean.

    Now if I want to build the same kind of flexible functionality for my scripts I have to use a much more elaborate and clunky build.

    My question is, would it be safe enough to switch back to the old system? And by that I mean starting my projects in Construct 2 and then converting them to Construct 3 but without the new functions. My fear is the old functions will become completely deprecated in the future and I'll have to switch back to C3 functions anyway.

    If im not wrong, old style functions are only available on C2 runtime..

    So, it will not receive any updates/upgrades..

    Some plugins/behaviours only work on C3 runtime and also you are losing performance staying on C2 functions..

    See more here:

    construct.net/en/blogs/construct-official-blog-1/construct-3s-new-redesigned-1059

  • Wow, I didn't know that. Thanks for the info. I guess for better or worse I have to integrate C3 functions into my builds.

  • Old functions were somewhat limiting and I've taken new functions same way as you have at first.

    You just have to get used to them.

  • Actually you can use the old function on C3 runtime, but since its unprecated you can't add it as a new object, although you can use it if its already added in your project.

    But I still doesn't understand your reasons to not use the new functions, since it can do all things the old function do and more.

  • Old functions are working in C3 runtime. And I hope will be supported for a long time (since they are used in many games).

    I actually had to add old Function object into a project recently, because I really needed duplicate functions with the same name in multiple event sheets. And I couldn't find a simple substitute for this with the new functions.

  • Why would you actually need duplicate functions? That doesn‘t sound that great. What‘s the exact use case you have? Just curious :)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • WackyToaster

    For calling it between events. Doing something occasionally once in a tick can be quite useful.

    They removed it likely because of asyns features & others. It would be very hard to keep track of what is happening in the code. Also "wait" for function to complete would be a mess.

  • The restrictions of the new functions are intended to both enforce better organisation on your project, and improve performance. For example if you are allowed a function with the same name in two places, you can no longer look at a function and know what it does - you have to be aware of the entire rest of the project and see if there are any other functions with the same name. Besides, there's no reason to do it: you could just use one function with a series of sub-events to do everything in one function. And if for some reason that is difficult or awkward, you probably actually just want two separate functions. Now with the new functions you can look at one function and be confident that is the full logic of the function right there since other functions with the same name are not allowed. This improves your ability to reason about your events. It's also faster since the engine doesn't have to handle iterating over multiple functions with the same name, it just goes to the one function directly and runs that.

    There are also major usability improvements, like being able to properly name and describe parameters, and renaming functions and parameters automatically updates the entire project for you.

    I would strongly discourage you from using the old functions since they have poorer usability and much slower performance. Also in general deprecated features should not be used in new projects, since one day eventually they will probably be removed.

    There's more info in the blog post Construct 3's new redesigned functions and More about Construct's new functions.

  • Why would you actually need duplicate functions? That doesn‘t sound that great. What‘s the exact use case you have? Just curious :)

    I'm making a point-and-click adventure game with lots of layouts (scenes) and hundreds of different items. There is a single MAIN event sheet included into all layout event sheets, which handles all the core mechanics in the game - clicking items, dragging items, combining, destroying, gestures, tasks etc. So far so good, right?

    But sometimes I need to run custom events and actions, for example, in "Save the princess" scene when a sword is dropped on a dragon I want to spawn blood particles. I can't do this in the MAIN sheet, obviously. That's why I am calling a function "Item_Arrived" from the MAIN event sheet whenever any object on the scene has arrived to its destination. And I have duplicates of "Item_Arrived" function in every small event sheet for every scene.

    So in the princess scene inside this function I can check if the item_code=sword and spawn blood. In another scene in the same function I can do something else.

    I have several such functions ("Item_Clicked", "Item_Arrived", "Task_Completed" etc.), with duplicates for every scene.

    If I had to create the same system with new functions, I would either have to make a very complex function map, or use a huge single function with hundreds of sub-events.

  • dop2000

    Interesting case. Indeed the usual way would be to have one huge function that does all the things but it‘s very understandable why you wouldn‘t want that. You‘d basically need something that extends the function. Like „run function X and after X also run Y“ and „Y“ can be different from eventsheet to eventsheet. I don‘t think there is anything out of the box that could do that.

    I have a little custom behavior I use for buttons that could help. It essentially just calls a function (specified per object instance) via an action. You could have one action in the „arrived“ function that calls whatever function you specified in the picked instance that arrived.

    I wanted to upload this plugin a while ago anyway but never got to it, now I finally did. Maybe that‘s of use for you.

    construct.net/en/make-games/addons/404/button

  • WackyToaster Yeah, I used this method too - calling functions by name from an instance variable. But if I have 100 scenes with 10 custom functions that I need to call from each scene, I will end up with 1000 different functions names! Re-using the same function name in every scene is so much more convenient.

  • dop2000

    Indeed in this use case it's hard not to see the utility of duplicating function names.

    I think the problem here comes down to scoping: there are no local functions in C3 whereas global ones cause problems mentioned by Ashley above. If you could make a function local to a layout this problem would be non-existent. Good that this was mentioned; I'd rather not discover this limitation in the middle of creating something important!

    Other than that I think the new function system is way more elegant and easier to work with for most purposes.

  • Mhmm I guess it's debateable. I don't really see much of an issue having 1000 different function names as long as I can use grouping and eventsheets to keep everything tidy.

    I feel like using the same function name for different things sort of undermines the concept of a function.

    I wonder how other point&click games handled that but my guess is they also used individual functions of some sort.

  • Think of it as the same one function spread over multiple event sheets.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)