commit c6d5a8e1131339404a9f568afc1c22d6c89f3387 Author: Eric Date: Sat Feb 3 14:58:20 2024 -0600 initial commit 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..4709183 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Godot 4+ specific ignores +.godot/ diff --git a/assets/scifi_tilesheet@2.png b/assets/scifi_tilesheet@2.png new file mode 100644 index 0000000..4fcc627 Binary files /dev/null and b/assets/scifi_tilesheet@2.png differ diff --git a/assets/scifi_tilesheet@2.png.import b/assets/scifi_tilesheet@2.png.import new file mode 100644 index 0000000..491a77d --- /dev/null +++ b/assets/scifi_tilesheet@2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://n806c03hgaq1" +path="res://.godot/imported/scifi_tilesheet@2.png-871427438784116a696c08104f4d614b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/scifi_tilesheet@2.png" +dest_files=["res://.godot/imported/scifi_tilesheet@2.png-871427438784116a696c08104f4d614b.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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 diff --git a/data/scifi_tileset.tres b/data/scifi_tileset.tres new file mode 100644 index 0000000..375dfbc --- /dev/null +++ b/data/scifi_tileset.tres @@ -0,0 +1,517 @@ +[gd_resource type="TileSet" load_steps=3 format=3 uid="uid://d1sh6dy2w10b0"] + +[ext_resource type="Texture2D" uid="uid://n806c03hgaq1" path="res://assets/scifi_tilesheet@2.png" id="1_40wcs"] + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_yq8ar"] +resource_name = "scifi" +texture = ExtResource("1_40wcs") +texture_region_size = Vector2i(128, 128) +0:0/0 = 0 +1:0/next_alternative_id = 2 +1:0/0 = 0 +2:0/0 = 0 +3:0/0 = 0 +4:0/0 = 0 +5:0/0 = 0 +6:0/0 = 0 +7:0/0 = 0 +8:0/0 = 0 +9:0/0 = 0 +10:0/0 = 0 +11:0/0 = 0 +12:0/0 = 0 +13:0/0 = 0 +14:0/0 = 0 +15:0/0 = 0 +16:0/0 = 0 +17:0/0 = 0 +18:0/0 = 0 +19:0/0 = 0 +20:0/0 = 0 +21:0/0 = 0 +22:0/0 = 0 +23:0/0 = 0 +24:0/0 = 0 +25:0/0 = 0 +26:0/0 = 0 +27:0/0 = 0 +28:0/0 = 0 +29:0/0 = 0 +30:0/0 = 0 +31:0/0 = 0 +32:0/0 = 0 +33:0/0 = 0 +34:0/0 = 0 +35:0/0 = 0 +0:1/0 = 0 +1:1/0 = 0 +2:1/0 = 0 +3:1/0 = 0 +4:1/0 = 0 +5:1/0 = 0 +6:1/0 = 0 +7:1/0 = 0 +8:1/0 = 0 +9:1/0 = 0 +10:1/0 = 0 +11:1/0 = 0 +12:1/0 = 0 +13:1/0 = 0 +14:1/0 = 0 +15:1/0 = 0 +16:1/0 = 0 +17:1/0 = 0 +18:1/0 = 0 +19:1/0 = 0 +20:1/0 = 0 +21:1/0 = 0 +22:1/0 = 0 +23:1/0 = 0 +24:1/0 = 0 +25:1/0 = 0 +26:1/0 = 0 +27:1/0 = 0 +28:1/0 = 0 +29:1/0 = 0 +30:1/0 = 0 +31:1/0 = 0 +32:1/0 = 0 +33:1/0 = 0 +34:1/0 = 0 +35:1/0 = 0 +0:2/0 = 0 +1:2/0 = 0 +2:2/0 = 0 +3:2/0 = 0 +4:2/0 = 0 +5:2/0 = 0 +6:2/0 = 0 +7:2/0 = 0 +8:2/0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0 +2:10/0 = 0 +3:10/0 = 0 +4:10/0 = 0 +5:10/0 = 0 +6:10/0 = 0 +7:10/0 = 0 +8:10/0 = 0 +9:10/0 = 0 +10:10/0 = 0 +11:10/0 = 0 +12:10/0 = 0 +13:10/0 = 0 +14:10/0 = 0 +15:10/0 = 0 +16:10/0 = 0 +17:10/0 = 0 +18:10/0 = 0 +19:10/0 = 0 +20:10/0 = 0 +21:10/0 = 0 +22:10/0 = 0 +23:10/0 = 0 +24:10/0 = 0 +25:10/0 = 0 +26:10/0 = 0 +27:10/0 = 0 +28:10/0 = 0 +29:10/0 = 0 +30:10/0 = 0 +31:10/0 = 0 +32:10/0 = 0 +33:10/0 = 0 +34:10/0 = 0 +35:10/0 = 0 +0:11/0 = 0 +1:11/0 = 0 +2:11/0 = 0 +3:11/0 = 0 +4:11/0 = 0 +5:11/0 = 0 +6:11/0 = 0 +7:11/0 = 0 +8:11/0 = 0 +9:11/0 = 0 +10:11/0 = 0 +11:11/0 = 0 +12:11/0 = 0 +13:11/0 = 0 +14:11/0 = 0 +15:11/0 = 0 +16:11/0 = 0 +17:11/0 = 0 +18:11/0 = 0 +19:11/0 = 0 +20:11/0 = 0 +21:11/0 = 0 +22:11/0 = 0 +23:11/0 = 0 +24:11/0 = 0 +25:11/0 = 0 +26:11/0 = 0 +27:11/0 = 0 +28:11/0 = 0 +29:11/0 = 0 +30:11/0 = 0 +31:11/0 = 0 +32:11/0 = 0 +33:11/0 = 0 +34:11/0 = 0 +35:11/0 = 0 +0:12/0 = 0 +1:12/0 = 0 +2:12/0 = 0 +3:12/0 = 0 +4:12/0 = 0 +5:12/0 = 0 +6:12/0 = 0 +7:12/0 = 0 +8:12/0 = 0 +9:12/0 = 0 +10:12/0 = 0 +11:12/0 = 0 +12:12/0 = 0 +13:12/0 = 0 +14:12/0 = 0 +15:12/0 = 0 +16:12/0 = 0 +17:12/0 = 0 +18:12/0 = 0 +19:12/0 = 0 +20:12/0 = 0 +21:12/0 = 0 +22:12/0 = 0 +23:12/0 = 0 +24:12/0 = 0 +25:12/0 = 0 +26:12/0 = 0 +27:12/0 = 0 +28:12/0 = 0 +29:12/0 = 0 +30:12/0 = 0 +31:12/0 = 0 +32:12/0 = 0 +33:12/0 = 0 +34:12/0 = 0 +35:12/0 = 0 +0:13/0 = 0 +1:13/0 = 0 +2:13/0 = 0 +3:13/0 = 0 +4:13/0 = 0 +5:13/0 = 0 +6:13/0 = 0 +7:13/0 = 0 +8:13/0 = 0 +9:13/0 = 0 +10:13/0 = 0 +11:13/0 = 0 +12:13/0 = 0 +13:13/0 = 0 +14:13/0 = 0 +15:13/0 = 0 +16:13/0 = 0 +17:13/0 = 0 +18:13/0 = 0 +19:13/0 = 0 +20:13/0 = 0 +21:13/0 = 0 +22:13/0 = 0 +23:13/0 = 0 +24:13/0 = 0 +25:13/0 = 0 +26:13/0 = 0 +27:13/0 = 0 +28:13/0 = 0 +29:13/0 = 0 +30:13/0 = 0 +31:13/0 = 0 +32:13/0 = 0 +33:13/0 = 0 +34:13/0 = 0 +35:13/0 = 0 +8:6/0 = 0 +9:6/0 = 0 + +[resource] +tile_size = Vector2i(128, 128) +sources/0 = SubResource("TileSetAtlasSource_yq8ar") diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..b370ceb --- /dev/null +++ b/icon.svg @@ -0,0 +1 @@ + diff --git a/icon.svg.import b/icon.svg.import new file mode 100644 index 0000000..554ba2f --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://du63ot65iec2r" +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/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +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..ffdf9e1 --- /dev/null +++ b/project.godot @@ -0,0 +1,15 @@ +; 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="Corupture" +config/features=PackedStringArray("4.2", "Forward Plus") +config/icon="res://icon.svg" diff --git a/scene/world.tscn b/scene/world.tscn new file mode 100644 index 0000000..2597e9e --- /dev/null +++ b/scene/world.tscn @@ -0,0 +1,27 @@ +[gd_scene load_steps=5 format=3 uid="uid://m0us5xqa3gnk"] + +[ext_resource type="Script" path="res://scripts/world.gd" id="1_yf6q1"] +[ext_resource type="TileSet" uid="uid://d1sh6dy2w10b0" path="res://data/scifi_tileset.tres" id="2_sa7dm"] + +[sub_resource type="FastNoiseLite" id="FastNoiseLite_teaou"] + +[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_8pjar"] +noise = SubResource("FastNoiseLite_teaou") + +[node name="world" type="Node2D"] +script = ExtResource("1_yf6q1") +noise_texture = SubResource("NoiseTexture2D_8pjar") + +[node name="world_grid" type="TileMap" parent="."] +tile_set = ExtResource("2_sa7dm") +format = 2 +layer_0/name = "ground" +layer_1/name = "environment" +layer_1/tile_data = PackedInt32Array() +layer_2/name = "buildings" +layer_2/tile_data = PackedInt32Array() + +[node name="Camera2D" type="Camera2D" parent="."] +zoom = Vector2(0.05, 0.05) +drag_horizontal_enabled = true +drag_vertical_enabled = true diff --git a/scripts/world.gd b/scripts/world.gd new file mode 100644 index 0000000..7971fa0 --- /dev/null +++ b/scripts/world.gd @@ -0,0 +1,33 @@ +extends Node2D + +@export var noise_texture: NoiseTexture2D +var noise_values +@onready var world_grid = $world_grid + +var temp_size = 150 +var temp_noise_val = [] +var temp_noise_reg = [] + +var noise_regions = [-999,10,150,200,999] +var atlas_regions = [Vector2i(0,1),Vector2i(0,0),Vector2i(2,0),Vector2i(0,2)] + +func get_noise_value(x: int, y: int): + return noise_values.get_noise_2d(x,y) * 500 + +func get_noise_region(x,y): + var noise_val = get_noise_value(x,y) + for i in range(noise_regions.size()): + if noise_regions[i] <= noise_val and noise_val < noise_regions[i+1]: + return i + +func _ready(): + noise_values = noise_texture.noise + for x in range(-temp_size, temp_size): + for y in range(-temp_size, temp_size): + world_grid.set_cell(0, Vector2i(x,y),0,atlas_regions[get_noise_region(x,y)]) + temp_noise_val.append(get_noise_value(x,y)) + temp_noise_reg.append(get_noise_region(x,y)) + prints(temp_noise_val.min(), temp_noise_val.max()) + for region in noise_regions.size(): + prints(region, noise_regions[region], temp_noise_reg.count(region)) + #get_tree().quit()