1. If you're looking for help-related things (for example, the key rebinding tutorial), please check the FAQ and Q&A forum! A lot of the stickies from this forum have been moved there to clean up space.
    Dismiss Notice

Threshold for Infinity

Discussion in 'Starbound Discussion' started by fafeman, Jul 11, 2014.

  1. renojonathanr

    renojonathanr Scruffy Nerf-Herder

    Pretty interesting, I daresay. But it's not necessary. Why stack up finite values when you can just use infinity?
     
  2. renojonathanr

    renojonathanr Scruffy Nerf-Herder

    Not necessarily. Put on your armour and then commit suicide (I do it by taking fall damage). Voilá! I have infinite health when I respawn! Oh, and infinite energy seems to be applied immediately.
     
  3. Will Liferider

    Will Liferider Ketchup Robot

    I'm over here experimenting with different colors of dirt, and these guys are testing the limits of infinity

    Well done
     
  4. renojonathanr

    renojonathanr Scruffy Nerf-Herder

    :rofl:
    How funny, Will Liferider.
     
  5. Wourghk

    Wourghk Void-Bound Voyager

    Fafeman, the limit should technically be 3.4e+38, the max size of a standard 4-byte floating point number in C++.

    If you go above that, you're not actually reaching any definition of 'infinity', but rather going outside of the float's range. What's likely happening is that the value is wrapping around to negatives, starting at the lowest possible value that a float can be. I imagine that Starbound is not designed to handle negative numbers on item attributes, and that's probably what's causing the problems you describe upon crossing the threshold.
     
    Last edited: Jul 27, 2014
  6. renojonathanr

    renojonathanr Scruffy Nerf-Herder

    Well, fafeman, even if an infinite energy bar is full, it will still appear empty. Same with health. Dying with infinite armour equipped will set your health and energy to max levels, that is, infinity out of infinity.
     
  7. Wourghk

    Wourghk Void-Bound Voyager

    That's pretty interesting in theory, but it's not how these values should work in reality.

    In all likelihood, the status bar appears empty because the value it represents ended up negative. It's possible that the UI displays a bar-fill value of 0 instead of the actual value for the sake of cleanliness (because it's sloppy not to have a floor and ceiling on such graphical representations) and, for whatever reason, there's nothing that can trigger a death event for a character with a negative value for health.

    However, if the programmer of this system used an unsigned float or some other type instead, and we're not seeing a 2's complement "wrap around" here, then that heads into the bogeyman territory of out-of-range garbage values (and any decently coded software should throw an exception and either quit or reset the value instead of just letting it go on). It's still not anything to do with infinity, though.

    Then again, an interesting take on "infinity" would be if using these out-of-range values actually caused a never-ending loop of exceptions (e.g. throwing out-of-range, catching and resetting to last known supposedly valid value, which would be invalid and throw the exception again), and that would explain the lag... and should be very embarrassing for the programmer.
     
    Last edited: Jul 30, 2014
  8. renojonathanr

    renojonathanr Scruffy Nerf-Herder

    Hmm. But if I actually gave myself negative health, I would die as soon as I spawn.
     
  9. MysticMalevolence

    MysticMalevolence Oxygen Tank

    Or...
    Give people armor on multiplayer that kills them instantly! :mwahaha:
     
    Finn Learson likes this.

Share This Page