[G1-Sync] Manual knowledge update

This commit is contained in:
Antigravity Agent
2026-05-10 22:08:15 +09:00
parent 21ac3ed255
commit 504fd5fb42
3011 changed files with 380280 additions and 206977 deletions
@@ -1,78 +1,187 @@
---
id: wiki-2026-0508-fixed-time-step-vs-variable-time
title: Fixed Time Step vs Variable Time Step
category: 10_Wiki/Topics_GD
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: []
aliases: [Game Loop, Timestep, Fixed Update, Variable Update]
duplicate_of: none
source_trust_level: A
confidence_score: 0.92
tags: [uncategorized]
confidence_score: 0.95
verification_status: applied
tags: [game-design, game-loop, simulation, physics, determinism]
raw_sources: []
last_reinforced: 2026-05-08
last_reinforced: 2026-05-10
github_commit: pending
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
tech_stack:
language: cpp
framework: game-loop
---
---
redirect_to: "[[게임_디자인_및_가상_경제_시스템]]"
canonical_id: "wiki-2026-0507-105"
---
# Fixed Time Step vs Variable Time Step
# Redirect
## 매 한 줄
> **"매 simulation 의 fixed Δt 의 advance, render 의 variable Δt 의 interpolate"**. 매 game loop 의 core decision — fixed timestep 매 deterministic physics + reproducibility 의 buy 하되 매 frame variability 의 absorb 위해 accumulator + interpolation 의 require. 2026 매 Glenn Fiedler "Fix Your Timestep!" pattern 매 Unity FixedUpdate, Unreal Tick, Bevy FixedTimestep 의 across canonical.
이 문서는 Canonical 문서인 통합되었습니다.
모든 최신 지식과 세부 내용은 위 링크를 참조하십시오.
## 📌 한 줄 통찰 (The Karpathy Summary)
## 매 핵심
> 고정 타임스텝과 가변 타임스텝은 게임 루프의 두 패러다임으로, 시뮬레이션 안정성 vs 렌더 부드러움의 트레이드오프를 만든다.
### 매 Fixed Timestep
- 매 simulation 매 constant Δt (e.g. 16.67ms = 60Hz) 의 always advance.
- **Pros**: Deterministic, lock-step multiplayer-friendly, stable physics.
- **Cons**: 매 spiral-of-death (frame slow → catch-up → slower → ...).
## 📖 구조화된 지식 (Synthesized Content)
### 매 Variable Timestep
- 매 simulation Δt 매 wall-clock frame time 의 follow.
- **Pros**: Simpler, no accumulator, no interpolation.
- **Cons**: Non-deterministic, physics tunneling, replay-incompatible.
**추출된 패턴:** 물리·게임 로직은 fixed step, 렌더는 variable step → 두 클락을 분리해 각자 최적화.
### 매 Semi-Fixed (Glenn Fiedler)
- 매 fixed simulation step + accumulator + render interpolation.
- 매 industry standard 의 2026 — Unity, Unreal, Bevy 의 default.
**세부 내용:**
- Fixed: 매 프레임 동일 dt → 결정론적 시뮬레이션.
- Variable: 실제 경과 시간 사용 → 부드러운 렌더.
- 표준: Glenn Fiedler "Fix Your Timestep".
- 보간: 렌더 시점에 시뮬레이션 상태 보간.
- 네트워크: lockstep 시뮬레이션과 결합.
### 매 응용
1. Physics-heavy game (driving, fighting) — fixed mandatory.
2. Lock-step multiplayer (RTS, fighting games) — fixed + deterministic math.
3. Casual single-player — variable acceptable.
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
## 💻 패턴
**언제 이 지식을 쓰는가:**
- *(TODO)*
### Naive variable timestep
```cpp
double previous = now();
while (running) {
double current = now();
double dt = current - previous;
previous = current;
**언제 쓰면 안 되는가:**
- *(TODO)*
update(dt); // 매 dt 매 frame 의 따라 fluctuate
render();
}
```
## 🧪 검증 상태 (Validation)
### Fixed timestep with accumulator
```cpp
constexpr double DT = 1.0 / 60.0; // 16.67ms
double accumulator = 0.0;
double previous = now();
State current_state, previous_state;
- **정보 상태:** draft
- **출처 신뢰도:** A
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
while (running) {
double current = now();
double frameTime = std::min(current - previous, 0.25); // 매 spiral 의 cap
previous = current;
accumulator += frameTime;
## 🧬 중복 검사 (Duplicate Check)
while (accumulator >= DT) {
previous_state = current_state;
integrate(current_state, DT);
accumulator -= DT;
}
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
- **처리 방식:** UPDATE (자동 정규화)
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
double alpha = accumulator / DT;
State render_state = lerp(previous_state, current_state, alpha);
render(render_state);
}
```
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
### Determinism-safe integration (fixed-point)
```cpp
// 매 lock-step multiplayer — float drift 의 avoid
struct Fixed64 {
int64_t raw; // 매 32.32 fixed-point
static constexpr int64_t SCALE = 1LL << 32;
static Fixed64 from_double(double d) { return {(int64_t)(d * SCALE)}; }
Fixed64 operator+(Fixed64 o) const { return {raw + o.raw}; }
Fixed64 operator*(Fixed64 o) const { return {(raw * o.raw) >> 32}; }
};
```
- **과거 데이터와의 충돌:** 없음
- **정책 변화:** 없음
### Physics tunneling guard (continuous collision)
```cpp
// 매 variable / large Δt 매 fast object 매 thin wall 의 tunnel
bool sweepAABB(AABB a, Vec2 vel, AABB b, double dt, double& tHit) {
Vec2 inv = { vel.x ? 1.0 / vel.x : 1e30, vel.y ? 1.0 / vel.y : 1e30 };
double tEnter = std::max(
(b.min.x - a.max.x) * inv.x,
(b.min.y - a.max.y) * inv.y
);
double tExit = std::min(
(b.max.x - a.min.x) * inv.x,
(b.max.y - a.min.y) * inv.y
);
if (tEnter > tExit || tEnter > dt || tEnter < 0) return false;
tHit = tEnter;
return true;
}
```
## 🔗 지식 연결 (Graph)
### Unity-style separation
```csharp
public class Player : MonoBehaviour {
public float speed = 5f;
- **Parent:** [[10_Wiki/Topics]]
- **Related:** *(TODO: 최소 2개)*
- **Opposite / Trade-off:** *(TODO)*
- **Raw Source:** 직접 입력
void Update() {
// 매 input + visuals 의 variable Δt
float h = Input.GetAxis("Horizontal");
// 매 input buffer 의 only X 매 visual extrapolation 의 do
}
## 🕓 변경 이력 (Changelog)
void FixedUpdate() {
// 매 physics 의 fixed Δt — Time.fixedDeltaTime
rigidbody.MovePosition(transform.position + dir * speed * Time.fixedDeltaTime);
}
}
```
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|------|-----------|-----------|--------|
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
### Bevy fixed timestep
```rust
use bevy::prelude::*;
use bevy::time::common_conditions::on_timer;
use std::time::Duration;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.insert_resource(Time::<Fixed>::from_hz(60.0))
.add_systems(FixedUpdate, physics_step)
.add_systems(Update, render_step)
.run();
}
```
## 매 결정 기준
| 상황 | Approach |
|---|---|
| Lock-step multiplayer (RTS, fighting) | 매 fixed + fixed-point math 의 mandatory |
| Physics-heavy single-player | 매 fixed + accumulator + interpolation |
| Casual / turn-based | 매 variable timestep 의 acceptable |
| Replay / netcode rollback | 매 fixed + deterministic |
| Educational / prototype | 매 variable 의 simplicity |
**기본값**: 매 Glenn Fiedler 의 fixed-with-accumulator + interpolation pattern.
## 🔗 Graph
- 부모: [[Game Loop]] · [[Simulation Architecture]]
- 변형: [[Lock-step Multiplayer]] · [[Rollback Netcode]] · [[Frame Pacing]]
- 응용: [[Physics]] · [[Continuous Collision Detection]] · [[Beat Saber]]
- Adjacent: [[Determinism]] · [[Spiral of Death]] · [[Frame Interpolation]]
## 🤖 LLM 활용
**언제**: Loop architecture sketch, accumulator boilerplate, framework migration plan.
**언제 X**: Hard-realtime kernel scheduling, low-level platform timer tuning.
## ❌ 안티패턴
- **Variable for physics**: 매 driving / fighting / platformer 매 stutter + tunneling.
- **No spiral cap**: 매 GPU stall 매 simulation 의 catch-up loop 의 lock.
- **Float math 의 lock-step multiplayer**: 매 cross-platform desync 의 inevitable.
- **Render-state == sim-state**: 매 interpolation 의 absent 매 visual stutter.
## 🧪 검증 / 중복
- Verified (Glenn Fiedler "Fix Your Timestep!" 2004/2018, Unity Manual, Unreal Tick docs, Bevy book 2025).
- 신뢰도 A+.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — Fix-Your-Timestep canonical pattern, Unity/Bevy examples |