Announcement: Be excellent to each other.


Caravel Forum : DROD Boards : Bugs : Gamestate Changes from Clone Switching
New Topic New Poll Post Reply
Poster Message
TFMurphy
Level: Smitemaster
Rank Points: 3118
Registered: 06-11-2007
IP: Logged
icon Gamestate Changes from Clone Switching (+3)  
Switching clones is not as safe or as without consequence as it should be. There are a number of things that happen simply from changing clones, even if you switch back to the clone you had at the start of the turn. Here's three events in particular I've found.

1. Switching with a clone swaps the position of the player and the clone. This necessarily changes the movement order of the clones, since your 'old' position will take the movement order of the clone you displaced. If you then switch with another clone and then back to your old position, you will have swapped the movement order of those two clones.

Clone Movement Order is important for character scripts that use "Move to Double" and for priority of sword orientations for Aumtlich Gaze reflection. (Also, this means that some movement order changes are impossible to do without using the mouse, since Tab will only cycle through the placed clones in a specific order.)

2. Clone switching causes bridges to fall immediately. On Turn 0, this causes bridge graphics to not be updated (though you still see the falling effect), and any critical hero on the bridge will be killed, causing an assertion.

3. Clone switching causes Aumtlich Gazes to be recalculated. Again, this can cause things to be frozen on Turn 0 when they normally would not be.

A lot of these are Turn 0 problems, which isn't too difficult to fix, but I'm not entirely sure where the best place to handle this would be. Not sure why clone switching needs to run a ProcessTurn at all, since all the stuff it does should either not happen, or should've happened at the end of the last turn.

The movement order thing is finicky, but it's not the only thing that has strange movement order changes within a room (Fegundos being another example), so it could just be left in as a quirk of the system. But it does mean that the gamestate can be changed simply by switching to a set of clones and then switching back to your old position without making a single move, but at least if only movement order changes, it won't take effect until the next turn. (Good thing demos record all this.)

EDIT: Figured out one of the reasons why Clone Switching calls ProcessTurn: it's because the clone you're switching with might be frozen by an Aumtlich gaze, or vice versa. However, that's more to do with not swapping some of the important attributes with clones rather than a need for a ProcessTurn call. In this case, all that needs to be done is swapping the bFrozen states of clone and player.

EDIT 2: Surprisingly, Clones don't actually get frozen by Aumtlich until you switch to them. In order to prevent having to run ProcessAumtlichGaze to be run after CloneSwitching (which may freeze or unfreeze Aumtlich that were not frozen at the end of the last move), it's probably a good idea to have Clones follow the same rules as Mimics in this case, and make them able to be frozen. GetNextGaze and ProcessAumtlichGaze would need to be updated for this (GetNextGaze to set bFrozen, ProcessAumtlichGaze to unset it).

Note that this change would cause CID_PlayerFrozen to be fired whenever a clone is frozen. This may or may not be desirable: the noise could be distracting, and scripting waiting on the "Player frozen by gaze" event would fire immediately. (That said, that piece of scripting is also fired if Mimics or Stalwarts are frozen, not just the player....)

To preserve current sound/scripting, we could prevent the CueEvent from firing when it hits clones, and fire the CueEvent ourselves if the player is frozen after a use of SwitchToCloneAt.

EDIT 3: ...and this still doesn't solve the problem of Aumtlich gazes not appearing on screen after a clone switch if ProcessAumtlichGaze isn't used. Meh. Maybe pass ProcessAumtlichGaze a boolean telling it whether it should update bFrozen or not so that it can at least draw the gazes? Unsure.

[Last edited by TFMurphy at 11-26-2010 04:35 PM]
11-14-2010 at 09:48 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
TFMurphy
Level: Smitemaster
Rank Points: 3118
Registered: 06-11-2007
IP: Logged
icon Seep Death (+3)  
I'm attaching this to this thread since it's somewhat related, but probably needs to be looked at regardless.

I recently learned that seep do not die on the same turn that an on-off pressure plate lifts up and opens the door they're on. That is, when pressure plates lift up at the end of a turn, they don't run the 'kill seep' check. (Or rather, the 'kill seep' check is separate from the plate check, and the plate check happens after.)

So far, so quirky. We could probably write it off as movement order or something, but it does mean that the seep may still survive if something that moves faster than it next turn closes the door it's on.

Unfortunately, switching clones triggers a 'kill seep' check, as well as the stuff in the previous post. Furthermore, if a seep is killed in this manner during a clone switch, and the seep was the last enemy in the room, the green doors will not toggle.

This particularly *bad* quirk is easily fixed with the same fix as previous: remove the ProcessTurn call that switching clones currently use. Dunno if it's worth looking at seep being able to survive a brief period outside a wall, especially given that such a seep can still be 'saved'. But thought it best to describe the whole thing as a separate post, even if the bigger problem is still part of the clone switching issue.

===

EDIT: Also confirmed that drinking a Mimic, Decoy or Clone potion will cause the death of the seep since it also calls ProcessTurn. This cannot be changed because Mimic/Decoy/Clone placement may change the state of the room.

If we wish to change the behavior, the easiest way is probably to have Seep Death occur after pressure plates in the ProcessTurn call. At the moment, the current order in ProcessTurn is as follows:
Seep Death
Tar Grows (full turn only)
Pressure Plates pop up (full turn only)

If Seeps delayed dying until after pressure plates pop up, then that would cause them to die at the end of turn, just as when you place a potion (or currently switch clones).

This is not entirely without consequence though, since it means that you would now be able to use Pressure Plates popping up to save the life of a troubled Seep (providing something slower than the Seep had opened the door it was on), *and* tar growing could depress a plate to also save its life. That said, being able to co-ordinate with Guards, Slayers and Mimics to hit orbs in a specific order has been able to save a Seep's life since JtRH, so it's not a new mechanic. The main thing is that with this change, the Seep won't get an extra grace turn that mysteriously vanishes when you place a potion double.

EDIT 2: Placing seep death after tar growth is better than it sounds, actually, because tar can depress a plate to kill seep as well.

[Last edited by TFMurphy at 11-25-2010 03:06 PM]
11-24-2010 at 04:44 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
blorx1
Level: Smitemaster
Rank Points: 920
Registered: 07-18-2009
IP: Logged
icon Re: Gamestate Changes from Clone Switching (+1)  
I hate to necro an old thread, but I think a lot of this is still around (at least the move order switching for sure still is).

Has there been any discussion about leaving or changing this behavior? or is it best to ignore and just kill strange abuses like this in HA since rooms using this behavior probably shouldn't be published?

____________________________
If you need to think outside of the box, then you didn't build a good enough box.
06-08-2016 at 06:00 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Moo
Level: Master Delver
Rank Points: 224
Registered: 10-14-2006
IP: Logged
icon Re: Gamestate Changes from Clone Switching (+1)  
Also for the bad-clone-behaviour list: switching clones counts as a move for undo purposes.
06-08-2016 at 07:44 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Dragon Fogel
Level: Smitemaster
Rank Points: 2434
Registered: 06-21-2014
IP: Logged
icon Re: Gamestate Changes from Clone Switching (0)  
There is a room in Christmas Tower (First Level 1S1E) which depends on this behavior - however, it was set up as unrequired and not secret in case the behavior were ever changed. So if this were fixed, that room would just need to be marked unscorable.
10-05-2020 at 11:14 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
skell
Level: Legendary Smitemaster
Avatar
Rank Points: 3734
Registered: 12-28-2004
IP: Logged
icon Re: Gamestate Changes from Clone Switching (+1)  
> 2. Clone switching causes bridges to fall immediately. On Turn 0, this causes bridge graphics to not be updated (though you still see the falling effect), and any critical hero on the bridge will be killed, causing an assertion.

and

3. Clone switching causes Aumtlich Gazes to be recalculated. Again, this can cause things to be frozen on Turn 0 when they normally would not be.

Were both fixed by this: http://forum.caravelgames.com/viewtopic.php?TopicID=44763&page=0#435516

____________________________
My website | Facebook | Twitter
10-06-2020 at 11:42 AM
View Profile Send Private Message to User Send Email to User Visit Homepage Show all user's posts High Scores This architect's holds Quote Reply
skell
Level: Legendary Smitemaster
Avatar
Rank Points: 3734
Registered: 12-28-2004
IP: Logged
icon Re: Gamestate Changes from Clone Switching (+1)  
> I recently learned that seep do not die on the same turn that an on-off pressure plate lifts up and opens the door they're on. That is, when pressure plates lift up at the end of a turn, they don't run the 'kill seep' check. (Or rather, the 'kill seep' check is separate from the plate check, and the plate check happens after.)

This is no longer the case. I vaguely recall fixing this back in the day for 5.1 but maybe it was fixed earlier.

____________________________
My website | Facebook | Twitter
10-06-2020 at 11:46 AM
View Profile Send Private Message to User Send Email to User Visit Homepage Show all user's posts High Scores This architect's holds Quote Reply
skell
Level: Legendary Smitemaster
Avatar
Rank Points: 3734
Registered: 12-28-2004
IP: Logged
icon Re: Gamestate Changes from Clone Switching (+1)  
That leaves us with the issue of changing clone movement order and boy, do I not want to deal with it. So here is my proposed solution:

Clicking on a clone will behave as if you hit tab enough times to switch to it. Just like that. This will, at the very least, ensure using mouse and tabs gives consistent results, and we can continue from that.

Edit: the hacky solution doesn't work so I'll come up with something less temporal - clones will store information about their creation order and it'll be passed around to ensure they are then sorted in place correctly.

____________________________
My website | Facebook | Twitter

[Last edited by skell at 10-06-2020 01:45 PM]
10-06-2020 at 12:18 PM
View Profile Send Private Message to User Send Email to User Visit Homepage Show all user's posts High Scores This architect's holds Quote Reply
skell
Level: Legendary Smitemaster
Avatar
Rank Points: 3734
Registered: 12-28-2004
IP: Logged
icon Re: Gamestate Changes from Clone Switching (+1)  
And did it! Without going into details, Clones now internally remember which clone they are* and whenever clone switcheroo happens they are sorted from oldest to youngest.

PR


* not exactly true but close enough

____________________________
My website | Facebook | Twitter
10-06-2020 at 10:24 PM
View Profile Send Private Message to User Send Email to User Visit Homepage Show all user's posts High Scores This architect's holds Quote Reply
Dragon Fogel
Level: Smitemaster
Rank Points: 2434
Registered: 06-21-2014
IP: Logged
icon Re: Gamestate Changes from Clone Switching (+1)  
Dragon Fogel wrote:
There is a room in Christmas Tower (First Level 1S1E) which depends on this behavior - however, it was set up as unrequired and not secret in case the behavior were ever changed. So if this were fixed, that room would just need to be marked unscorable.

Update on this: I took another look at the room and there's a room break that allows it to be solved even with the change. No need to mark it unscorable.
10-06-2020 at 11:15 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
kieranmillar
Level: Smitemaster
Rank Points: 2670
Registered: 07-11-2014
IP: Logged
icon Re: Gamestate Changes from Clone Switching (+1)  
Can confirm in 5.1.1.alpha.2020-10-18 that inactive clones maintain their correct relative movement order regardless of how much you swap between them and in what order.

Not that the original post says this matters for aumtlich gaze reflection sword orientation, but in all tests I tried, multiple swords on the same tile always failed to reflect if at least one of the swords was at the wrong angle, so I assume that was something else fixed separately in the last 10 years.
10-18-2020 at 06:24 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 : DROD Boards : Bugs : Gamestate Changes from Clone Switching
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.