Construct 3 suggestions & ideas

Suggest and vote on ideas for Construct 3! Please note this is only one aspect of planning. We do not guarantee any features here will be implemented, even if they are top-voted ideas. The aim is just to collect feedback. Remember to search for existing submissions before adding an idea, describe your ideas as comprehensively as possible, and vote for plausible ideas that are well thought out. Please see our full guidelines on suggesting features.

31 VOTE

Direct Code injection functions

As description, an event to directly run code/functions that are written in a prompt box.

For example, I would like to be able to directly run function codes, so I would add a system event for keypress and then an action which gives me a dialogue box where I can type the following:

Var MyVar

function myFunction(p1, p2)
{   

MyVar = return p1 * p2;    // so this returns the product of p1 & p2 and sets MyVar to the result.
}
I would then store the result in a variable within the usual system and access it through something like System.CustomFunctions(MyVar)

Not really fussed what language we can directly write functions with, weather its JS, java or C++, whatever works for you guys but it'd be a handy feature to have.

 

Thanks.

  • Matt Tonkinson
  • Apr 12 2017
  • No status
  • Attach files
  • Darek M commented
    June 07, 2017 18:20

    I was going to suggest just that. It would need to be well thought out in terms of interactions with other objects, the programming language (I'd suggest JavaScript) etc. but for advanced creations this would be priceless.

    Written code functions that would accept arguments and return values is what I really miss in Construct.

  • Valera Popov commented
    June 14, 2017 09:33

    Can’t express enough how I support that!

    The creators of Construct say that you can do anything without code. And that’s true. But if you’re building something that’s a little bit more complex than a jumping sprite, it gets very inconvenient sometimes. It’s fascinating how easily and quickly you can make a working prototype that moves and interacts. But it always gets ugly when it comes to real game building routines.

    I’ve built several small but real games for money. For example, I’ve built this kinda game on Conctruct recently: https://classicreload.com/pipe-mania.html

    It works but the creation process was such a mess. It inevitably involved a 2-dimensional array that represented a gamefield and lots of lists storing states and possible transitions between the states. So it’s dozens of for-loops and array rearrangings. 

    Event-sheets work great for simple things but it’s a disaster when you’re trying to implement stuff like array routines. They are simply not designed for that. It's a mess of events, subevents and sub-subevents containing loops.

    It’s very hard to “read" this and it's even harder to find an error in it. Seriously, hours of painful debugging because I accidentally messed up CurValue and CurX in a for-loop.

    All of that could have been done using regular javascript in a shorter, simplier and clearer manner. 

    It’s hard to do this MVC paradigm with Construct because it’s poorly designed for M — model. And it will always be like that. Because there’s nothing more suitable for implementing models than a programming language.

     

    Yes, there are plugins for that.

    I’ve found sort of a solution. This plugin: https://www.scirra.com/forum/plugin-call-javascript_t64104?&hilit=call+javascript

    It lets you include a js-file in a project that eventually is being included in a game using <script src="…”> thing so it can contain global functions and objects that you can later call anywhere in a game.

    I’ve modyfied it and added handy actions to call javascript functions and pieces of javascript code. I can even compare returning values of those with variables from Construct. But I still have two problems:

    — It’s not so convenient to pass values between Construct and javascript. I can access Construct functions from javascript but I can’t access variables. So I have to do “var i="& Object.Value

    — It’s cool with a global js-file but It’s hard to edit javascript that is called in events. I have to write code in my SublimeText, then copy it and paste into a small parameter textbox when I call a plugin action.

     

    Construct is great! Everything else in it is totally designed for serious shit. And if you made this javascript thing at least a little bit more convenient, it would get Construct for a whole new level for me and I would not even need Unity or similar engines.

     

  • Guest commented
    May 27, 2018 19:17

    What @Valera Popov said. Please make it happen Scirra. Please allow people who want to code, to code.

  • Emmanuel Rubio commented
    July 02, 2018 13:15

    intresting since this will bring attention to proffesional programers. Just like Game Maker, their code lenguage is atractive to programmers just because they add code directly.