From 7c5867f6065dcef735f7b8d65f3a1d699fc4132d Mon Sep 17 00:00:00 2001 From: Kirill Date: Wed, 12 Nov 2025 13:28:57 +0300 Subject: [PATCH] initial and starry sky --- .editorconfig | 4 + .gitattributes | 2 + .gitignore | 6 ++ export_presets.cfg | 67 +++++++++++++ icon.svg | 1 + icon.svg.import | 43 ++++++++ project.godot | 28 ++++++ world.tscn | 19 ++++ world/Background/background.gd | 38 ++++++++ world/Background/background.gd.uid | 1 + world/Background/starry_sky_dynamic_bg.gd | 97 +++++++++++++++++++ world/Background/starry_sky_dynamic_bg.gd.uid | 1 + 12 files changed, 307 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 export_presets.cfg create mode 100644 icon.svg create mode 100644 icon.svg.import create mode 100644 project.godot create mode 100644 world.tscn create mode 100644 world/Background/background.gd create mode 100644 world/Background/background.gd.uid create mode 100644 world/Background/starry_sky_dynamic_bg.gd create mode 100644 world/Background/starry_sky_dynamic_bg.gd.uid diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..f28239b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,4 @@ +root = true + +[*] +charset = utf-8 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8ad74f7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..158796f --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +# Godot 4+ specific ignores +.godot/ +/android/ + +# MacOS specific ignores +.DS_Store diff --git a/export_presets.cfg b/export_presets.cfg new file mode 100644 index 0000000..d41d99c --- /dev/null +++ b/export_presets.cfg @@ -0,0 +1,67 @@ +[preset.0] + +name="Windows Desktop" +platform="Windows Desktop" +runnable=true +advanced_options=false +dedicated_server=false +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="../../../Sync/Owad/Builds/Owniverse Adventure/owad-20251112.exe" +patches=PackedStringArray() +encryption_include_filters="" +encryption_exclude_filters="" +seed=0 +encrypt_pck=false +encrypt_directory=false +script_export_mode=2 + +[preset.0.options] + +custom_template/debug="" +custom_template/release="" +debug/export_console_wrapper=1 +binary_format/embed_pck=false +texture_format/s3tc_bptc=true +texture_format/etc2_astc=false +shader_baker/enabled=false +binary_format/architecture="x86_64" +codesign/enable=false +codesign/timestamp=true +codesign/timestamp_server_url="" +codesign/digest_algorithm=1 +codesign/description="" +codesign/custom_options=PackedStringArray() +application/modify_resources=true +application/icon="" +application/console_wrapper_icon="" +application/icon_interpolation=4 +application/file_version="" +application/product_version="" +application/company_name="" +application/product_name="" +application/file_description="" +application/copyright="" +application/trademarks="" +application/export_angle=0 +application/export_d3d12=0 +application/d3d12_agility_sdk_multiarch=true +ssh_remote_deploy/enabled=false +ssh_remote_deploy/host="user@host_ip" +ssh_remote_deploy/port="22" +ssh_remote_deploy/extra_args_ssh="" +ssh_remote_deploy/extra_args_scp="" +ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}' +$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}' +$trigger = New-ScheduledTaskTrigger -Once -At 00:00 +$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries +$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings +Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true +Start-ScheduledTask -TaskName godot_remote_debug +while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 } +Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue" +ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue +Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue +Remove-Item -Recurse -Force '{temp_dir}'" diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..c6bbb7d --- /dev/null +++ b/icon.svg @@ -0,0 +1 @@ + diff --git a/icon.svg.import b/icon.svg.import new file mode 100644 index 0000000..67f467c --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cd7eii7qk3op6" +path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.svg" +dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.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 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..1559757 --- /dev/null +++ b/project.godot @@ -0,0 +1,28 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=5 + +[application] + +config/name="Owniverse Adventure" +run/main_scene="uid://bv384dpmvjv8o" +config/features=PackedStringArray("4.5", "Mobile") +config/icon="res://icon.svg" + +[display] + +window/size/viewport_width=1080 +window/size/viewport_height=1920 +window/size/resizable=false +window/size/extend_to_title=true +window/handheld/orientation=1 + +[rendering] + +renderer/rendering_method="mobile" diff --git a/world.tscn b/world.tscn new file mode 100644 index 0000000..88df903 --- /dev/null +++ b/world.tscn @@ -0,0 +1,19 @@ +[gd_scene load_steps=3 format=3 uid="uid://bv384dpmvjv8o"] + +[ext_resource type="Script" uid="uid://d2wrwichuoncd" path="res://world/Background/background.gd" id="1_fj7yv"] +[ext_resource type="Script" uid="uid://b823gkreu47t3" path="res://world/Background/starry_sky_dynamic_bg.gd" id="3_tlwt5"] + +[node name="World" type="Node2D"] + +[node name="BackgroundLayer" type="Node2D" parent="." node_paths=PackedStringArray("Parallax_2d", "Node_2d")] +script = ExtResource("1_fj7yv") +Parallax_2d = NodePath("Parallax2D") +Node_2d = NodePath("Parallax2D/StarrySkyDynamicBG") + +[node name="Parallax2D" type="Parallax2D" parent="BackgroundLayer"] +repeat_size = Vector2(2048, 2048) + +[node name="StarrySkyDynamicBG" type="Node2D" parent="BackgroundLayer/Parallax2D"] +script = ExtResource("3_tlwt5") +Star_Count = 2000 +Background_Image_Size = Vector2(2048, 2048) diff --git a/world/Background/background.gd b/world/Background/background.gd new file mode 100644 index 0000000..7616a2a --- /dev/null +++ b/world/Background/background.gd @@ -0,0 +1,38 @@ +extends Node2D + + +@export var Parallax_2d: Parallax2D +@export var Node_2d: Node2D + +var x_offset: int = 40 +var y_offset: int = 40 + +var _random + +func _ready() -> void: + _random = RandomNumberGenerator.new() + x_offset = _random_offset_x() * _random_sign() + y_offset = _random_offset_y() * _random_sign() + +func _process(delta: float) -> void: + Parallax_2d.scroll_offset.x += x_offset * delta + Parallax_2d.scroll_offset.y += y_offset * delta + + if _random.randi_range(0, 2096) == 0: + if _random_sign() == 1: + x_offset = _random_offset_x() * _random_sign() + else: + y_offset = _random_offset_y() * _random_sign() + +func _random_offset_x() -> int: + return _random.randi_range(30, 50) + +func _random_offset_y() -> int: + return _random.randi_range(5, 15) + +func _random_sign() -> int: + if _random.randi_range(1, 2) == 1: + return 1 + else: + return -1 + diff --git a/world/Background/background.gd.uid b/world/Background/background.gd.uid new file mode 100644 index 0000000..2391201 --- /dev/null +++ b/world/Background/background.gd.uid @@ -0,0 +1 @@ +uid://d2wrwichuoncd diff --git a/world/Background/starry_sky_dynamic_bg.gd b/world/Background/starry_sky_dynamic_bg.gd new file mode 100644 index 0000000..0607b70 --- /dev/null +++ b/world/Background/starry_sky_dynamic_bg.gd @@ -0,0 +1,97 @@ +extends Node2D + +const STAR_COLOR_DISTRIBUTION = [ + [700, '#8FA8FFFF'], + [1700, '#8FA8FFD8'], + [3400, '#8FA8FFA0'], + [6000, '#A0B5FFFF'], + [9900, '#A0B5FFD0'], + [16400, '#A0B5FF90'], + [17300, '#B0C5FFFF'], + [18600, '#B0C5FFC8'], + [20800, '#B0C5FF88'], + [26000, '#D0DBFFFF'], + [33800, '#D0DBFFC0'], + [46800, '#D0DBFF80'], + [57200, '#F8F7FFE0'], + [72900, '#F8F7FFA8'], + [99000, '#F8F7FF70'], + [114700, '#FFF4EAD0'], + [138200, '#FFF4EA98'], + [177400, '#FFF4EA60'], + [180000, '#FFD280F0'], + [183000, '#FFD280B8'], + [189000, '#FFD28078'], + [191000, '#FFA64DF8'], + [194000, '#FFA64DC0'], + [199000, '#FFA64D80'], + [225000, '#FFE4B5C0'], + [264000, '#FFE4B588'], + [309000, '#FFE4B550'], + [364000, '#FFCC99A0'], + [441000, '#FFCC9968'], + [604000, '#FFCC9940'], + [658000, '#FFB36690'], + [753000, '#FFB3665C'], + [893000, '#FFB36630'], + [914000, '#E8F4FF80'], + [946000, '#E8F4FF50'], + [1000000, '#E8F4FF28'], + ] + +@export_group("Visual Settings") +@export var Star_Count: int = 5000: set = set_star_count +@export var Background_Image_Size: Vector2 = Vector2(4096, 4096): set = set_Background_Image_Size +@export var background_color: Color = Color.BLACK + +@export_group("Animation") +@export var auto_rotate: bool = false +@export var rotation_speed: float = 0.1 + +var rotation_angle: float = 0.0 + +func _ready(): + queue_redraw() + +func _draw(): + draw_rect(Rect2(Vector2.ZERO, Background_Image_Size), background_color) + + # Сохраняем текущее состояние трансформации + var transform = Transform2D().rotated(rotation_angle) + draw_set_transform_matrix(transform) + + draw_galaxy() + +func draw_galaxy(): + for ind1 in range(Star_Count): + var star_coords = Vector2(randi_range(0, Background_Image_Size.x), + randi_range(0, Background_Image_Size.y)) + var star_color = get_star_color() + draw_circle(star_coords, 1, star_color) + +func _process(delta): + if auto_rotate: + rotation_angle += rotation_speed * delta + queue_redraw() + + if Engine.is_editor_hint(): + queue_redraw() + +func get_star_color() -> Color: + #var star_color = {"rgb": Colo, "alpha": 0} + var rnd_seed = randi_range(0, STAR_COLOR_DISTRIBUTION[-1][0]) + for item:Array in STAR_COLOR_DISTRIBUTION: + if rnd_seed <= item[0]: + return Color.html(item[1]) + return Color.BLACK + +#region Сеттеры для автоматического обновления +func set_Background_Image_Size(value: Vector2): + Background_Image_Size = value + queue_redraw() + +func set_star_count(value: int): + Star_Count = value + queue_redraw() + +#endregion diff --git a/world/Background/starry_sky_dynamic_bg.gd.uid b/world/Background/starry_sky_dynamic_bg.gd.uid new file mode 100644 index 0000000..bd57d44 --- /dev/null +++ b/world/Background/starry_sky_dynamic_bg.gd.uid @@ -0,0 +1 @@ +uid://b823gkreu47t3