Binding of Isaac type "synergies"

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!

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.

2 Likes

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.

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.

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.

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.

Sounds like a job for captain delegate.

1 Like

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

wut

explain…?

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.

3 Likes

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.

2 Likes

Thanks guys, I’ve got a better picture in my head of how it’d work now