robolab's Recent Forum Activity

  • After lots of hours, I found a thread with hints on how to work-around this frustrating issue.

    The problem could have been easily avoided if given a "Remove object" as oppose to "Destroy object"

  • Did anyone here figure this one out? I'm running into the same error. Only it's when I return to a layout with pre-laid out objects.

  • I have a game where you go into a blackhole to be sent to a random layout.

    However, right now, I only have it set to go to a specified layout, for testing purposes, but this doesn't work correctly.

    Layout 1 has a bunch of objects placed on the layers.

    On Layout 1, when I go into the blackhole,I go to a Menu Layout and choose a layout. If I choose a new layout such as Layout 2, it works fine. However, if I choose Layout 1, it gives me an error.

    Upon extensive testing, I removed every object from the pre-laid layout, and once I removed every single object except the portals, only then did it stop giving me the error. I decided that perhaps "creating" the objects through the system on Start of Layout would be the way to go to avoid this error.

    However, upon testing that idea, I tested it out by going through the portal and back to Layout 1, and it seems to give me that error again, usually around every 7 to 10 cycles.

    Here is the log:

    Debug4 is the test layout, and SPACETRAVEL is the "Menu" for selecting a layout to go to.

    Change layout signalled to Debug4
    Go to layout: SPACETRAVEL
    Change layout signalled to SPACETRAVEL
    Go to layout: Debug4
    Change layout signalled to Debug4
    Go to layout: SPACETRAVEL
    Change layout signalled to SPACETRAVEL
    Go to layout: Debug4
    Change layout signalled to Debug4
    Go to layout: SPACETRAVEL
    Change layout signalled to SPACETRAVEL
    Go to layout: Debug4
    Change layout signalled to Debug4
    
    Assertion failure: Drawing instance on wrong layer
    
    Stack trace: 
    Error
        at Error (native)
        at assert2 (http://localhost:50000/preview_prelude.js:16:10)
        at Layer.drawInstanceGL (http://localhost:50000/layout.js:2152:22)
        at Layer.drawGL (http://localhost:50000/layout.js:2091:9)
        at Layout.drawGL (http://localhost:50000/layout.js:637:7)
        at Runtime.drawGL (http://localhost:50000/preview.js:2531:23)
        at Runtime.tick (http://localhost:50000/preview.js:2070:10)
        at tickFunc (http://localhost:50000/preview.js:623:47)
    [/code:30529cc7]
    
    Once I press okay on the error, the game has less FPS and some objects seem to be "stuck" and inactive.
    Any ideas?
  • Was it that simple, jeez. No wonder why nothing came up in my searches, it's not even a problem.

    Thanks a lot! Here I am trying to come up with a math problem to use in the Pick by Comparison...

  • cool, sounds like an interesting game...

    Thanks! It's fun to work on, so far.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I did some googling and couldn't find anything. I'm a huge fan of figuring things out on my own, but unfortunately I've been thinking about this for quite some time and can't figure it out.

    I want to pick within the conditions an object that is closest to another object.

    For example, I have automatic fighter ships that fly around and shoot stuff with limited ammo. When the Ammo is depleted, they are sent to the command center to replenish. This works fine.

    However, when there are two command centers for them, I'd rather make them a bit smarter. I want each individual ammo-depleted fighter to decide which command center is closest to them and pick it. The actions are taken care of. I just can't figure out how to make a unit Pick an object based on distance.

  • I found the main problem. Thanks for the ideas everyone.

    I looked at my conditions and realized the ordering of the conditions could be better, and also I had an "Every 1.0 seconds" condition in there too. That explains the delay in commands.

    In case someone googles this issue, here is what I find to be an ideal solution:

    Conditions:

    Miner = ReturnPayload

    Pick Random Miner

    This makes it so only objects taken with your first condition filtered out, resulting in choosing only ONE, instead of all.

  • the IIDs are just the objects number sequentially. 0-to how many you have..

    the UID is the unique number of the object in the entire game..

    I know that, but how would I make the game pick an object without having to create 200+ subevents for every single IID? It seems wrong.

  • pick random will only pick 1 object. you can combine it with a compare using the Object event itself... no need to use the System event again.

    I've been using the pick random combined with the object event, but it doesn't seem to be the optimal way to do it. For example, if I have 40 miners doing various tasks, and lets say 23 of them are done mining and set to "Return payload".

    If i have

    Miner Instance Variable =Return Payload

    Pick Random Miner

    It WILL do everything as intended, just not as fluidly. Some miners may sit there waiting for a command because the game engine hasn't randomly picked it yet.

  • Forgive me if I'm misunderstanding, but I won't know what their IID is. The units are automatically spawned based on the environment. In game 1 there may be 20 miners, game 2 there may be 3 miners spawned, game 3 might have 45 miners.

    I would have to make a separate sub-event for the Pick by IID which would mean to be safe I'd need to make over 200+ sub-events for each IID? Or am I missing something?

    Thanks!

  • Hi,

    I'd like to use "pick by comparison" but not pick ALL instances that match the comparison, because I don't want each of the picks to do the same thing. I want to pick all of the matching picks but have them all different assignments.

    I tried the "Pick by Comparison" combined with a "Pick a random instance" but this seems to lead to crashes once in a while, I think. It doesn't feel like the best option.

    Anyone else have any ideas?

    Extra info: I have randomly generated "ores" that Mining ships are automatically attracted to. The way I have it set up, if a Mining ship is not currently in the process of mining, moving to mines, or returning a payload, it "searches" for available ores and if it finds one, it sets a course and moves towards it. I don't want all Miners to choose the same ore, I want each Miner to set a course to a different ore. I've gotten this to work with my set up described above, but it doesn't feel optimal. The Miners often have delayed reactions (with the nature of choosing "random" ships of the compared picks to give commands to) and sometimes the game crashes.

  • That was actually pretty fun. I used the arrow keys.

robolab's avatar

robolab

Member since 6 Feb, 2015

None one is following robolab yet!

Trophy Case

  • 9-Year Club
  • Email Verified

Progress

10/44
How to earn trophies