Mesh phenotype generation part one
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
source_md5="fbf92d5d3d39b13f2b24b15045e328a3"
|
||||
dest_md5="a772304e777cf8b334d5430a97da2ed1"
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
source_md5="efde79eb18086a352d0d9a047ad4d918"
|
||||
dest_md5="1b5e5bc75e997d102865b9e4c5bea748"
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+7
-19
@@ -1,23 +1,11 @@
|
||||
[gd_scene load_steps=6 format=2]
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://homunculus.tscn" type="PackedScene" id=1]
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=1]
|
||||
albedo_color = Color( 0.741176, 0.815686, 0.839216, 1 )
|
||||
metallic = 1.0
|
||||
metallic_specular = 1.0
|
||||
roughness = 0.24
|
||||
anisotropy_enabled = true
|
||||
anisotropy = 0.0
|
||||
refraction_enabled = true
|
||||
refraction_scale = 0.05
|
||||
refraction_texture_channel = 0
|
||||
|
||||
[sub_resource type="CubeMesh" id=2]
|
||||
material = SubResource( 1 )
|
||||
[sub_resource type="CubeMesh" id=1]
|
||||
size = Vector3( 5, 0.1, 2.5 )
|
||||
|
||||
[sub_resource type="Environment" id=3]
|
||||
[sub_resource type="Environment" id=2]
|
||||
background_mode = 1
|
||||
background_energy = 0.0
|
||||
ambient_light_energy = 0.0
|
||||
@@ -32,7 +20,7 @@ glow_bicubic_upscale = true
|
||||
adjustment_enabled = true
|
||||
adjustment_saturation = 0.41
|
||||
|
||||
[sub_resource type="GIProbeData" id=4]
|
||||
[sub_resource type="GIProbeData" id=3]
|
||||
bounds = AABB( -10, -10, -10, 20, 20, 20 )
|
||||
cell_size = 0.15625
|
||||
to_cell_xform = Transform( 6.4, 0, 0, 0, 6.4, 0, 0, 0, 6.4, 64, 64, 64 )
|
||||
@@ -48,11 +36,11 @@ interior = true
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="."]
|
||||
use_in_baked_light = true
|
||||
mesh = SubResource( 2 )
|
||||
mesh = SubResource( 1 )
|
||||
material/0 = null
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource( 3 )
|
||||
environment = SubResource( 2 )
|
||||
|
||||
[node name="SpotLight" type="SpotLight" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, -1.62921e-07, 1, 0, -1, -1.62921e-07, 0.368187, 3.41124, 7.40264e-08 )
|
||||
@@ -71,4 +59,4 @@ dynamic_range = 12
|
||||
energy = 5.67
|
||||
propagation = 0.47
|
||||
interior = true
|
||||
data = SubResource( 4 )
|
||||
data = SubResource( 3 )
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
[gd_scene load_steps=9 format=2]
|
||||
|
||||
[ext_resource path="res://homunculus3.glb" type="PackedScene" id=1]
|
||||
[ext_resource path="res://RecombinationTest.gd" type="Script" id=2]
|
||||
[ext_resource path="res://homunculus3.tscn" type="PackedScene" id=3]
|
||||
|
||||
[sub_resource type="Environment" id=1]
|
||||
background_mode = 1
|
||||
|
||||
[sub_resource type="PlaneMesh" id=2]
|
||||
size = Vector2( 10, 10 )
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=3]
|
||||
albedo_color = Color( 0.478431, 0.478431, 0.478431, 1 )
|
||||
|
||||
[sub_resource type="CylinderMesh" id=4]
|
||||
top_radius = 0.5
|
||||
bottom_radius = 1.649
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=5]
|
||||
albedo_color = Color( 0.113725, 0.0862745, 0.0862745, 1 )
|
||||
metallic = 0.61
|
||||
|
||||
[node name="RecombinationStation" type="Spatial"]
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource( 1 )
|
||||
|
||||
[node name="Floor" type="MeshInstance" parent="."]
|
||||
mesh = SubResource( 2 )
|
||||
material/0 = SubResource( 3 )
|
||||
|
||||
[node name="Pedestal" type="MeshInstance" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00594401, 0.00560999, 0.00721848 )
|
||||
mesh = SubResource( 4 )
|
||||
material/0 = SubResource( 5 )
|
||||
script = ExtResource( 2 )
|
||||
Creature = ExtResource( 3 )
|
||||
|
||||
[node name="homunculus3" parent="Pedestal" instance=ExtResource( 1 )]
|
||||
transform = Transform( -1.62921e-08, 0, -0.1, 0, 0.1, 0, 0.1, 0, -1.62921e-08, -0.105591, 1.05245, 0 )
|
||||
visible = false
|
||||
|
||||
[node name="Camera" type="Camera" parent="."]
|
||||
transform = Transform( -4.37114e-08, 0.258819, -0.965926, 0, 0.965926, 0.258819, 1, 1.13133e-08, -4.2222e-08, -1.09989, 1.85265, -4.80778e-08 )
|
||||
|
||||
[node name="SpotLight" type="SpotLight" parent="."]
|
||||
transform = Transform( -4.37114e-08, 0.707107, -0.707107, 0, 0.707107, 0.707107, 1, 3.09086e-08, -3.09086e-08, -1.76577, 2.99932, 3.70767e-08 )
|
||||
light_color = Color( 1, 0.992157, 0.968627, 1 )
|
||||
light_energy = 4.04
|
||||
light_indirect_energy = 2.52
|
||||
spot_range = 8.0
|
||||
spot_attenuation = 3.13834
|
||||
spot_angle = 44.0
|
||||
spot_angle_attenuation = 1.18921
|
||||
|
||||
[node name="GUI" type="Control" parent="."]
|
||||
margin_right = 1920.0
|
||||
margin_bottom = 1080.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Respawn" type="Button" parent="GUI"]
|
||||
margin_right = 287.0
|
||||
margin_bottom = 67.0
|
||||
text = "Respawn"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
[connection signal="pressed" from="GUI/Respawn" to="Pedestal" method="_on_Respawn_pressed"]
|
||||
@@ -0,0 +1,65 @@
|
||||
tool
|
||||
|
||||
extends Node
|
||||
export (PackedScene) var Creature
|
||||
export (float) var mutation_rate = 0.05
|
||||
|
||||
var selected = []
|
||||
var rng = RandomNumberGenerator.new()
|
||||
const M_PI = 3.14
|
||||
|
||||
func _ready():
|
||||
rng.randomize()
|
||||
self.spawn_a_bitch()
|
||||
|
||||
func spawn_a_bitch():
|
||||
var c = Creature.instance()
|
||||
add_child(c)
|
||||
c.transform = c.transform.scaled(Vector3(0.1, 0.1, 0.1))
|
||||
c.transform = c.transform.translated(Vector3(0.0, 10.0, 0.0))
|
||||
c.transform = c.transform.rotated(Vector3(0.0, 1.0, 0.0), -0.5*M_PI)
|
||||
return c
|
||||
|
||||
func kill_a_bitch():
|
||||
var c = get_child(get_child_count()-1)
|
||||
if c:
|
||||
c.queue_free()
|
||||
|
||||
func combine_a_bitch():
|
||||
if selected.size() == 2:
|
||||
var new_dna = []
|
||||
for i in range(selected[0].dna.size()):
|
||||
if rng.randf() > 0.5:
|
||||
new_dna.append(selected[0].dna[i])
|
||||
else:
|
||||
new_dna.append(selected[1].dna[i])
|
||||
if rng.randf() <= mutation_rate:
|
||||
new_dna.append(!new_dna.pop_back())
|
||||
var new_child = spawn_a_bitch()
|
||||
new_child.dna = new_dna
|
||||
deselect_all()
|
||||
select(new_child)
|
||||
new_child.describe()
|
||||
new_child.set_color()
|
||||
|
||||
func deselect_all():
|
||||
selected = []
|
||||
|
||||
func select(creature):
|
||||
if selected.has(creature):
|
||||
creature.get_node("SelectionIndicator").visible = false;
|
||||
selected.erase(creature)
|
||||
else:
|
||||
selected.append(creature)
|
||||
creature.get_node("SelectionIndicator").visible = true;
|
||||
|
||||
func select_a_bitch(camera, event, click_position, click_normal, index, creature_id):
|
||||
if event.is_action_pressed("select_creature"):
|
||||
var kindeke = get_child(creature_id)
|
||||
select(kindeke)
|
||||
print(creature_id)
|
||||
|
||||
|
||||
func _on_Respawn_pressed():
|
||||
kill_a_bitch()
|
||||
spawn_a_bitch()
|
||||
+17
-3
File diff suppressed because one or more lines are too long
+1062
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,9 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://beast.glb" type="PackedScene" id=1]
|
||||
|
||||
[node name="beast" instance=ExtResource( 1 )]
|
||||
|
||||
[node name="AnimationPlayer" parent="." index="1"]
|
||||
autoplay = "Run"
|
||||
playback_default_blend_time = 977.75
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
extends Node
|
||||
|
||||
var rng = RandomNumberGenerator.new()
|
||||
var naampje = "Hans"
|
||||
var genotype = []
|
||||
# const DNA_SIZE = 173;
|
||||
const TRAITS = {
|
||||
"Arm": [1, 4, 5],
|
||||
"Leg": [2, 1, 2],
|
||||
"Head": [1, 2, 2, 2, 1],
|
||||
"Skin": [3, 3, 3, 3],
|
||||
"Penis": [2]
|
||||
}
|
||||
const TIERS_STRING = "12 3 1 23 12 3 4 51 2 3 4 1 "
|
||||
const TRAIT_STRING = "Arm Leg Head Skin Penis"
|
||||
const SKIN_COLORS = [
|
||||
Color("#000000"),
|
||||
Color("#ff0000"),
|
||||
Color("#0000ff"),
|
||||
Color("#ffff00"),
|
||||
Color("#ffffff"),
|
||||
Color("#888888"),
|
||||
Color("#ff0088"),
|
||||
Color("#ff8800"),
|
||||
Color("#8800ff"),
|
||||
Color("#0088ff"),
|
||||
Color("#880088"),
|
||||
Color("#333333")
|
||||
]
|
||||
const ARM_MODES = [
|
||||
"HandBase",
|
||||
"HandClaws",
|
||||
"HandBase",
|
||||
"HandBase",
|
||||
"HandBase",
|
||||
"HandBase",
|
||||
"HandBase",
|
||||
"HandBase",
|
||||
"HandBase",
|
||||
"HandBase"
|
||||
]
|
||||
|
||||
var SKIN_MATERIALS = [
|
||||
SpatialMaterial.new()
|
||||
]
|
||||
|
||||
func initialize():
|
||||
# Make one boolean per thing we need
|
||||
for i in range(TRAITS.size()):
|
||||
for j in range(TRAITS.values()[i].size()):
|
||||
for x in range(TRAITS.values()[i][j]):
|
||||
if rng.randf() > 0.1:
|
||||
genotype.append(false)
|
||||
else:
|
||||
genotype.append(true)
|
||||
|
||||
func sum(a):
|
||||
var sum = 0
|
||||
for i in range(a.size()):
|
||||
sum += a[i]
|
||||
return sum
|
||||
|
||||
func range_trait(name):
|
||||
var start = 0
|
||||
var end = 0
|
||||
for i in TRAITS:
|
||||
if i != name:
|
||||
start += sum(TRAITS[i])
|
||||
else:
|
||||
print(TRAITS[i])
|
||||
end = start+sum(TRAITS[i])
|
||||
break
|
||||
return range(start, end)
|
||||
|
||||
func describe():
|
||||
var TRAIT_DESC = "Has a %s trait of tier %d."
|
||||
var LATENT_DESC = " latent tier %d trait."
|
||||
var out = ""
|
||||
var d = 0
|
||||
var found_trait = false
|
||||
for i in range(TRAITS.size()):
|
||||
found_trait = false
|
||||
for j in range(TRAITS.values()[i].size()):
|
||||
for x in range(TRAITS.values()[i][j]):
|
||||
if !found_trait && genotype[d]:
|
||||
out += TRAIT_DESC % [TRAITS.keys()[i], j+1] + '\n'
|
||||
found_trait = true
|
||||
elif found_trait && genotype[d]:
|
||||
out += LATENT_DESC % [j+1] + '\n'
|
||||
d += 1
|
||||
var strand = ""
|
||||
for i in range(genotype.size()):
|
||||
if genotype[i]:
|
||||
strand += "1"
|
||||
else:
|
||||
strand += "0"
|
||||
out += strand + '\n'
|
||||
out += TIERS_STRING + '\n'
|
||||
out += TRAIT_STRING + '\n'
|
||||
return out
|
||||
|
||||
func set_color():
|
||||
var j = 0
|
||||
var x = 0
|
||||
for i in range_trait("Skin"):
|
||||
if genotype[i]:
|
||||
x = j
|
||||
break
|
||||
j += 1
|
||||
var mesh = get_node("Homunculus")
|
||||
var mat = mesh.get_surface_material(0).duplicate()
|
||||
mat.albedo_color = SKIN_COLORS[x]
|
||||
# mesh.set_surface_material(0, mat)
|
||||
SKIN_MATERIALS[0].albedo_color = SKIN_COLORS[x]
|
||||
mesh.set_surface_material(0, SKIN_MATERIALS[0])
|
||||
print(SKIN_COLORS[x])
|
||||
|
||||
func set_penis():
|
||||
var mesh = get_node("Homunculus/DongBigDick")
|
||||
for i in range_trait("Penis"):
|
||||
if genotype[i]:
|
||||
mesh.visible = true
|
||||
|
||||
func set_arm():
|
||||
var x = 0
|
||||
var j = 0
|
||||
for i in range_trait("Arm"):
|
||||
if genotype[i]:
|
||||
x = j
|
||||
break
|
||||
j += 1
|
||||
var set_true = ARM_MODES[x]
|
||||
var mesh = get_node("Homunculus/"+set_true)
|
||||
mesh.visible = true
|
||||
|
||||
func phenotype_it():
|
||||
set_color()
|
||||
set_penis()
|
||||
set_arm()
|
||||
|
||||
func _ready():
|
||||
rng.randomize()
|
||||
initialize()
|
||||
|
||||
print(describe())
|
||||
self.phenotype_it()
|
||||
#Register the selection event
|
||||
get_node("SelectionArea").connect('input_event', get_parent(), 'select_a_bitch', [get_index()])
|
||||
pass
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,37 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://homunculus3.glb" type="PackedScene" id=1]
|
||||
[ext_resource path="res://homunculus3.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=1]
|
||||
|
||||
[sub_resource type="CylinderShape" id=2]
|
||||
height = 7.0
|
||||
|
||||
[node name="homunculus3" instance=ExtResource( 1 )]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Homunculus" parent="." index="0"]
|
||||
material/0 = SubResource( 1 )
|
||||
|
||||
[node name="DongBigDick" parent="Homunculus" index="0"]
|
||||
visible = false
|
||||
|
||||
[node name="ForeheadHorns" parent="Homunculus" index="2"]
|
||||
visible = false
|
||||
|
||||
[node name="HandBase" parent="Homunculus" index="3"]
|
||||
visible = false
|
||||
|
||||
[node name="HandClaws" parent="Homunculus" index="4"]
|
||||
visible = false
|
||||
|
||||
[node name="TentaclesArms" parent="Homunculus" index="6"]
|
||||
visible = false
|
||||
|
||||
[node name="WingsBase" parent="Homunculus" index="7"]
|
||||
visible = false
|
||||
|
||||
[node name="SelectionArea" type="CollisionShape" parent="." index="1"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.01915, 0 )
|
||||
shape = SubResource( 2 )
|
||||
Reference in New Issue
Block a user