Patashu's Forum Posts

  • 4 posts
  • Thanks ramones! Your posts helped me a lot to understand how C2 works.

    In a perverse way it's beautiful that the code attempted to be written was fundamentally at odds with how C2 picking works in two completely different ways. XD

  • I guess the issue is the picking.

    created instances can't be picked untill the next top level event, if I remember correctly

    That contradicts this:

    If I go back to the original code and change WallBlueprint.NewWall=0 to =1 in the first pick, it correctly picks newly created RoomBlueprint and WallBlueprint pairs, detects that it's overlapping itself and destroys it. So I am definitely picking newly created instances there without waiting for a new top level event to occur first.

    Similarly:

    In the second attempt I posted in the reply, if I set NewWall = 0 to NewWall = 1, it picks the new RoomBlueprint and WallBlueprint, detects that it's overlapping and destroys it, also resulting in new rooms in the same fashion.

    So the ONLY combination that doesn't work is RoomBlueprint being new and WallBlueprint being anything but new. In these cases it NEVER EVER detects the overlap even when it's really obvious, and all rooms are kept alive. And I want to know why these cases are different, because right now I am missing some fundamental knowledge about how C2 works that stops me from seeing this, and it will drive me nuts until I know it.

  • I'm not sure why you are picking the wallblueprint at all..

    wouldn't an "is overlapping wallblueprint" with the condition wallblueprint.newwall = 0 do the trick?

    Good idea, but I tried this and it's also doing nothing:

    Everything gets set non-new but nothing gets destroyed for overlapping, ever.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • (I don't have enough rep to link my .capx yet. I linked to it from the imgur image instead, so you can get it from there.)

    The dungeon generation algorithm is intended to work like this:

    1) 200 times, generate a new RoomBlueprint. A RoomBlueprint is 128 pixels (two tiles in every direction) larger than the WallBlueprint which represents the room itself, because we want each room to be surrounded by some hallway tiles later. It's OK for hallways to overlap, but not for a room to jut into a hallway (and force it to be narrower than two tiles).

    2) For each new room we make, we pick the RoomBlueprint (the one that is new) and all other WallBlueprints (ones that aren't new).

    3) If our picked RoomBlueprint overlaps any other WallBlueprint or is outside the layout boundaries, then we REJECT and delete it.

    4) Otherwise, we ACCEPT it and set it to no longer being new (and also do a pick all/pick evaluate so that we can select the new WallBlueprint and delete it)

    However, I can't figure this out - The double pick evaluate never runs its sub events, ever, no matter what you try. Notably, if I set the Pick WallBlueprint by evaluating WallBlueprint.NewWall = 0 to = 1 instead, then it immediately works (and of course destroys every new room created, because it's destroyed by the own WallBlueprint it carries) - but this isn't useful for obvious reasons.

    One idea I had was 'maybe if one of the pick evaluates returns an empty pick, it prevents subevents from running'. So I put in an Else event after the double pick evaluate so that the very first room can be set non-new, and then maybe the second room on will have non-new WallBlueprints to compare to so the pick will be non-empty - no luck. It still doesn't run, ever. So that idea was wrong.

    We are going insane. Please help at once. (What I REALLY want to know is why the double pick evaluate never runs as written - because it means there is something I fundamentally don't understand, that I need to learn for future C2 writing.)

  • 4 posts