CHIP! CHIP! 칩칩!

#2 — 진짜로 무너지는 탑: Matter.js 물리와 무게중심

2026-07-06 · 개발 / 물리

스태킹 게임에서 가장 중요한 결정은 "칩을 어떻게 쌓이게 할 것인가"입니다. 많은 게임은 칩을 미리 정해진 격자에 딱 붙입니다. 저는 그러지 않기로 했습니다.

붙이지 않는다 — 떨어뜨린다

CHIP! CHIP!의 칩은 격자에 스냅되지 않습니다. 대신 강체 물리 엔진 Matter.js 위에서 실제 물체로 떨어집니다. 각 칩에는 질량·마찰·복원계수가 있고, 아래 칩과 겹친 면적만큼만 지탱됩니다. 살짝 어긋나게 놓으면 그 칩은 미세하게 기울고, 그 위에 또 어긋나게 쌓이면 기울기가 누적됩니다. 그래서 같은 "10층"이라도 어떻게 쌓았느냐에 따라 안정된 탑일 수도, 곧 쓰러질 탑일 수도 있습니다. 이 예측 불가능성이 긴장감의 핵심입니다.

게임오버는 "무게중심"으로 판정한다

초기에는 "칩이 화면 밖으로 떨어지면 게임오버"로만 처리했는데, 그러면 탑이 눈에 띄게 기울었는데도 게임이 안 끝나는 어색한 순간이 있었습니다. 그래서 판정을 두 갈래로 나눴습니다.

난이도는 "칩의 움직임"으로 올린다

난이도를 숫자(속도)로만 올리면 금방 지겹고 불공평하게 느껴집니다. 그래서 칩이 움직이는 방식 자체를 단계별로 바꿨습니다.

  1. 가로(X) — 칩이 좌우로만 등속 왕복. 타이밍만 맞추면 된다. 입문 구간.
  2. 세로(Y) — 칩이 위아래로 오르내린다. 낮은 지점에서 놓아야 "부드러운 착지"가 되어 퍼펙트가 나온다.
  3. 랜덤 — 매 칩마다 가로/세로가 무작위로 바뀐다. 패턴 암기가 안 통한다.
  4. 대각선 — 비정수 주기의 리사주 궤적으로 대각선을 그리며 움직인다. 가장 어렵다.

시작 방향도 매번 랜덤으로 줘서, 플레이어가 "왼쪽부터 시작하니까 여기서 누르면 돼" 같은 암기로 풀지 못하게 했습니다. 속도도 층이 오를수록 조금씩 붙지만 상한선을 둬서, 반응이 불가능한 수준까지는 가지 않게 조율했습니다.

완벽함에는 보상을

정확히 가운데에 놓으면 퍼펙트가 뜨고 콤보가 쌓입니다. 콤보가 이어지면 점수 배수가 올라가고, 일정 콤보마다 탑 전체를 살짝 안정시켜(각속도·속도 감쇠) "완벽하게 쌓으면 탑도 진정된다"는 감각을 줍니다. 실력이 곧 안정으로 돌아오는 이 루프가, 단순한 게임에 숙련의 깊이를 더합니다.

다음 글에서는 이 물리 위에 얹은 배경 이야기 — 조작이 터치뿐인 게임에서 장소감과 진행감을 어떻게 만들었는지를 다루겠습니다.

▶ 물리를 직접 느껴보기

#2 — A tower that really collapses: Matter.js physics and center of mass

2026-07-06 · Development / Physics

The most important decision in a stacking game is "how do chips come to rest?" Many games snap chips to a preset grid. I chose not to.

Don't snap — drop

Chips in CHIP! CHIP! never snap to a grid. Instead they fall as real objects on the Matter.js rigid-body engine. Each chip has mass, friction, and restitution, and is supported only by the area it overlaps with the chip below. Place it slightly off and that chip tilts a little; stack another off-center on top and the tilt accumulates. So the same "10 floors" can be a stable tower or one about to topple, depending on how you stacked it. That unpredictability is the heart of the tension.

Game over is judged by center of mass

Early on, "game over when a chip falls off screen" was the only rule — which left awkward moments where the tower was visibly leaning yet the game wouldn't end. So I split the judgment in two:

Difficulty ramps through motion, not just speed

Ramping difficulty by numbers (speed) alone gets boring and unfair fast. So the way the chip moves changes in stages:

  1. Horizontal (X) — the chip sweeps left-right at constant speed. Pure timing. The intro.
  2. Vertical (Y) — the chip rises and falls; release it low for a "soft landing" and a perfect.
  3. Random — each chip randomly picks horizontal or vertical. Memorizing patterns fails.
  4. Diagonal — a Lissajous path with a non-integer period traces diagonals. The hardest.

The starting direction is randomized each time, so players can't solve it by rote ("it starts from the left, so press here"). Speed also creeps up with height but is capped, tuned to never reach a reaction-impossible level.

Reward the perfect

Land dead center and a PERFECT pops, building a combo. Sustained combos raise the score multiplier, and every few perfects the whole tower is gently stabilized (angular/linear velocity damped), giving the sense that "stack perfectly and the tower calms down." That loop — skill returning as stability — adds mastery depth to a simple game.

Next time: the backgrounds layered on top of this physics — how a touch-only game builds a sense of place and progress.

▶ Feel the physics yourself