May 22 - Omni update

Discussion in 'Dev Blog' started by OmnipotentEntity, May 22, 2014.

  1. againey

    againey Void-Bound Voyager

    I recently had similar troubles with C++ and integer math. C++ platforms generally round toward zero when doing an integer division, and I believe it's now part of the standard (and has been for C for a while). This isn't always what is desired, especially for negatives as it suddenly goes from always rounding down to always rounding up. If you ever need to do integer divisions and want to always round down (toward negative infinity), up (toward positive infinity), round away from zero, or round n.5 to the nearest even (to avoid bias), then check out my blog post that offers functions for all of those operations: http://experilous.com/1/blog/post/the-trickiness-of-integer-division.

    It's not particularly pretty, but it avoids branches which could matter in a hefty simulation situation. Though I never profiled it or examined the generated assembly, so that's a theoretical quality.
     
    Last edited: May 23, 2014
  2. Mackinz

    Mackinz The Waste of Time

    What does mean? Anyone?
     
  3. zhuzhenyan

    zhuzhenyan Master Chief

    um... just something i thought of, might not be reading this, but i got this idea right now kind of. ever play borderlands 2? Yes... I'm thnking of something like erdium, but not like borderlands 2, when it upgrades ur ammo and such, but you can choose to make it upgrade ur inventory, but back to my thought. Something like that, i dont know how u would get it. Maybe mining, fighting, trading, whatever, but i noticed this in the game. The Glitch race has a farm, "a farm?" you may ask, but its a robot, wtf. So i was thinking that at this place, you could sell this "erdium" or special currency to them, and they do something for you. What i thought is like weapon mods and weapon upgrades, in case you cant find ur next tier. Like if u really, really, REALLY like your weapon, you can upgrade it for a price of this special currency or if you want to upgrade with a flashlight or laser sight, heck, even make a brand new weapon! (for a high price i suppose) so ya, i dont no if u see this, but if i see an post like this, ill send it again, just so u got it :) love the game
     
  4. zhuzhenyan

    zhuzhenyan Master Chief

    oh ya, btw, its glitch run, thats why i said the farm thing
     
  5. Piccolo

    Piccolo Guest

    You know you can edit posts, right? Also, I don't think this ides quite fits into the game in the way you've described it.
     
  6. zhuzhenyan

    zhuzhenyan Master Chief

    i no, just forgot and them remembered when i hit reply, and y do u think it doesn't really fit
     
  7. OmnipotentEntity

    OmnipotentEntity Code Monkey Forum Administrator

    I means that in the item class there used to be a function called fuelAmount

    Why does a general item need such a class? The answer is it doesn't. So I removed it. Items store information in parameters that are accessible, which means that you can access a parameter named "fuelAmount" in a different fashion, and have it serve the same function but without an explicit function just for it and nothing else.

    It's like, let's say you have a kitchen counter, and on this kitchen counter you can do many different tasks, such as: chop vegetables, store plasticwear, boil water in an electric tea kettle, etc. For all of these things in our hypothetical scenario, you'd access them by one way: setting things that do stuff on the counter.

    But let's say that for some reason, you had an apple peeling lathe on your kitchen counter, and it was permanently affixed right to the center of it for no good reason. Sure it's convenient to use if you want to peel an apple, but why?

    fuelAmount was the apple peeler, so I removed it.
     
    Boston, Kawa, Mackinz and 1 other person like this.
  8. LongChan

    LongChan Cosmic Narwhal

    So, does that mean that fuelAmount is a static attribute now?
     
  9. Piccolo

    Piccolo Guest

    Well, it's very vague. But beyond that, why do we need another currency, and why would only Glitches perform the tasks you listed and why would they want this other currency? Plus, the Glitch lore is already set out, how would you explain it?
     
    Last edited by a moderator: May 23, 2014
    Zael likes this.
  10. zhuzhenyan

    zhuzhenyan Master Chief

    okay, dude, it was idea, if they dont want it, they dont want it. It's their choice, not your's
     
  11. Piccolo

    Piccolo Guest

    Lol, you posted the idea in the public forum, on a news post instead of the suggestions forum. You should have had *some* expectation that people would read and maybe comment on it. So I did and you asked why I didn't think it would fit and so i answered your question, never claimed it was my decision.
     
    Last edited by a moderator: May 23, 2014
    Madzai, Zael and IvoryOwl like this.
  12. Tchud1

    Tchud1 Scruffy Nerf-Herder

    Oh, wow. These posts should shut the trolls up... Good job, guys!!
     
    Fluffy-Bunny likes this.
  13. Andrey_P_P

    Andrey_P_P Tentacle Wrangler

    what about case a=1 and b=-1 ?

    Code:
    Int maxInt;
      if ((a < 0) != (b < 0)) {
        maxInt = std::numeric_limits<Int>::min();
      } else {
        maxInt = std::numeric_limits<Int>::max();
      }
    
      if (abs(maxInt / a) < abs(b))
        return maxInt;
    
      return a*b;
    
    maxInt = std::numeric_limits<Int>::min();

    and we calculate abs(std::numeric_limits<Int>::min() / 1) which wrong because for example 4 byte int INT_MAX=2147483647 and INT_MIN=–2147483648 -> overflow happening while calculating abs(–2147483648).
    abs(INT_MIN)=INT_MIN in MSVC -> function return std::numeric_limits<Int>::min().
    Even if this somewhat work for now it's gonna cause bugs in future for sure (porting, using different compilers, etc)

    tbh i think it's better use exceptions for such arithmetic.
     
    Im New Go Easy likes this.
  14. Disco2

    Disco2 Existential Complex

    Great job guys, keep the work up!
     
  15. LCinn

    LCinn Void-Bound Voyager

    Fun to see some code, thanks for sharing!
     
  16. ill just... go and cry in a corner now... due to my inability to understand coding :(
     
  17. ZoraZ

    ZoraZ Title Not Found

    I love to read these daily update even I have no idea what I'm reading
     
  18. Fireball14

    Fireball14 Void-Bound Voyager

    More likely it has been moved to child class.
     
  19. Kawa

    Kawa Tiy's Beard

    I understood it as "it was item.fuelAmount(), now it's item.getParameter("fuelAmount")".
     
  20. IvoryOwl

    IvoryOwl Pangalactic Porcupine

    90% of the people in this thread: "What did he just say? Oh well, I'll get along with it. GOOD WORK!"
    I also find it funny how those who knew a thing or two about coding instantly jumped on it to see if they could find a problem with it, just because Omni left it in the open that there could still be a problem in it, despite his best to create a "bulletproof" code. What is it that mere players / fans could find that a professional can't? But oh well, maybe we'll have a "lucky" one among us who'll get praised for it and get a boost increase of 20% to his or her ego :p
     
    Last edited: May 23, 2014
    Kawa likes this.

Share This Page