Obligatory GitHub repository link.

I want to recreate the “Nemesis System” from Shadow of Mordor.

Well, mostly.

Several weeks ago, I started coding my version of the Nemesis System, which I was making more abstract and more generic so that I could put things in the system other than orcs.

It was my hope that I could create a hierarchy system that would accept hierarchies, so that like the backstabbing orcs in the Nemesis system, my sub-hierarchies might plot and scheme and act against one another.

I don’t know what my problem was, but for the last two weeks I’ve been completely stuck on what I hoped to do with Java’s Generics. I had a breakthrough this morning for reasons that I don’t really understand. Then I hit another snag.

As I’ve genericized my hierarchies, they don’t actually care what goes into them right now. I mean, if I put goblins or ogres or characters in them… they just regard the power level and rank… and that’s about it. I don’t have unique behavior for any of them.

Which helped me to realize that in the process of making this generic hierarchy, I’m actually working toward discovering methods that will go in a hierarchy INTERFACE… what I want is for hierarchies to be able to interact with one another… not be the SAME.

Plus, I was envisioning different sizes and shapes of hierarchies. I have a lot of ideas.

Remember, years ago when I was talking about affiliations from the 3e Player’s Handbook 2? Well, now I can code my factions how I like, and I intend to make them robust and interesting… as soon as I have them working.

I’ve actually made pretty good progress!

Originally I was stressing over whether to make a hierarchy a Set or a List, or some weird hybrid of the two. I wrote at least two separate implementations but didn’t get past the “add” process. This morning I wrote (more or less from scratch) a new version that is… better.

I realized this morning that it didn’t matter specifically HOW I stored the members of my hierarchy, only that I wrapped them in a useful class that I could use for comparisons. I referenced the Wikipedia article on hierarchies for some useful tips.

Individual members of a “Ladder” currently have the following attributes:
* Age (how many turns since they were added)
* Rank (where they are in the hierarchy)
* Power (a dice roll modifier for advancement)
* TurnsSinceLastAction (placeholder for determining priority in action selection)

So far I’ve finished basic “adding” to the Ladder so that once it’s full (default size is 21: 1, 2, 3, 4, 5, 6 pyramid-shaped), new additions must challenge the lowest-ranking members for a position. There are a number of modifiers.

A basic challenge for dominance is d20 + power. If a challenger or defender is “unknown,” they receive a penalty to the roll; basically they roll twice and take the lesser of two rolls. This gives a distinct advantage to creatures or characters the players already know.

I also fixed my “contains” method to actually check for the right information. It was a little embarrassing how it… totally didn’t work before. But I digress.

Once I finish this generic Ladder, I will probably create a new interface based on the methods I came up for it. I dunno, I might just call it a Ladder interface, because calling things a Hierarchy is kind of annoying.

My eventual goal is of course to implement a bunch of different versions of the hierarchy, and some interesting functions for them. One thing I’m really looking forward to working out is a hierarchy’s “schism,” “power vacuum,” and “collapse” functions.

When you kill the leader of a hierarchy, I want it to try and fill the position with a Charismatic candidate. If the conditions are right (or wrong, depending on your point of view), other changes to its structure will cause the hierarchy to divide and create new, smaller hierarchies.

Of course, killing off enough of its membership should cause a total collapse of the structure. My hope is that by making these functions abstract enough, they’ll capture some fun, pseudo-realistic behavior simply by existing and interacting.

As always, you can check out my progress on the GitHub page.