To Craft a Sim – Part 3

In this series of posts, I’m talking about putting together a simulation I’ve built called CHsim. It’s designed to simulate the way Chain Heal will behave in Warlords of Draenor – including interactions with player positioning, talents, incoming damage, Riptide, and Mastery bonuses.

My first post in this series discussed why I’m developing CHsim, and I left off by pointing out some good reasons why I’m not using SimCraft to achieve my goals. The second post talked about raid positioning and how I’ve modelled a “realistic” raid. This post discusses the way I’m making Chain Heal bounce from person to person, and what that means for High Tide modelling.

Bouncy, Bouncy!

Chain Heal is and always has been unique in WoW because of its fantastic “bouncing” mechanism; it heals a player and then moves onto another injured random player within 12.5yds. That’s what makes it such an interesting (and difficult, sometimes) thing to study. With that in mind, it’s crucial to make an accurate and efficient recreation of Chain Heal’s behaviour in a simulation like this one.

So, what does it take to replicated Chain Heal’s behaviour? In essence, you need two things;

  1. A table of data telling you how far every player is from every other player,
  2. An algorithm which steps through the players one by one and crosses them off a list.

The second component relies heavily on the first, so let’s cover that first. When player positions are generated, the data is generated in x-y format (which you could literally plot on a graph like the one below.

The annoying one off to the left is a Hunter.

The annoying one off to the left is a Hunter.

However, while that’s lovely for looking at it’s not useful until it’s converted into a table of distances between players. To get that, you just have to go to each player and calculate how far away every other player is from them; repeat for all players. Since we’ve got a nice x-y format, you can calculate the total distance using Pythagoras’ Theorem;


Having run the calculation for every player, you make the table; the calculations for Player 1 go in Column 1, for Player 2 in Column 2, and so on. That gives you a table of data where the diagonal elements (Row 1 Column 1, Row 2 Column 2, etc…) are zero! That’s because Player 1 cannot be any distance from themselves, and the same is true for Player 2, and so on.

Table of distances for a 20-player raid. The elements at (1,1), (2,2) etc are "diagonal" elements, and are always zero.

Table of distances for a 20-player raid. The elements at (1,1), (2,2) etc are “diagonal” elements, and are always zero.

Observant people might notice that the table I show above is in fact symmetrical – if you reflect the table in the diagonal axis (this is technically known as transposing), the result is the same. This is also true by definition; if Player 1 is 12yds away from Player 3, then if you go from Player 3 to Player 1, you must also get a distance of 12yds!

So, how do we use this?

A rough algorithm for how to use this information might go as follows;

  1. Start with your target.
  2. Find all players who are within Chain Heal’s jump range (12.5yds) of the target.
  3. Eliminate from the list all those who have already been healed by Chain Heal.
  4. Pick at random another target to heal.
  5. Jump to the new target, and start from step (1) unless this is the 3rd time you’ve been here.

Of course, you can look in your data table to find everyone in range for Step (2). I coded a method which emulates this algorithm. It does take advantage of some of Matlab’s more satisfying features to make Steps (2) and (3) much faster and simpler, but technical details aren’t exactly important here.

The resulting plots look damn cool;

In the colour of Deluge especially for Dayani.

In the colour of Deluge especially for Dayani.


It looks like I’m running out of room, so to avoid putting you to sleep I’ll leave High Tide interactions until tomorrow’s post. Tune in to see whether it works! (Spoiler: it works).

Have you ever made a simulation? Do you have some cool ideas for features I could implement? Let me know in the comments and I’ll credit you if your idea is implemented!


About stoove

A physicist, researcher, and gamesman. Likes to think about the mathematics and mechanics behind all sorts of different things, and writing up the thoughts for you to read. A competent programmer, enjoys public speaking and mechanical keyboards. Has opinions which might even change from time to time.
This entry was posted in Alpha/Beta News, Maths, World of Warcraft and tagged , , , , , , , , , , , , , , , , . Bookmark the permalink.

7 Responses to To Craft a Sim – Part 3

  1. hamsda says:

    I always wondered about one thing in regards to Chain Heal and Cascade (since those are the only two spells with this kind of behaviour I think):
    Does the spell only try to maximise its next step in the loop or try to maximise the whole process?
    To be a bit more clear, I should probably explain a bit what I mean. For CH say you have 1 person that is a little off to the side, not standing in healing ground effects and therefore with somewhat lower health. Even more off to the side is another player, also with less health than the rest of the raid. The raid itself is taking moderate damage so CH wont be fully effective on everyone but also not overheal for too much. The question now is: will CH be greedy and go for the lowest target for each jump to maximise the potential of the jump, meaning it will jump to the 2 players off to the side and not find a way back (healing for 2*X), or maximise its total output by just jumping in the raid and getting all bounces off (healing for 3*0.75*X)?
    I can imagine that CH maximises its total output because the jumps are instantaneous, but for Cascade with it’s slow travel time I’m not sure… I’m playing priest myself and for the few encounters I use Cascade I think that some Cascade bounces jump to “dead ends” and therefore can waste a lot of potential.
    Do you know how CH behaves in this scenario or if anyone has tested it? It might seem kind of a moot point with all those heals becoming “dumb” in WoD and just jumping to any target, but will they be at least smart enough to get all bounces off? Did you handle this situation specifically in your CHsim or are there situations where you don’t get all bounces because of player positioning (if the raid is more spread/there are some heavy outliers)?

    Interesting work, eagerly awaiting the rest of the series! 🙂

    • stoove says:

      I understand that on Live, Chain Heal only maximizes the next step in the process. However, it also (reportedly) will jump to 100% characters if it has bounces left over and no other targets to heal. I definitely _does_ jump to dead ends, as any experienced Resto player will know and hate.

      I don’t expect this to change in WoD and so I haven’t programmed CHsim to do that (though it’s possible should the need arise). Yes, Chain Heal not getting its maximum possible is definitely something you see sometimes in CHsim (and I think this reflects a real raid nicely).

      Another thing to note is that a spell which automatically maximizes _total_ healing (while being restricted like Chain Heal) would need to assess all of the possible jump paths before it chose who to heal – in a 25 player raid that is a non-trivial task to do on-the-fly. I would imagine that’s beyond even what Blizzard are capable of making fast/efficient. Unconstrained heals (like Cascade for e.g.) don’t have this problem because there is no chaining effect. In other words, I wouldn’t expect Chain Heal to ever have behaviour which guaranteed a full number of jumps on every cast.

      That’s really what’s interesting about Chain Heal though; its restrictions make it difficult to predict and such a good challenge for theorycrafters 🙂

      • hamsda says:

        Thanks for the reply!
        That’s pretty much what I assumed. And I am aware of the fact how inefficient a “predetermined” CH would be (I am a programmer), but I am not sure if it would be beyond Blizzards server capabilities.
        But I have to make one correction: Cascade is the only other heal that is not unconstrained in terms of targets (at least that I can think of), because it cannot heal the same target twice. Given its much larger range in comparison to CH it is rarely a problem, but you confirmed my assumption that there are times during fights like Immerseus where Cascade is just plain stupid already 😦

    • stoove says:

      Thanks for the compliment! I hope that the results will be equally interesting ^__^

  2. Pingback: WoDsplosion! | UNconstant

  3. Pingback: To Craft a Sim – Part 5 | UNconstant

  4. Pingback: To cast, perchance to Chain (Heal) | UNconstant

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s