Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Rustgrave/
- `#FF8C00` Toxic Glow
- `#4A6B6B` Teal/Water

窗口 1280×720,viewport 拉伸,全局纹理过滤 Nearest(像素锐利)
窗口 1280×720 设计单位,世界在 640×360 SubViewport 里 NEAREST 光栅化后再整数倍放大

## Testing

Expand Down
Binary file added assets/env/ember_nest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions assets/env/ember_nest.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://hlvg3jdw5n1"
path="res://.godot/imported/ember_nest.png-a58425144475c4042bef8f599f59e710.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/env/ember_nest.png"
dest_files=["res://.godot/imported/ember_nest.png-a58425144475c4042bef8f599f59e710.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file added assets/env/ember_nest_coals.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions assets/env/ember_nest_coals.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://dpamyejtqmlk4"
path="res://.godot/imported/ember_nest_coals.png-ad3889be02b38c3266d26956d15c450d.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/env/ember_nest_coals.png"
dest_files=["res://.godot/imported/ember_nest_coals.png-ad3889be02b38c3266d26956d15c450d.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
6 changes: 4 additions & 2 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Target: **Godot 4.7** · GDScript only · zero external deps.

显示边界:世界始终在 **640×360 SubViewport** 中以原生像素渲染,`GameCamera.zoom=1`;`GamePresentation` 将世界图像和 1280×720 设计单位的 UI 一起放入最大整数倍率内容矩形。非 16:9 窗口只增加黑边。`stretch/mode` 必须是 `canvas_items`。标题进关走 `GameContext.route_scene()`,存档标识仍是 `Level01_Static.tscn`。HUD / 炉心选择 / Director 字幕挂在 `UiHost` 或运行时 overlay,不进世界视口。一次性粒子(尘、火花、死亡烟、雨溅)进 `WorldEffects`。雨粒按世界坐标下落(尖端即碰撞点),碰到地面 / 毒池水面 / 余烬巢后在接触点溅开并回收到镜头上方;画在独立 CanvasLayer 上以免被 MoodTint 压暗。骑士踏进或蹚过毒池会在水膜上溅。

## Autoloads

Do not give autoload scripts a `class_name` — the autoload name is the API.
Expand All @@ -14,7 +16,7 @@ Do not give autoload scripts a `class_name` — the autoload name is the API.
| `Fx` | `scripts/autoload/fx.gd` | Particles, ember attach, death puffs. |
| `SaveData` | `scripts/autoload/save_data.gd` | `user://` save: player, inventory, persistent world, consumed paths, story `flags`, ending. |
| `Director` | `scripts/autoload/director.gd` | Fade, sequenced cutscenes, cinematic letterbox. Never touches `Engine.time_scale`. |
| `WorldClock` | `scripts/autoload/world_clock.gd` | Simulation only: `time_of_day`、`phase`、`weather`、`zone`、`wind_*`。API:`wind_vector()` `sway_radians()` `mood_tint()` `nest_light_*()` `moon_fill_energy()` `indoor_fill_energy()`。不创建 Sprite / Light。演出层是 `WindSway` / `CineFx` / `WeatherFx` / `WorldLight`。 |
| `WorldClock` | `scripts/autoload/world_clock.gd` | Simulation only: `time_of_day`、`phase`、`weather`、`zone`、`wind_*`。API:`wind_vector()` `sway_radians()` `mood_tint()` `outdoor_tint()` `indoor_tint()` `nest_light_*()` `moon_fill_energy()` `outdoor_moon_energy()` `indoor_fill_energy()`。不创建 Sprite / Light。演出层是 `WindSway` / `CineFx` / `WeatherFx` / `WorldLight`。 |

## Level01 (`scenes/levels/Level01_Static.tscn`)

Expand All @@ -37,7 +39,7 @@ Night is a cold corridor (`mood_tint` ≈ 30–40% luminance). Lights carve warm
|---|---|---|
| `WorldLight` | `scripts/world/world_light.gd` | Additive PointLight2D. `follow` is `nest` / `indoor` / `heart`. Shadows on. |
| `EmberNest/NestLight` + `Halo` | planted by the nest | Lit fire only: warm pool + additive glow sprite. Unlit = energy 0. |
| `DisplayFit` | `scripts/ui/display_fit.gd` | Integer-scale 1280×720 onto 1440p (2×) and 4K (3×). Not an Autoload. |
| `DisplayFit` | `scripts/ui/display_fit.gd` | 保持 canvas-items 与整数内容矩形。不是 Autoload |
| `MoonFill` | `Level01Parallax` | Weak cool `DirectionalLight2D`. Off indoors and on the title. |
| `ForgeShelter/WarmPool` | `Level01EastWing.place_forge_shelter` | Large dim indoor fill. |
| `ForgeHeart/HeartLight` | `forge_heart.gd` | Residual heat after `unlock()`. |
Expand Down
4 changes: 2 additions & 2 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ WorldClock="*res://scripts/autoload/world_clock.gd"
window/size/viewport_width=1280
window/size/viewport_height=720
window/size/mode=2
window/stretch/mode="viewport"
window/stretch/mode="canvas_items"
window/stretch/aspect="keep"
window/stretch/scale_mode="integer"
window/stretch/scale_mode="fractional"
window/dpi/allow_hidpi=true

[gui]
Expand Down
35 changes: 21 additions & 14 deletions scenes/levels/Level01_Static.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@
[node name="Level01_Static" type="Node2D"]
script = ExtResource("1_level")

[node name="ParallaxBackdrop" type="ParallaxBackground" parent="."]
[node name="ParallaxBackdrop" type="CanvasLayer" parent="."]
layer = -10
follow_viewport_enabled = false

[node name="Far" type="ParallaxLayer" parent="ParallaxBackdrop"]
motion_scale = Vector2(0.08, 0.04)
motion_mirroring = Vector2(668.8, 0)
[node name="Far" type="Parallax2D" parent="ParallaxBackdrop"]
scroll_scale = Vector2(0.08, 0.04)
repeat_size = Vector2(668, 0)
repeat_times = 4
follow_viewport = false

[node name="Sprite" type="Sprite2D" parent="ParallaxBackdrop/Far"]
texture_filter = 1
Expand All @@ -39,9 +42,11 @@ position = Vector2(0, -24)
scale = Vector2(1.9, 1.9)
texture = ExtResource("15_sky")

[node name="Mid" type="ParallaxLayer" parent="ParallaxBackdrop"]
motion_scale = Vector2(0.22, 0.06)
motion_mirroring = Vector2(326.4, 0)
[node name="Mid" type="Parallax2D" parent="ParallaxBackdrop"]
scroll_scale = Vector2(0.22, 0.06)
repeat_size = Vector2(326, 0)
repeat_times = 4
follow_viewport = false

[node name="Sprite" type="Sprite2D" parent="ParallaxBackdrop/Mid"]
texture_filter = 1
Expand All @@ -50,9 +55,11 @@ position = Vector2(0, 48)
scale = Vector2(1.7, 1.7)
texture = ExtResource("16_far")

[node name="Hills" type="ParallaxLayer" parent="ParallaxBackdrop"]
motion_scale = Vector2(0.48, 0.1)
motion_mirroring = Vector2(710.4, 0)
[node name="Hills" type="Parallax2D" parent="ParallaxBackdrop"]
scroll_scale = Vector2(0.48, 0.1)
repeat_size = Vector2(710, 0)
repeat_times = 4
follow_viewport = false

[node name="Sprite" type="Sprite2D" parent="ParallaxBackdrop/Hills"]
texture_filter = 1
Expand All @@ -72,8 +79,8 @@ fill = Color(0.545098, 0.270588, 0.0745098, 1)

[node name="ToxinPit" parent="Platforms" instance=ExtResource("2_plat")]
skin = "ground"
position = Vector2(400, 368)
size = Vector2(112, 32)
position = Vector2(400, 352)
size = Vector2(112, 48)
cap_surface = false
tone = Color(0.52, 0.47, 0.58, 1)
fill = Color(0.290196, 0.164706, 0.0941176, 1)
Expand Down Expand Up @@ -135,7 +142,7 @@ fill = Color(0.368627, 0.352941, 0.337255, 1)

[node name="Plat_760_184" parent="Platforms" instance=ExtResource("2_plat")]
skin = "floating"
position = Vector2(760, 184)
position = Vector2(760, 288)
size = Vector2(104, 16)
fill = Color(0.627451, 0.321569, 0.176471, 1)

Expand Down Expand Up @@ -191,7 +198,7 @@ position = Vector2(1488, 288)
position = Vector2(150, 306)

[node name="Spitter1" parent="Props" instance=ExtResource("12_spitter")]
position = Vector2(812, 184)
position = Vector2(812, 288)

[node name="Spitter2" parent="Props" instance=ExtResource("12_spitter")]
position = Vector2(1018, 180)
Expand Down
13 changes: 13 additions & 0 deletions scenes/ui/GamePresentation.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[gd_scene load_steps=2 format=3]

[ext_resource type="Script" path="res://scripts/ui/game_presentation.gd" id="1"]

[node name="GamePresentation" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
script = ExtResource("1")
3 changes: 2 additions & 1 deletion scripts/autoload/director.gd
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,8 @@ func _on_fade_out_done(scene: String, duration: float) -> void:
_queued_fade_path = ""
last_fade_target = target
if target != "" and not _is_test_runner():
get_tree().change_scene_to_file(target)
# Level01 must load inside GamePresentation (640×360 world).
get_tree().change_scene_to_file(GameContext.route_scene(target))
fade_in(dur)


Expand Down
Loading