CO2 - Gas or Powder?

  • Sourec
    11th Jun 2015 Member 0 Permalink

    I encountered a minor simulation oddity that shouldn't really happen. CO2 is a gas, right? It shows up in the gas menu and behaves like a gas, albeit a heavy one. Then why does it fall through powder walls?

     

     

    Just a little thing I noticed.

     

    EDIT: Users jasiu2002 and Qwert_Yuiop discovered that fire and smoke do it too, which is hilarious.

     

    EDIT 2: Okay, there's been some speculation on the save comments about the cause of this, so I might as well explain it here where it'll be a lot easier. Here's some code:

     

    Collision logic:

    if (bmap[ny/CELL][nx/CELL]==WL_ALLOWSOLID && elements[pt].Falldown!=1)

    //collide

     

    Placement logic:

    else if (wall == WL_ALLOWSOLID && elements[type].Falldown!=1)

    //don't allow placement

     

    This is the code in Simulation.cpp, from lines 1862 and 2068, respectively. What it does is check what kind of wall is at a point (the wall == WL_ALLOWSOLID or bmap[ny/CELL][nx/CELL] == WL_ALLOWSOLID bits), then determine the kind of particle passing through (the elements[type].Falldown!=1 bit). If both are true, this interaction is flagged as being collision or invalid placement.

     

    What this means is that TPT isn't checking the state of a particle (which does appear to be defined separate from the falldown value), just the falldown value. Curiously, SMKE, FIRE, and CO2 all have a falldown value of 1, which seems to have no effect (I tested it). Since the if statement checks that the falldown value is NOT equal to 1, when CO2, FIRE, or SMKE pass through, that little not-equal-to statement doesn't evaluate to true, meaning that a collision or invalid placement is not registered.

    Edited 5 times by Sourec. Last: 11th Jun 2015
  • Catelite
    11th Jun 2015 Former Staff 0 Permalink
    As amazing as it is that you've done all the math to check out the legitimacy of this, you -do- know that most of these reactions are likely either intended to work this way, or simply were never 'fixed' for legacy's sake? XD

    Smoke and CO2 are the same particle, really. I don't recall how they ended up with different IDs, but people in the past were really pandering for basic elemental names for new particles (for some odd reason) and.. got them.

    * Actually, CO2 and SMKE are different simply because one is a helper element for Fire, and the other is entirely alone. They have different physical behaviors, but they -do- really represent the same.
    Edited once by Catelite. Last: 11th Jun 2015
  • ChargedCreeper
    12th Jun 2015 Member 0 Permalink

    Catelite:

    As amazing as it is that you've done all the math to check out the legitimacy of this, you -do- know that most of these reactions are likely either intended to work this way, or simply were never 'fixed' for legacy's sake? XD

    Smoke and CO2 are the same particle, really. I don't recall how they ended up with different IDs, but people in the past were really pandering for basic elemental names for new particles (for some odd reason) and.. got them.

    * Actually, CO2 and SMKE are different simply because one is a helper element for Fire, and the other is entirely alone. They have different physical behaviors, but they -do- really represent the same.

     

    Well I'm glad the two are separate because CO2 doesnt spawn at as high of a temp as smoke does. Personally I think smoke being a variation of fire would make more sense than of CO2.

  • Catelite
    12th Jun 2015 Former Staff 0 Permalink
    Retrospectively, yeah. IMO it would have made better aesthetic sense to have just stuck a second particle state on CO2 to give it all of SMKE's properties, but I'm not really sure what kind of performance impact that would have.
  • jacob1
    12th Jun 2015 Developer 0 Permalink
    For anyone wondering, this bug is fixed for the next version. FIRE, SMKE, and CO2 won't go through powder walls any more.

    @Catelite (View Post)
    SMKE and CO2 are very different things. I wouldn't doubt that CO2's properties were copy and pasted from SMKE (I mean, they both had this bug), but they do very different things and move in different ways. FIRE and SMKE move in exactly the same way though (their movement properties are exactly the same)

    @Catelite (View Post)
    If anything I think it would make more sense to have SMKE be another state of FIRE because they move in the same way and their properties are exactly the same. It would be very hard to combine SMKE and CO2 due to all the differences in properties and reactions.
  • Catelite
    12th Jun 2015 Former Staff 0 Permalink
    ... Oh yeah.

    Also, this bug being fixed will make it a lot harder to make simple wall filters that spread fire and plasma apart. :P

    I haven't run into any odd situations where keeping fire inside of gas walls was an impediment, but I'm hazarding someone has.
  • jacob1
    12th Jun 2015 Developer 0 Permalink
    @Catelite (View Post)
    ): maybe someone will find a way if they still need to do that

    I think very few people use walls these days, which is one reason I merged in @Sourec 's fix
  • Factorial
    12th Jun 2015 Banned 0 Permalink
    This post is hidden because the user is banned