Huge frustration with Construct when picking objects

0 favourites
  • 15 posts
From the Asset Store
Casino? money? who knows? but the target is the same!
  • I think it time for Scirra to reconsider the whole structure of Construct engine regarding the picking instances mechanism. Construct is a game engine and the most important part in game development is accessing different objects and acting on them. In Construct you have to work 1 hour to create a full layout and 8 more hours trying to figure out what is going on and accessign objects doesnt work.

    Of course it is a depricaded issue that is still alive in this engine. Its not a bug... its the way Construct engine works.

    In my following example I have some buttons that I want to alter. They are all created on a different function (to keep my code clean). Guess what? I cannot do it...

    What is going to happen:

    - Of course Scirra team will reply telling me that this might be a bug on my code and I need to file the issue...

    - I will have to go there and fill a huge form based on some awkward template.

    - I will also need to upload my whole project file because Construct engine doesn't allow you to break your project in different files that you can export. Even if you could export parts of your event sheets... variables are hard-coded and they could not work on a template... So... there is no "uploading part of the project". Of course I cannot upload my project because it is not mine but it belong to the company that I work.

    - I will consume 4-5 hours to bypass this issue making my code more complex (breaking down into multiple events, actions, groups, functions)

    Dear Scirra... change the way object picking works... It doesn't! The worst part is not that it doesn't work all the time... the worst part is that it will stop working on a big project where there is complex event sheets... and no one will be there to fix it or help you.

    Here is the part of my code that doesn't work. And of course if you try to reproduce it just like this it will work. The issue is that it doesnt work on my code.

    PS 1. Before trying to convince me that there is something on my code that prevent this lines to work just keep in mind that I have checked my code over 100 times and there is nothing that could effect this. I am sure that the only thing that effects this is something under the hood of Construct engine.

    PS 2. I have tried to reset picking, picking all, picking family, changed what I change (not visibility but opacity or even pining to other object), put it outside function, inside other function, put wait 0 seconds and a couple of other things that made my frustration even bigger.

    PS 3. This is not the first time I face such an issue. My whole work on this game project goes like this: 1 hour of work + 8 hours trying to figure out whats going on with my object picking and something on my project doesnt work.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You neither need the for each nor the empty subevent for what you try to do. Either way it should work.

    Here is the part of my code that doesn't work. And of course if you try to reproduce it just like this it will work. The issue is that it doesnt work on my code.

    Post your code then, no way to help you if you don't post code. Also that sounds like an issue with your code, even if you don't want to hear it. Follow the steps on the bugreport form, delete stuff from your project, narrow it down.

  • usually there are two possibilities when something don't work:

    1. The user doesn't really understand how to set it up and how it works.

    2. The software doesn't work properly.

    Always verify number 1 deeply before going into number 2....

  • If I want to post the project file I will have to cut many parts... Construct is an engine that produces extremely hard-coded events. In order for me to cut all those parts to narrow it down, it will result in a so small project file that it will work.

    So you are telling me WackyToaster that ALL parts on your projects with object picking work like a charm?

    Lets see if its an issue of Construct or an issue of my project by showcasing this simple example:

    This object below is not referenced in the whole project at all.. except on a loop that it gets created 6 times...

    So the loop should iterate 6 times.. correct? Nope! It doesnt! The loop only counts 1 time.

  • This is not a bug that occurs on my code. Its how Construct works... It has vague object picking mechanism. I am not complaining about this line of code. I will find a way. The problem is that the whole object picking mechanism on Construct is far from solid. I am facing object picking issue constantly the last 2 months since my project started.

    On my example, there is nothing, but absolutely nothing that should cause this issue. Even if the parts from above my function do crazy stuff, the loop is a loop. The object counting is object counting. You cannot iterate 1 time when there are 6 objects (I can see those objects on debugger). The alert fires only one time.

  • The only solution (for one more time) is to place a wait 0 sec at start of the function. Of course this is possible on some parts of the code because wait skips the line and returns when the time has passed which causes many implementations to be completely non implementable...

    Construct did not care if I call that function on a completely (an other level) from the event that created those objects.. I still had to put a wait to gain access to these objects...

    For one more time... wasted time on trying to achieve a simple object picking stuff...

  • So... You're basically telling us that you can't send the file, that you can't show us anything, that if you remove things it will work and that the problem is Construct. What's the point of this post? Seems just a rant to me.

    Also, if when you remove stuff things work, you should definitely check the things you are removing as they might be the cause.

    Cheers!

  • In Construct you have to work 1 hour to create a full layout and 8 more hours trying to figure out what is going on

    Bah that's nothing....

    Sometimes i have had to stop development and have spent one week or more trying to figure out what dumb mistake i have made.

  • Construct has been around for years and by now I'm pretty confident in saying it's a robust, well-tested engine that has very few obvious bugs, and that applies particularly to the event system, since it's all code we control (vs. something like platform-specific code where issues come up due to changes in the underlying platform). Of course there are still bugs - all software has bugs - but usually they're pretty specific, or involve unusual edge cases.

    Having dealt with thousands of bug reports and forum posts over many years, generally I have to say it's very common that people jump to blaming Construct before properly establishing whether their events are set up properly. As part of this, the bug report guidelines are carefully crafted to ensure we don't get inundated in bug reports that are really just mistakes in people's projects (and yet, it's still common). If you can't reproduce the problem in a new empty project, it's a strong sign that you have gotten your events wrong somehow. Making complex event sheets is a form of programming, and programming is a difficult endeavour that is really hard to get right. This is why it's important to learn to structure your events well, and learn good diagnostic/debugging techniques, such as logging, using the debugger, and so on.

  • Picking is pretty consistent but the issue you are having has to do with when newly created objects are pickable.

    Elsewhere on the forum it’s discussed as newly created objects are pickable as normal on the next “top level event.”

    So you probably have an event setup similar to this:

    start of layout
    — repeat 3 times
    — — create sprite
    — for each sprite
    — — rotate sprite 45 degrees

    Function calls can be thought of as their events being run in place without anything picked. Here I just used a rotate action to illustrate.

    Anyways the effect of the above is only the already existing sprites get rotated, not the newly created ones.

    One fix could be to do this:

    start of layout
    — repeat 3 times
    — — create sprite
    
    Start of layout
    — for each sprite
    — — rotate sprite 45 degrees

    Which will rotate all the sprites.

    The short version of what’s going on is newly created objects are not pickable till another top level event (an event that isn’t a sub-event). That is other than the new object being picked in that event.

    Long version:

    construct.net/en/forum/construct-2/closed-bugs-22/picking-objects-not-work-129083

    Hope some of that helps.

  • When is an object pickable as RoJoHound points out is the center of most of my bugs in C2 and C3. If you use lots of functions (which most people tell you is a good programming practice) you have a tendency to shove created objects further down as you build functions that call functions and since you can't access a newly created abject except by "Pick by UID" or "last created" it can get pretty complicated.

    If you start putting wait 0 here and there because well--I don't know it makes it work--you are doomed. Yes this pickable thing is a feature of the construct methodology and it messes just about everyone up from time to time.

    There are a few things you can do to get around it:

    1) avoid creating objects you can put in the layout since they are pickable right away.

    2) keep a UID array of stuff you create and use pick by UID looping in the array. This seems like overkill but it will save you countless hours of debug time.

    There are many upsides to how C3 works, and I obviously love it--but it is clear that when an object becomes pickable is a source of programming problems.

    yours

    winkr7

  • You can use "Wait for previous actions to complete" before picking objects.

    And you can nest picking, it's reliable :

  • Also, if you have stuff you want to do to all objects when you create them, you could just add an On Create condition.

  • You can use "Wait for previous actions to complete" before picking objects.

    Nicolas Wak No, "Wait for previous actions" works only with asynchronous actions, which are marked with a clock icon. I don't think it will help with picking newly created objects.

  • "Wait for previous actions to complete" when there are no asynchronous actions works the same as "Wait 0 seconds", which waits until the end of the event sheet before resuming the rest of the actions. Since that happens to also be after the next top-level event, it also happens to ensure that all created objects are fully created. So it does actually work after "create object", and the description of the action fits better than "Wait 0 seconds".

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