Skip to content
This repository was archived by the owner on Oct 28, 2022. It is now read-only.

Commit 3cf6696

Browse files
committedJul 2, 2021
clean up requirements-dev, fix priority stuff for matching, fix wingcap level randomization, add .vscode back to save debug config
1 parent b86da9a commit 3cf6696

File tree

10 files changed

+85
-229
lines changed

10 files changed

+85
-229
lines changed
 

‎.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ pip-selfcheck.json
1616
__pycache__
1717
.history
1818
.DS_Store
19-
.vscode
2019
env/
2120
.eggs/
2221
egg/

‎.vscode/launch.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Python: Launch Project",
9+
"type": "python",
10+
"request": "launch",
11+
"program": "main.py",
12+
"console": "integratedTerminal",
13+
"justMyCode": false,
14+
"cwd": "${workspaceFolder}",
15+
"args": [
16+
"--shuffle-objects",
17+
"--shuffle-entries",
18+
"--shuffle-skybox",
19+
"--shuffle-text",
20+
"--shuffle-colors",
21+
"--disable-cutscenes",
22+
"--shuffle-instruments",
23+
"SM64_US.z64"
24+
],
25+
"env": {
26+
"SM64R": "EXPORT"
27+
}
28+
}
29+
]
30+
}

‎.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python.pythonPath": "Scripts\\python.exe"
3+
}

‎Config/sm64.vanilla.yml

+19-6
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,15 @@ collision_groups:
503503
- SLIPPERY
504504

505505
# Start object randomization section. Can be deeply nested with groups, sub-group, etc
506+
# This segment will define all randomizable objects, that will be moved around in a level.
507+
# - Groups can be created (without a "match") property to organize multiple different objects together
508+
# - Matchings have a priority, defined by how much it matches an object in a level
509+
# - for example: a Coin is supposed to not spawn in the air too high. It is matching via it's behaviour id.
510+
# however, in a wingcap level coins *can* spawn in the air. So a more specific "match" with
511+
# both the behaviour id and a match for level that have been flagged "fly_stage" will have
512+
# priority over the previous matching, allowing you overwrite randomization settings in special
513+
# circumstances. Randomizations with a "for" property automatically have +1 priority, as they're
514+
# generally intended for special levels that should take priority.
506515
object_randomization:
507516
# default
508517
rules:
@@ -861,27 +870,31 @@ object_randomization:
861870
- 'Warps'
862871
rules:
863872
- disabled
864-
- name: "WC: Coins within Reach of Platform"
865-
match:
873+
- name: "TOTWC: Coins within Reach of Platform"
874+
match: # this matching is very specific to increase priority
866875
- course_property: fly_stage
867876
- course_id: 0x1D
877+
- area_id: 0x01
868878
rules:
869879
- no_floor_required
870880
- min_y: -2000
871-
- max_y: 2500
881+
- max_y: 2200
872882
- distance_to:
873883
- origin: [0, -2047, 0]
874-
max_distance: 3000
884+
max_distance: 5000
875885
for:
876886
- 'Coin'
877887
- 'Coin Formations'
878888
- name: "WMotR: Coins within Reach"
879-
match:
889+
match: # this matching is very specific to increase priority
890+
- course_property: fly_stage
880891
- course_id: 0x1F
892+
- area_id: 0x01
881893
rules:
894+
- no_floor_required
882895
- distance_to:
883896
- origin: [0, 1900, 0]
884-
max_distance: 5000
897+
max_distance: 6500
885898
- min_y: -3500
886899
- max_y: 2200
887900
for:

‎requirements-dev.txt

+7-210
Original file line numberDiff line numberDiff line change
@@ -1,212 +1,9 @@
1-
alabaster==0.7.12
2-
altgraph==0.16.1
3-
anaconda-client==1.7.2
4-
anaconda-navigator==1.9.7
5-
anaconda-project==0.8.2
6-
appnope==0.1.0
7-
appscript==1.0.1
8-
asn1crypto==0.24.0
9-
astroid==2.2.5
10-
astropy==3.1.2
11-
atomicwrites==1.3.0
12-
attrs==19.1.0
13-
Babel==2.6.0
14-
backcall==0.1.0
15-
backports.os==0.1.1
16-
backports.shutil-get-terminal-size==1.0.0
17-
beautifulsoup4==4.7.1
18-
bitarray==0.8.3
19-
bkcharts==0.2
20-
bleach==3.3.0
21-
bokeh==1.0.4
22-
boto==2.49.0
23-
Bottleneck==1.2.1
24-
certifi==2019.3.9
25-
cffi==1.12.2
26-
chardet==3.0.4
27-
Click==7.0
28-
cloudpickle==0.8.0
29-
clyent==1.2.2
30-
colorama==0.4.1
31-
colorlog==4.0.2
32-
conda==4.6.14
33-
conda-build==3.17.8
34-
conda-verify==3.1.1
35-
contextlib2==0.5.5
36-
cryptography==3.3.2
37-
cycler==0.10.0
38-
Cython==0.29.6
39-
cytoolz==0.9.0.1
40-
dask==1.1.4
41-
decorator==4.4.0
42-
defusedxml==0.5.0
43-
distributed==1.26.0
44-
docutils==0.14
45-
entrypoints==0.3
46-
et-xmlfile==1.0.1
47-
fastcache==1.0.2
48-
filelock==3.0.10
49-
Flask==1.0.2
50-
future==0.17.1
51-
gevent==1.4.0
52-
glob2==0.6
53-
gmpy2==2.0.8
54-
greenlet==0.4.15
55-
h5py==2.9.0
56-
heapdict==1.0.0
57-
html5lib==1.0.1
58-
idna==2.8
59-
imageio==2.5.0
60-
imagesize==1.1.0
61-
importlib-metadata==0.0.0
62-
ipykernel==5.1.0
63-
ipython==7.4.0
64-
ipython-genutils==0.2.0
65-
ipywidgets==7.4.2
66-
isort==4.3.16
67-
itsdangerous==1.1.0
68-
jdcal==1.4
69-
jedi==0.13.3
70-
Jinja2==2.11.3
71-
jsonschema==3.0.1
72-
jupyter==1.0.0
73-
jupyter-client==5.2.4
74-
jupyter-console==6.0.0
75-
jupyter-core==4.4.0
76-
jupyterlab==0.35.4
77-
jupyterlab-server==0.2.0
78-
keyring==18.0.0
79-
kiwisolver==1.0.1
80-
lazy-object-proxy==1.3.1
81-
libarchive-c==2.8
82-
lief==0.9.0
83-
llvmlite==0.28.0
84-
locket==0.2.0
85-
lxml==4.6.3
86-
macholib==1.11
87-
MarkupSafe==1.1.1
88-
matplotlib==3.0.3
89-
mccabe==0.6.1
90-
mistune==0.8.4
91-
mkl-fft==1.0.10
92-
mkl-random==1.0.2
93-
more-itertools==6.0.0
94-
mpmath==1.1.0
95-
msgpack==0.6.1
96-
multipledispatch==0.6.0
97-
navigator-updater==0.2.1
98-
nbconvert==5.4.1
99-
nbformat==4.4.0
100-
networkx==2.2
101-
nltk==3.4.5
102-
nose==1.3.7
103-
notebook==6.1.5
104-
numba==0.43.1
105-
numexpr==2.6.9
106-
numpy==1.20.0
107-
numpydoc==0.8.0
108-
olefile==0.46
109-
openpyxl==2.6.1
110-
packaging==19.0
111-
pandas==0.24.2
112-
pandocfilters==1.4.2
113-
parso==0.3.4
114-
partd==0.3.10
115-
path.py==11.5.0
116-
pathlib2==2.3.3
117-
patsy==0.5.1
118-
pefile==2019.4.18
119-
pep8==1.7.1
120-
pexpect==4.6.0
121-
pickleshare==0.7.5
122-
Pillow==8.2.0
123-
pkginfo==1.5.0.1
124-
plotly==3.10.0
125-
pluggy==0.9.0
126-
ply==3.11
127-
prometheus-client==0.6.0
128-
prompt-toolkit==2.0.9
129-
psutil==5.6.6
130-
ptyprocess==0.6.0
131-
py==1.10.0
132-
pycodestyle==2.5.0
133-
pycollada==0.6
134-
pycosat==0.6.3
135-
pycparser==2.19
136-
pycrypto==2.6.1
137-
pycurl==7.43.0.2
138-
pyflakes==2.1.1
139-
pyglet==1.3.2
140-
Pygments==2.7.4
141-
PyInstaller==3.4
142-
pylint==2.3.1
143-
pyodbc==4.0.26
144-
pyOpenSSL==19.0.0
145-
pyparsing==2.3.1
1+
numpy==1.18.1
2+
Pillow==7.0.0
3+
plotly==5.1.0
1464
pyperclip==1.7.0
147-
pyrsistent==0.14.11
148-
PySocks==1.6.8
149-
pytest==4.3.1
150-
pytest-arraydiff==0.3
151-
pytest-astropy==0.5.0
152-
pytest-doctestplus==0.3.0
153-
pytest-openfiles==0.3.2
154-
pytest-remotedata==0.3.1
155-
python-dateutil==2.8.0
156-
pytz==2018.9
157-
PyWavelets==1.0.2
158-
PyYAML==5.4
159-
pyzmq==18.0.0
160-
QtAwesome==0.5.7
161-
qtconsole==4.4.3
162-
QtPy==1.7.0
163-
requests==2.21.0
164-
retrying==1.3.3
165-
rope==0.12.0
5+
PyYAML==5.3
1666
Rtree==0.9.7
167-
ruamel-yaml==0.15.46
168-
scikit-image==0.14.2
169-
scikit-learn==0.20.3
170-
scipy==1.2.1
171-
seaborn==0.9.0
172-
Send2Trash==1.5.0
173-
Shapely==1.6.4.post2
174-
simplegeneric==0.8.1
175-
singledispatch==3.4.0.3
176-
six==1.12.0
177-
snowballstemmer==1.2.1
178-
sortedcollections==1.1.2
179-
sortedcontainers==2.1.0
180-
soupsieve==1.8
181-
Sphinx==1.8.5
182-
sphinxcontrib-websupport==1.1.0
183-
spyder==3.3.3
184-
spyder-kernels==0.4.2
185-
SQLAlchemy==1.3.1
186-
statsmodels==0.9.0
187-
svg.path==3.0
188-
sympy==1.3
189-
tables==3.5.1
190-
tblib==1.3.2
191-
terminado==0.8.1
192-
testpath==0.4.2
193-
toolz==0.9.0
194-
tornado==6.0.2
195-
tqdm==4.31.1
196-
traitlets==4.3.2
197-
trimesh==2.38.26
198-
unicodecsv==0.14.1
199-
urllib3==1.26.5
200-
wcwidth==0.1.7
201-
webencodings==0.5.1
202-
Werkzeug==0.15.3
203-
widgetsnbextension==3.4.2
204-
wrapt==1.11.1
205-
wurlitzer==1.0.2
206-
xlrd==1.2.0
207-
XlsxWriter==1.1.5
208-
xlwings==0.15.4
209-
xlwt==1.3.0
210-
xxhash==1.3.0
211-
zict==0.1.4
212-
zipp==0.3.3
7+
six==1.16.0
8+
tenacity==7.0.0
9+
trimesh==3.5.19

‎sm64r/Config.py

+4
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,7 @@ def parse_object_table(self, table, rules = None, match = None, exclude = None):
579579
**target_rules,
580580
**rules,
581581
},
582+
from_for=True,
582583
name=f"{name}: {target['name']}"
583584
))
584585

@@ -604,6 +605,7 @@ def parse_object_table(self, table, rules = None, match = None, exclude = None):
604605
**child_exclude,
605606
**parent_exclude
606607
},
608+
from_for=True,
607609
name=f"{name}: {child['name']}"
608610
))
609611

@@ -641,6 +643,7 @@ def parse_object_table(self, table, rules = None, match = None, exclude = None):
641643
**target_rules,
642644
**rules,
643645
},
646+
from_for=True,
644647
name=f"{name}: {target['name']}"
645648
))
646649

@@ -667,6 +670,7 @@ def parse_object_table(self, table, rules = None, match = None, exclude = None):
667670
**child_exclude,
668671
**parent_exclude
669672
},
673+
from_for=True,
670674
name=f"{name}: {child['name']}"
671675
))
672676

‎sm64r/Entities/LevelGeometry.py

+2
Original file line numberDiff line numberDiff line change
@@ -455,5 +455,7 @@ def plot(self):
455455
)
456456

457457
#print(f'plotting {self.level.name} {hex(area_id)}')
458+
if not os.path.exists("dumps/level_plots"):
459+
os.makedirs("dumps/level_plots")
458460
py.plot(traces, filename=f'dumps/level_plots/{self.level.name}_{hex(area_id)}.html', auto_open=False)
459461
#print('done')

‎sm64r/RandomModules/Objects/Whitelist.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,13 @@ def matches_with(self, matching, object3d):
103103
def get_shuffle_properties(self, object3d : Object3D):
104104
best_match = None
105105
best_match_count = 0
106+
107+
# check against all matching/whitelist entries
106108
for whitelist_entry in self.object_whitelist:
107109
if whitelist_entry["match"] is None:
108110
continue
109111

112+
# if whitelist entry has an exclude property, see if we can skip this entry
110113
if whitelist_entry["exclude"] is not None:
111114
_, match_exclude = self.matches_with(whitelist_entry["exclude"], object3d)
112115

@@ -115,12 +118,12 @@ def get_shuffle_properties(self, object3d : Object3D):
115118

116119
# the more precise the matching, the more priority it will have
117120
matches, did_match = self.matches_with(whitelist_entry["match"], object3d)
121+
122+
# increase priority for matches from "for" rules
123+
if "from_for" in whitelist_entry and whitelist_entry["from_for"]:
124+
matches += 1
125+
118126
if did_match and matches > best_match_count:
119-
120-
#if best_match is not None and object3d.behaviour == 0x13002aa4:
121-
# print("replacing rule ", best_match)
122-
# print("with rule ", whitelist_entry)
123-
124127
best_match = whitelist_entry
125128
best_match_count = matches
126129
return best_match

‎sm64r/RandomModules/Objects/__init__.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -306,23 +306,23 @@ def is_valid_position(self, levelscript : LevelScriptParser, obj : Object3D,posi
306306
self.log_reason_for_reject("is_valid_position", "object position above max_y")
307307
return False
308308

309-
if "distance" in rules:
310-
for distance_rules in rules["distance"]:
311-
origin = distance_rules["origin"]
309+
if "distance_to" in rules:
310+
for distance_rule in rules["distance_to"]:
311+
origin = distance_rule["origin"]
312312

313313
distance = math.sqrt(
314314
(position[0] - origin[0]) ** 2 +
315315
(position[1] - origin[1]) ** 2 +
316316
(position[2] - origin[2]) ** 2
317317
)
318318

319-
if "max_distance" in distance_rules:
320-
if distance > distance_rules["max_distance"]:
319+
if "max_distance" in distance_rule:
320+
if distance > distance_rule["max_distance"]:
321321
self.log_reason_for_reject("is_valid_position", "object too far away from origin")
322322
return False
323323

324-
if "min_distance" in distance_rules:
325-
if distance > distance_rules["min_distance"]:
324+
if "min_distance" in distance_rule:
325+
if distance > distance_rule["min_distance"]:
326326
self.log_reason_for_reject("is_valid_position", "object too close to origin")
327327
return False
328328

@@ -524,6 +524,8 @@ def generate_random_point_for(self, levelscript : LevelScriptParser, obj : Objec
524524
(bounds_min, bounds_max) = area_mesh.bounds
525525
(x, y, z) = bounds_min
526526

527+
# TODO: Check the rules here to more accurately set a bounding box in which to randomize, shits unoptimized yo
528+
527529
# position for boundary is slightly overshot, probably because of some shit i forgot to write here while it happened
528530
if abs(bounds_min[0] - bounds_max[0]) > 0:
529531
x = random.randrange(bounds_min[0] + 1000, bounds_max[0] - 1000)

‎sm64r/Rom.py

+3
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ def read_levels(self):
204204

205205
if 'SM64R' in os.environ:
206206
if os.environ['SM64R'] == 'EXPORT':
207+
if not os.path.exists(os.path.join("dumps", "level_geometry")):
208+
os.makedirs(os.path.join("dumps", "level_geometry"))
209+
207210
for (area_id, mesh) in self.levelscripts[level].level_geometry.area_geometries.items():
208211
with open(os.path.join("dumps", "level_geometry", f"{level.name}_{hex(area_id)}.stl"), "wb+") as obj_output:
209212
mesh.export(obj_output, 'stl')

0 commit comments

Comments
 (0)
This repository has been archived.