fixed checksum and added seed-based chest spawning order

This commit is contained in:
Derek
2025-03-28 08:35:21 -05:00
parent 97bb2c9852
commit 1422992c13
8 changed files with 31 additions and 42 deletions

View File

@@ -10,6 +10,7 @@ win_conditions = 0
survival_time = 160.0 survival_time = 160.0
max_number_of_chests = 3 max_number_of_chests = 3
money_lost_multiplier = 0.5 money_lost_multiplier = 0.5
die_on_leaving_bounds = true
weapon_penalty = 0 weapon_penalty = 0
weapon_drop_percentage = 0.5 weapon_drop_percentage = 0.5
ammo_drop_percentage = 0.5 ammo_drop_percentage = 0.5

View File

@@ -10,6 +10,7 @@ win_conditions = 0
survival_time = 160.0 survival_time = 160.0
max_number_of_chests = 3 max_number_of_chests = 3
money_lost_multiplier = 0.5 money_lost_multiplier = 0.5
die_on_leaving_bounds = true
weapon_penalty = 0 weapon_penalty = 0
weapon_drop_percentage = 0.5 weapon_drop_percentage = 0.5
ammo_drop_percentage = 0.5 ammo_drop_percentage = 0.5

View File

@@ -40,6 +40,5 @@ script = ExtResource("1_qvqs2")
maps_in_rotation = Array[ExtResource("2_3l62y")]([SubResource("Resource_3w5k4"), SubResource("Resource_t5q6w"), SubResource("Resource_2pkld"), SubResource("Resource_13n7k")]) maps_in_rotation = Array[ExtResource("2_3l62y")]([SubResource("Resource_3w5k4"), SubResource("Resource_t5q6w"), SubResource("Resource_2pkld"), SubResource("Resource_13n7k")])
gamemodes_in_rotation = Array[ExtResource("2_hoyqc")]([ExtResource("2_85uje"), ExtResource("3_t0mxh"), ExtResource("4_8wht4"), ExtResource("6_vu1w7")]) gamemodes_in_rotation = Array[ExtResource("2_hoyqc")]([ExtResource("2_85uje"), ExtResource("3_t0mxh"), ExtResource("4_8wht4"), ExtResource("6_vu1w7")])
chest_drops = Array[Resource]([ExtResource("8_hewbh")]) chest_drops = Array[Resource]([ExtResource("8_hewbh")])
chests_per_match = null
[connection signal="gui_input" from="." to="." method="_on_gui_input"] [connection signal="gui_input" from="." to="." method="_on_gui_input"]

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=17 format=3 uid="uid://otkecr0hcyon"] [gd_scene load_steps=18 format=3 uid="uid://otkecr0hcyon"]
[ext_resource type="PackedScene" uid="uid://bj1y0fbjtul4a" path="res://post_processing.tscn" id="1_48lr2"] [ext_resource type="PackedScene" uid="uid://bj1y0fbjtul4a" path="res://post_processing.tscn" id="1_48lr2"]
[ext_resource type="PackedScene" uid="uid://drwae3loscbw7" path="res://assets/player.tscn" id="1_ibypk"] [ext_resource type="PackedScene" uid="uid://drwae3loscbw7" path="res://assets/player.tscn" id="1_ibypk"]
@@ -10,6 +10,7 @@
[ext_resource type="PackedScene" uid="uid://c0uv33kbndbvy" path="res://assets/trashcan.tscn" id="8_7e18o"] [ext_resource type="PackedScene" uid="uid://c0uv33kbndbvy" path="res://assets/trashcan.tscn" id="8_7e18o"]
[ext_resource type="PackedScene" uid="uid://dyu46bns8mesv" path="res://assets/mac10_pickup.tscn" id="9_7e18o"] [ext_resource type="PackedScene" uid="uid://dyu46bns8mesv" path="res://assets/mac10_pickup.tscn" id="9_7e18o"]
[ext_resource type="PackedScene" uid="uid://dugcxo2665me0" path="res://assets/revolver1_pickup.tscn" id="10_20m5p"] [ext_resource type="PackedScene" uid="uid://dugcxo2665me0" path="res://assets/revolver1_pickup.tscn" id="10_20m5p"]
[ext_resource type="PackedScene" uid="uid://dgapcuvg0gtmm" path="res://assets/scene_changer.tscn" id="11_titu4"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_48lr2"] [sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_48lr2"]
sky_horizon_color = Color(0.662243, 0.671743, 0.686743, 1) sky_horizon_color = Color(0.662243, 0.671743, 0.686743, 1)
@@ -237,3 +238,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -19.1056, 3.01416, -13.8355)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -19.6736, 6.57787, -17.6494) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -19.6736, 6.57787, -17.6494)
[node name="Tubes" type="Node3D" parent="."] [node name="Tubes" type="Node3D" parent="."]
[node name="Scene Changer" parent="Tubes" instance=ExtResource("11_titu4")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -9.07024, -64.2195, -11.6417)

View File

@@ -3,7 +3,7 @@
[ext_resource type="Script" uid="uid://euykrpkb4h0m" path="res://scripts/scene_changer.gd" id="1_7ngxb"] [ext_resource type="Script" uid="uid://euykrpkb4h0m" path="res://scripts/scene_changer.gd" id="1_7ngxb"]
[sub_resource type="SphereShape3D" id="SphereShape3D_idsnf"] [sub_resource type="SphereShape3D" id="SphereShape3D_idsnf"]
radius = 5.0 radius = 4.0
[sub_resource type="SphereMesh" id="SphereMesh_wfy04"] [sub_resource type="SphereMesh" id="SphereMesh_wfy04"]

View File

@@ -32,15 +32,9 @@ func weighted_random(choices):
sum_of_choices += choices[i] sum_of_choices += choices[i]
var random_number = randf_range(0,sum_of_choices) var random_number = randf_range(0,sum_of_choices)
print("----------------------------------------------------------------")
print("CHOICES: ",choices)
print("SUM OF CHOICES: ",sum_of_choices)
print("RANDOM NUMBER: ",random_number)
for i in choices: for i in choices:
if random_number < choices[i]: if random_number < choices[i]:
print("SELECTION: ", i)
print("----------------------------------------------------------------")
return i return i
random_number -= choices[i] random_number -= choices[i]
@@ -54,37 +48,21 @@ func only_valid_chars(input_string: String) -> String:
return valid_chars return valid_chars
func checksum(check_data): func checksum(check_data):
var mult = 0.0
var div : float = 0.0
var checksum : float = 0.0
var index = 0.0
var checksum_array = []
#hash all passed-in data and add to new array
for data in check_data: for data in check_data:
#get value from names var hashed_data = hash(data)
if data is String: checksum_array.append(hashed_data)
var stringnumber = 0
var letter_index = 0
for char in data:
if char.is_valid_identifier():
if letter_to_number.has(char.to_upper()):
stringnumber += letter_to_number[char.to_upper()]
letter_index += 1
print("stringnumber : ",stringnumber)
data = stringnumber + letter_index
if data == null or data ==0:
data = TAU
if data > div:
div = data
if index == 0:
mult = PI * data
checksum += mult * data
mult = PI * data
print("DATA : ",data," | MULT : ",mult)
index += 1
checksum = checksum/div #add together
print(checksum) var checksum_final = 0
return checksum for num in checksum_array:
if num is int:
checksum_final += num
#finally, re-hash
checksum_final = hash(checksum_final)
return checksum_final

View File

@@ -44,13 +44,20 @@ func generate_playlist() -> void:
chests.append(chest_details) chests.append(chest_details)
chest_serial_no += 1 chest_serial_no += 1
var match_details = {"round" : round,"chests" : chests} var numbers = []
for i in range(chests_per_match):
numbers.append(i+1)
numbers.shuffle()
var match_details = {"round" : round,"chests" : chests,"chest_order" : numbers}
matches.append(match_details) matches.append(match_details)
playlist.append(matches) playlist.append(matches)
print(playlist[0][0]["round"][0]) print(playlist[0][0]["round"][0])
print(playlist[0][0]["chests"][3]) print(playlist[0][0]["chests"][3])
print(playlist[0][0]["chest_order"])
GameGlobals.playlist = playlist GameGlobals.playlist = playlist
func only_valid_chars(input_string: String) -> String: func only_valid_chars(input_string: String) -> String:

View File

@@ -326,7 +326,6 @@ func mark_anim_rot():
var time = anim_player.current_animation_position var time = anim_player.current_animation_position
var rot = anim_rot_body.rotation var rot = anim_rot_body.rotation
var pos = anim_rot_body.position var pos = anim_rot_body.position
print("MARK STATS : ",{"time" : time,"rot" : rot,"pos" : pos})
spawn_av_lv.append({"time" : time,"rot" : rot,"pos" : pos}) spawn_av_lv.append({"time" : time,"rot" : rot,"pos" : pos})
func solve_anim_av_lv(): func solve_anim_av_lv():