Initial commit

pull/1/head
Kenney 2021-08-13 21:42:27 +07:00
commit 15b3c77e8a
42 changed files with 6881 additions and 0 deletions

2
.gitattributes vendored

@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

8
.gitignore vendored

@ -0,0 +1,8 @@
# Godot-specific ignores
.import/
export.cfg
export_presets.cfg
# Mono-specific ignores
.mono/

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Kenney
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

File diff suppressed because one or more lines are too long

@ -0,0 +1,19 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://Models/Terrain/hex_forest.mesh" type="ArrayMesh" id=1]
[ext_resource path="res://Models/Terrain/hex_sand.mesh" type="ArrayMesh" id=2]
[ext_resource path="res://Models/Terrain/hex_rock.mesh" type="ArrayMesh" id=3]
[node name="Spatial" type="Spatial"]
[node name="tileGrass" type="MeshInstance" parent="."]
mesh = ExtResource( 1 )
material/0 = null
[node name="tileSand" type="MeshInstance" parent="."]
mesh = ExtResource( 2 )
material/0 = null
[node name="tileRock" type="MeshInstance" parent="."]
mesh = ExtResource( 3 )
material/0 = null

File diff suppressed because one or more lines are too long

@ -0,0 +1,25 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://Models/Items/mountain.mesh" type="ArrayMesh" id=1]
[ext_resource path="res://Models/Items/house.mesh" type="ArrayMesh" id=2]
[ext_resource path="res://Models/Items/detail_forestA.mesh" type="ArrayMesh" id=3]
[node name="Spatial" type="Spatial"]
[node name="tileForestA" type="MeshInstance" parent="."]
mesh = ExtResource( 3 )
material/0 = null
material/1 = null
material/2 = null
[node name="tileMountain" type="MeshInstance" parent="."]
mesh = ExtResource( 1 )
material/0 = null
[node name="tileHouse" type="MeshInstance" parent="."]
mesh = ExtResource( 2 )
material/0 = null
material/1 = null
material/2 = null
material/3 = null
material/4 = null

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

@ -0,0 +1,2 @@
# KayKit-Hexagons

@ -0,0 +1,45 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://Libraries/library-terrain.tres" type="MeshLibrary" id=1]
[ext_resource path="res://Scripts/terrain.gd" type="Script" id=2]
[ext_resource path="res://Scripts/rotate.gd" type="Script" id=3]
[ext_resource path="res://Libraries/library-tiles.tres" type="MeshLibrary" id=4]
[node name="Spatial" type="Spatial"]
script = ExtResource( 2 )
[node name="TerrainMap" type="GridMap" parent="."]
mesh_library = ExtResource( 1 )
cell_size = Vector3( 1, 0.2, 0.866 )
cell_center_y = false
data = {
"cells": PoolIntArray( )
}
__meta__ = {
"_editor_clip_": 0,
"_editor_floor_": Vector3( 0, 0, 0 )
}
[node name="TileMap" type="GridMap" parent="."]
mesh_library = ExtResource( 4 )
cell_size = Vector3( 1, 0.2, 0.866 )
cell_center_y = false
data = {
"cells": PoolIntArray( )
}
__meta__ = {
"_editor_clip_": 0,
"_editor_floor_": Vector3( 0, 0, 0 )
}
[node name="Spatial" type="Spatial" parent="."]
transform = Transform( 0.819152, -0.286788, 0.496732, 0, 0.866025, 0.5, -0.573577, -0.409576, 0.709406, 0, 0, 0 )
script = ExtResource( 3 )
[node name="Camera" type="Camera" parent="Spatial"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 24 )
fov = 30.0
[node name="DirectionalLight" type="DirectionalLight" parent="."]
transform = Transform( 1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, 0, 0 )
shadow_enabled = true

@ -0,0 +1,6 @@
extends Node
# Rotate the camera rig
func _process(delta):
self.rotation_degrees += Vector3(0, 10 * delta, 0)

@ -0,0 +1,78 @@
extends Node
# Define the GridMap components
onready var terrain = $TerrainMap
onready var tiles = $TileMap
# World size
var worldSize = 64
func _ready(): generate()
func generate():
# Define noise for terrain
var noise = OpenSimplexNoise.new()
noise.seed = randi()
noise.octaves = 3
noise.period = 20.0
noise.persistence = 0.8
# Start terrain generation
var offset = 0
for x in worldSize:
offset = 0
for y in worldSize:
if x % 2 and y % 2:
if offset == 1:
offset = 0
else:
offset = 1
# Get noise value for tile
var _noise = round(noise.get_noise_2d(x, y) * 10)
# Terrain tile (color)
var _tile = 0
if _noise < 0: _tile = 1
if _noise > 1: _tile = 2
set_terrain(Vector3(x + offset, _noise, y), _tile)
# Place objects (randomly)
var _random = rand_range(0, 6)
var _quaternion = Quat(Vector3(0, 1, 0), deg2rad(rand_range(0, 180)))
var _randomRotation = Basis(_quaternion).get_orthogonal_index()
if _tile == 0 and _random < 2:
set_tile(Vector3(x + offset, _noise, y), 0, _randomRotation)
if _tile == 0 and _random < 1:
set_tile(Vector3(x + offset, _noise, y), 2, _randomRotation)
if _tile > 1 and _random < 1:
set_tile(Vector3(x + offset, _noise, y), 1, _randomRotation)
# Set terrain tile
func set_terrain(_position, _tile):
terrain.set_cell_item(_position.x - (worldSize / 2), _position.y, _position.z - (worldSize / 2), _tile)
# Set object tile
func set_tile(_position, _tile, _orientation):
tiles.set_cell_item(_position.x - (worldSize / 2), _position.y + 5, _position.z - (worldSize / 2), _tile, _orientation)

@ -0,0 +1,16 @@
[gd_resource type="Environment" load_steps=2 format=2]
[sub_resource type="ProceduralSky" id=1]
[resource]
background_mode = 2
background_sky = SubResource( 1 )
fog_enabled = true
fog_depth_end = 60.0
ssao_enabled = true
ssao_radius = 0.4
ssao_bias = 0.02
ssao_quality = 2
ssao_blur = 2
dof_blur_far_enabled = true
dof_blur_far_distance = 30.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.png"
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

@ -0,0 +1,26 @@
; 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=4
[application]
config/name="KayKit Hexagons"
run/main_scene="res://Scenes/main.tscn"
config/icon="res://icon.png"
[physics]
common/enable_pause_aware_picking=true
[rendering]
quality/filters/anisotropic_filter_level=8
quality/filters/msaa=3
quality/filters/use_fxaa=true
environment/default_environment="res://default_env.tres"