Skip to content

Less Obvious CC2 Behavior

Eevee edited this page Dec 14, 2020 · 1 revision

Things we have investigated and discovered, recorded for posterity.

Timing

Observations

If a player in an untimed level steps on a cell with a time penalty, the clock will show 1 for a single frame before the player dies.

Conclusions

The game runs at 60fps, and some things also happen at 60 fps:

  • wire
  • movement advancement
  • actors arriving in cells and triggering any arrival effects
  • force floors

However, it seems the actor decision pass only runs every third frame, so outside of rare circumstances, the vast majority of actors will be "aligned" to a 20fps tic. Known ways to break this alignment:

  • Blocks visually jump ahead 1 frame when the player starts pushing them, so they land in water one frame earlier than expected (and cause visual jitter when pushing a block across multiple cells). However, this doesn't seem to have any practical impact.

  • If the player is on a force floor, and wiring causes the force floor to flip during an off-tic frame, the player's movement can become misaligned. They will then be unable to override the force floor until they stop sliding, since input is only read every third frame, and on every such frame they will be in the middle of a move.

  • you can also get desynced by starting on a force floor! it'll kick in on the first frame, but your input isn't read until the third

Rough outline of the game loop

XXX show the tank example (also link it), lexy movement loop XXX tank example has a bug in LL

  • consume input frame 0, ignore it
  • mini-tic: advance everyone's movement by 1/3 of a tic; if movement finishes, step on the new cell
  • update wiring
  • render frame 0
  • consume input frame 1, ignore it
  • mini-tic: advance everyone's movement by 1/3 of a tic; if movement finishes, step on the new cell
  • update wiring
  • render frame 1
  • consume input frame 2, save it for the player's decision
  • mini-tic: advance everyone's movement by 1/3 of a tic; if movement finishes, step on the new cell
  • TIC: decision pass; teleportation pass; "begin movement" pass
  • render frame 2
  • (repeat)

Input and decisions

Observations

Conclusions

Input reading seems very similar to the Lynx behavior.

Input reading is idempotent; it doesn't matter when you pressed keys, only what keys you're pressing currently.

If you are ever pressing two opposite directions at precisely the same time, you're treated as if you're not trying to move at all.

If you're pressing your current facing direction, that takes priority. Otherwise, the game checks horizontal first, then vertical.

When the game checks the player's input, it aggressively examines every cell (up to 2) the player wants to move into, including starting to push blocks.

Movement

Observations

If two monsters are exactly one cell apart, they will collide and bounce off one another as appropriate, regardless of actor order.

If a monster and a player are exactly one cell apart and either moves towards the other, they will collide, regardless of actor order. This does not happen if they are even 1 tic apart in either direction. Movement direction doesn't seem to matter, even though a player moving orthogonally away from a monster will visually overlap it for a few frames.

Of course, multiple blocks can move together exactly aligned, e.g. a row of ice blocks.

There is no "bonk" tic when hitting a wall on ice; actors turn around immediately, presumably at the decision stage.

Force floor overriding:

row of teleporters and blocks on turtles test, LL currently fails

monsters do not push blocks at decision time, but they do still check to see which ones they could push, recursively if necessary (unclear how hook factors in here, if at all)

Conclusions

Ending the game

Observations

Conclusions

You win when N players have exited, where N is the number of players present in the level when it started. (An exiting player is removed from the level, after which control switches to the next player in actor order.)

You lose when any player has been destroyed.

If a player is destroyed on the same frame that the last player exits, winning seems to take priority.

If the last player (in an untimed level) steps on a cell with both a time penalty and an exit, they will win, but the clock will show 1 for a single frame before going blank again.

If X players have already exited, and Y players exit on the same frame, where X + Y > N, the game will softlock — it will not attempt to switch control (the camera doesn't move), and you will be unable to do anything as there is no active player.