Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Binding of Isaac type "synergies"

Discussion in 'General Discussion' started by Xenoun, Nov 2, 2015.

  1. Xenoun

    Xenoun

    Joined:
    Sep 2, 2015
    Posts:
    201
    I'm a huge fan of the Binding of Isaac games and now that I've been playing Afterbirth it got me to thinking about how they code their different item synergies.

    In general you can pick up an item that doubles your shots, then pick up one that makes them home in on enemies and then pick up another that makes them giant and suddenly you have giant double shots that home on enemies. This doesn't always happen though, some items simply aren't compatible with each other even if it seems like they should be. They updated some of these in the Afterbirth DLC and they now work.

    As I'm learning and have no idea what kind of code structure they'd use to do this I was wondering if anyone can provide an educated guess as to how they've probably gone about it. Unless you actually have researched/data mined it already and know how they did it, that'd be great too!
     
  2. 3agle

    3agle

    Joined:
    Jul 9, 2012
    Posts:
    508
    I think it's said in an interview somewhere that they most are manually coded and it's a very time-consuming process.

    I think it's in here:


    I don't have time to check it though.
     
    GamGode and Xenoun like this.
  3. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    You could think about it as there simply being a large combination of `features` that result in a long list of variations of different weapons. In terms of making the weapons work with these combinations, they probably just split out different aspects of the weapon to be handled by different code pieces, like how it moves, what it looks like, what size it is/sprite ti uses etc. It's sort of a procedural weapon system. Or it could simply be just a lot of weapons that are organized to give the impression that they are adjustable when really they're just pre-made configurations with a certain path to take between each one.
     
  4. Master-Frog

    Master-Frog

    Joined:
    Jun 22, 2015
    Posts:
    2,302
    It's a combination of a lot of things, try it yourself and build it up little by little. When you press space, emit a simple prefab. Then start programming in different properties like rate of fire, velocity, size of shot, etc. See how many properties you can come up with. Then experiment with combining them. It takes a while but it can have interesting and even unexpected results.
     
  5. Xenoun

    Xenoun

    Joined:
    Sep 2, 2015
    Posts:
    201
    So you think they've added more than the usual shot speed, rate of fire etc as variables to include more information about how it should move. If they could do that for all cases it sounds like the easiest way.

    As you said though if they're just pre-made configs that are used with combination x,y,z of items then that would be a massive amount of coding.

    When looking at something like the Tiny Planet item that makes your shots spiral outwards from the character if you then pick up Mom's Knife it shoots a knife out in a spiral, how far it goes depends on how long you held the fire button down and then it returns to the character along the same path. Seems like a significant change that wouldn't be able to be done through just normal variables.

    Maybe it's a combination of both.
     
  6. RockoDyne

    RockoDyne

    Joined:
    Apr 10, 2014
    Posts:
    2,234
    There are definitely some holes in it. It's more noticeable with the alternate projectile types. The beam types frequently don't combo with some items or have properties that are close, but not exactly like what the normal shot properties are like. So it wouldn't surprise me if a lot of it is hand coded.

    At the very least, it's more fleshed out than the material system was.
     
  7. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Sounds like a job for captain delegate.
     
    Kiwasi likes this.
  8. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    You have like a weapon class, a rocket class. Double shots, modify gun variable to fire 2 projectiles per shot. Homing modify the rocket variable and check the homing variable, double size increase scale of bullets. Spiral change rocket travel type variable, change tear projectile to knife, change firing mechanism to only fire once you release the mouse send in a scalar variable and multiply it by some distance. You just need to make your scripts configurable
     
  9. Master-Frog

    Master-Frog

    Joined:
    Jun 22, 2015
    Posts:
    2,302
    wut
     
  10. Master-Frog

    Master-Frog

    Joined:
    Jun 22, 2015
    Posts:
    2,302
    explain...?
     
  11. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    You have a weapon class and each += you subscribe to will add or remove features. Makes it really simple with an event based model.

    So you can add abilities to something without having to know about it.
     
    Xenoun, Kiwasi and Master-Frog like this.
  12. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    I haven't played the game. But based on the description I would use a chain system.

    The first component would generate base weapon data. This data would then be handed to each other component in order. Each component would modify the weapon before passing the data on.

    For a fully custom system you would simply build up a tech tree. That's a lot of coding, but it could be worth it as a central game feature.
     
    seukari and Xenoun like this.
  13. Xenoun

    Xenoun

    Joined:
    Sep 2, 2015
    Posts:
    201
    Thanks guys, I've got a better picture in my head of how it'd work now