Announcement: Be excellent to each other.


Caravel Forum : Caravel Boards : General : When will a gentryii straighten its chain?
New Topic New Poll Post Reply
Poster Message
Dragon Fogel
Level: Smitemaster
Rank Points: 2430
Registered: 06-21-2014
IP: Logged
icon When will a gentryii straighten its chain? (+8)  
So, in the process of trying to rework Entry Point's gentryii level, I have learned a distressing amount about how chains work.

Not the complex detail of chains that are moving, mind you. skell has already made a video about that and there are demonstration rooms in Gentryiification if you want to try to wrap your head around the details.

No, I'm talking about the situation where a gentryii isn't moving and its chain straightens up. This is a lot simpler in terms of the mechanics of how it straightens - the final chain will be as orthogonal as possible near the head, and every turn of waiting will move it slightly closer to this ideal if it hasn't already been reached. The exact calculations can be tricky depending on the shape of the chain, but this is still generally simpler to attempt to predict than trying to work out how a free-moving chain will act.

But the complicated part is figuring out the conditions under which this straightening happens in the first place, and that's what I've found myself diving into over the last few weeks. Luckily, I've come out the other side with what I believe to be a full understanding of these rules. So it only seems fair to share this terrifying knowledge with the community at large.

Condition 1: The gentryii head must not be able to move.

This is one of the simpler conditions. If the head can move, the gentryii will only move the parts of the chain that need to move. Any chain tile that can stay in place will do so.

Condition 2: The gentryii chain must be stuck on something.

It doesn't have to be caught on the very end of the gentryii - being caught in the middle works too. Another simple condition to understand.

These first two points were covered in Gentryiification, which was a big help in getting a basic understanding. But there are some more details I didn't work out just from that.

Condition 3: The gentryii must attempt to move in a direction opposed to where the first tile of its chain would be if it were already straightened.

The wording on that one might be a bit confusing, because I'm trying to cover three separate situations. Hopefully, explaining the situations separately will clarify things a bit.

Situation 1: The first tile of the gentryii's chain is orthogonal to the gentryii's head already. As an example, suppose the tile is north of the head and all other conditions for straightening are met.
In this case, if the gentryii tries to move southeast, southwest, or directly south, the chain will straighten. Otherwise, it won't.

Situation 2: This is a slight variation of Situation 1. In this case, the first tile is diagonal to the head, but there's an open tile next to it in the direction that the chain will straighten.
This is not treated any differently - it's the chain's destination that matters, rather than its current location. So if the destination is the north tile and the chain is northwest of the gentryii, the chain straightens if the gentryii tries to move southeast, southwest, or south.

Situation 3: Take Situation 2, and add an obstruction of any kind to the open tile. Now the first tile of the chain is diagonally adjacent to the head, but it cannot move. Again, as an example we'll say the chain is to the northwest.
In this case, the chain straightens if the gentryii tries to make any movement to either the south or east, including diagonals. So it can try to move NE, E, SE, S, or SW, and the chain will straighten as a result if the other conditions are met. If it tries to move N, NW, or W, nothing happens.

That took some explaining, but in the end it wasn't that complicated. There were just a few different cases to consider.

But the final condition took me some time to fully understand.

Condition 4: The chain must not have excess length.

Credit to Gentryiification for explaining the basics of this one to me - that hold describes the excess length as "slack". What it means is that the chain must not be longer than the minimum length it has to be in order for the endpoints to be where they are.

This is fairly simple to work out when the gentryii will straighten into one line, or an orthogonal line followed by a diagonal line.

But there's a more complicated situation I had to puzzle out on my own - the situation when a gentryii chain goes around an obstacle, something that came up in an Entry Point room that I initially found confusing.

After trying to make sense of it, and playing around a little, I think I understand the rules here clearly.

I define a "tension point" as a link in the chain that cannot move in the desired direction of straightening. This also includes the head, and the point where the chain is actually chained up - neither of those is moving, after all.

So, the full explanation for this condition is this: The distance between every consecutive pair of tension points must be the minimum length.

It may sound simple when I put it like that, but staring at gentryii chains is a confusing process and I had to do quite a bit of it to get this far.

I hope this was helpful, and look forward to someone on the devteam explaining which parts of this I got wrong.
01-31-2021 at 09:07 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
ErikH2000
Level: Legendary Smitemaster
Avatar
Rank Points: 2794
Registered: 02-04-2003
IP: Logged
icon Re: When will a gentryii straighten its chain? (0)  
Wow, that is complex. The source code is a little bit longer than your impressive explanation... https://github.com/CaravelGames/drod/blob/master/DRODLib/Gentryii.cpp

-Erik

____________________________
The Godkiller - Chapter 1 available now on Steam. It's a DROD-like puzzle adventure game.
dev journals | twitch stream | youtube archive (NSFW)
01-31-2021 at 10:08 PM
View Profile Send Email to User Show all user's posts This architect's holds Quote Reply
Dragon Fogel
Level: Smitemaster
Rank Points: 2430
Registered: 06-21-2014
IP: Logged
icon Re: When will a gentryii straighten its chain? (0)  
Quick addendum: when I say "try to move" in condition 3, that's not strictly true. It's based on the position of the gentryii's target, be that the player, a decoy, or a stalwart.

Specifically, if there's a brain and the gentryii has a pathmap that goes in the opposite direction of its chain, that isn't enough to get it to straighten. It only straightens if it has a target in the right position.

This is probably for the best because we definitely don't need gentryii chains to get even more confusing.
01-31-2021 at 11:39 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
New Topic New Poll Post Reply
Caravel Forum : Caravel Boards : General : When will a gentryii straighten its chain?
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.