Skip to content

Commit 756f755

Browse files
authored
Numeric parameters schema, speed keep example (#2646)
1 parent bec5ce5 commit 756f755

12 files changed

Lines changed: 275 additions & 131 deletions

helpers.json

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -462,16 +462,6 @@
462462
{"ammo": {"type": "PowerBomb","count": 2}}
463463
]
464464
},
465-
{
466-
"name": "h_speedKeepSpikeHitLeniency",
467-
"requires": [
468-
"h_XModeSpikeHitLeniency"
469-
],
470-
"devNote": [
471-
"Since a (spike) speed keep requires a frame-perfect unmorph with the same timing as spike X-mode,",
472-
"it is a reasonable default to have them share the same lenience."
473-
]
474-
},
475465
{
476466
"name": "h_extendedMoondanceBeetomLeniency",
477467
"requires": [
@@ -1579,13 +1569,6 @@
15791569
"In this case, the total leniency is the base leniency h_XModeThornHitLeniency multiplied by the number of hits."
15801570
]
15811571
},
1582-
{
1583-
"name": "h_speedKeepSpikeHit",
1584-
"requires": [
1585-
{"spikeHits": 1},
1586-
"h_speedKeepSpikeHitLeniency"
1587-
]
1588-
},
15891572
{
15901573
"name": "h_XRayMorphIceClip",
15911574
"requires": [

numerics.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"$schema": "./schema/m3-numerics.schema.json",
3+
"numericCategories": [
4+
{
5+
"name": "Base Parameters",
6+
"description": "Parameters that may commonly be changed, e.g. based on a randomizer implementation or settings.",
7+
"numerics": [
8+
{
9+
"name": "n_speedKeepLenience",
10+
"minimum": 0,
11+
"value": 5,
12+
"note": "Number of failed attempts expected before a successful speed-keep.",
13+
"devNote": "This applies to speed-keeps on spikes or thorns, performing a frame-perfect unmorph."
14+
}
15+
]
16+
},
17+
{
18+
"name": "Derived Parameters",
19+
"description": "Parameters defined in terms of the base parameters.",
20+
"numerics": [
21+
{
22+
"name": "n_speedKeepAttempts",
23+
"minimum": 1,
24+
"value": {"add": ["n_speedKeepLenience", 1]},
25+
"note": "Total number of attempts expected for a successful speed-keep."
26+
}
27+
]
28+
}
29+
]
30+
}

readme.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,37 @@ This project's representation of Super Metroid is split-up between different fol
1313

1414
### Regions
1515

16-
[A folder that details the game's rooms](region/region-readme.md)
16+
The [region](region/region-readme.md) folder defines the logic for each of the game's rooms. This is where the bulk of the data for the project is found.
1717

1818
### Connections
1919

20-
[A folder that details connections between the game's rooms](connection/connection-readme.md)
20+
The [connections](connection/connection-readme.md) folder defines how the doors of each room are connected to neighboring rooms.
2121

2222
### Enemies
2323

24-
[A folder that details the game's enemies](enemies/enemies-readme.md)
24+
The [enemies](enemies/enemies-readme.md) folder details the game's enemies.
2525

2626
### Weapons
2727

28-
[A folder that details possible types of attacks](weapons/weapons-readme.md)
28+
The [weapons](weapons/weapons-readme.md) folder details Samus' possible attacks.
2929

3030
### helpers.json
3131

32-
A file that defines helper functions. They are [logical requirement](logicalRequirements.md) expressions that are used frequently, and prevent having to copy the same thing all over the place.
32+
The [helpers.json](helpers.json) file defines helper functions. They are [logical requirement](logicalRequirements.md) expressions that are used frequently, and prevent having to copy the same thing all over the place.
33+
34+
### numerics.json
35+
36+
The [numerics.json](numerics.json) file defines leniency values for techniques that may
37+
require multiple attempts to succeed. It provides default values which may be overridden
38+
by randomizers or other tools depending on the desired difficulty.
3339

3440
### items.json
3541

36-
A file that contains a lot of the initial game state configuration. It contains all existing items and game flags, as well as starting items, resources, game flags, open locks, and location.
42+
The [items.json](items.json) file that contains a lot of the initial game state configuration. It contains all existing items and game flags, as well as starting items, resources, game flags, open locks, and location.
3743

3844
### tech.json
3945

40-
A file that contains techs and their [logical requirements](logicalRequirements.md). Techs are in-game techniques that players might want to be able to logically turn off.
46+
The [tech.json](tech.json) file contains techs and their [logical requirements](logicalRequirements.md). Techs are in-game techniques that players might want to be able to logically turn off.
4147

4248
At the first level, the techs are grouped into broad tech categories. Each category contains an array of techs.
4349

region/crateria/central/Climb Supers Room.json

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -291,15 +291,14 @@
291291
"requires": [
292292
"canSpeedKeep",
293293
{"canShineCharge": {"usedTiles": 21, "openEnd": 2}},
294-
"h_speedKeepSpikeHit",
295-
"h_speedKeepSpikeHit",
296-
"h_speedKeepSpikeHit",
294+
{"spikeHits": {"mul": [3, "n_speedKeepAttempts"]}},
297295
{"spikeHits": 1},
298296
"h_spikeSuitSpikeHitLeniency",
299297
"canPatientSpikeSuit",
300298
{"shinespark": {"frames": 6, "excessFrames": 2}}
301299
],
302-
"flashSuitChecked": true
300+
"flashSuitChecked": true,
301+
"devNote": "FIXME: the lenience needs to multiply speed keep attempts and spike suit attempts."
303302
},
304303
{
305304
"id": 94,
@@ -310,15 +309,14 @@
310309
"canSpeedKeep",
311310
{"doorUnlockedAtNode": 1},
312311
{"canShineCharge": {"usedTiles": 13, "openEnd": 1}},
313-
"h_speedKeepSpikeHit",
314-
"h_speedKeepSpikeHit",
315-
"h_speedKeepSpikeHit",
312+
{"spikeHits": {"mul": [3, "n_speedKeepAttempts"]}},
316313
{"spikeHits": 1},
317314
"h_spikeSuitSpikeHitLeniency",
318315
"canPatientSpikeSuit",
319316
{"shinespark": {"frames": 6, "excessFrames": 2}}
320317
],
321-
"flashSuitChecked": true
318+
"flashSuitChecked": true,
319+
"devNote": "FIXME: the lenience needs to multiply speed keep attempts and spike suit attempts."
322320
},
323321
{
324322
"id": 81,
@@ -985,13 +983,12 @@
985983
"canChainTemporaryBlue",
986984
"can4HighMidAirMorph",
987985
"canSpeedKeep",
988-
"h_speedKeepSpikeHit",
989-
"h_speedKeepSpikeHitLeniency",
986+
{"spikeHits": {"add": ["n_speedKeepAttempts", "n_speedKeepLenience"]}},
990987
"canSpeedball"
991988
],
992989
"flashSuitChecked": true,
993990
"note": [
994-
"Bounce into the spikes and use a SpeedKeep to run on spikes to setup for a speedball towards the item.",
991+
"Bounce into the spikes and use a speedkeep to run on spikes to setup for a speedball towards the item.",
995992
"Bouncing on the platform near the door saves a spike hit."
996993
],
997994
"devNote": [
@@ -1014,14 +1011,14 @@
10141011
"canCarefulJump",
10151012
"canSlowShortCharge",
10161013
"can4HighMidAirMorph",
1017-
"h_speedKeepSpikeHit",
1014+
{"spikeHits": "n_speedKeepAttempts"},
10181015
"canSpeedball"
10191016
],
10201017
"flashSuitChecked": true,
10211018
"note": [
1022-
"Bounce into the spikes and use a SpeedKeep to run on spikes to setup for a speedball towards the item.",
1019+
"Bounce into the spikes and use a speedkeep to run on spikes to setup for a speedball towards the item.",
10231020
"Bouncing on the platform near the door saves a spike hit.",
1024-
"Or a DamageBoost SpeedKeep could be used instead of a Spike SpeedKeep with enough runspeed."
1021+
"Or a damage boost speedkeep could be used instead of a spike speedkeep with enough runspeed."
10251022
]
10261023
},
10271024
{
@@ -1038,20 +1035,20 @@
10381035
"canSpeedKeep",
10391036
"canCarefulJump",
10401037
{"getBlueSpeed": {"usedTiles": 21, "openEnd": 2}},
1041-
"h_speedKeepSpikeHit",
1038+
{"spikeHits": "n_speedKeepAttempts"},
10421039
{"or": [
1043-
"h_speedKeepSpikeHit",
1040+
{"spikeHits": "n_speedKeepAttempts"},
10441041
{"and": [
10451042
"canChainTemporaryBlue",
1046-
"h_speedKeepSpikeHitLeniency"
1043+
{"spikeHits": "n_speedKeepLenience"}
10471044
]}
10481045
]},
10491046
"canSpeedball"
10501047
],
10511048
"flashSuitChecked": true,
10521049
"note": [
1053-
"Bounce into the spikes and use a SpeedKeep to run on spikes to setup for a speedball towards the item.",
1054-
"A DamageBoost SpeedKeep could be used instead of a Spike SpeedKeep with enough runspeed."
1050+
"Bounce into the spikes and use a speedkeep to run on spikes to setup for a speedball towards the item.",
1051+
"A damage boost speedkeep could be used instead of a spike speedkeep with enough runspeed."
10551052
],
10561053
"devNote": [
10571054
"The extra lenience is because of the need to either to perform a very precise jump off the spikes,",
@@ -1071,26 +1068,31 @@
10711068
{"and": [
10721069
"canChainTemporaryBlue",
10731070
{"getBlueSpeed": {"usedTiles": 13, "openEnd": 1}},
1074-
"h_speedKeepSpikeHit"
1071+
{"spikeHits": "n_speedKeepAttempts"}
10751072
]},
10761073
{"and": [
10771074
{"getBlueSpeed": {"usedTiles": 14, "openEnd": 1}},
1078-
"h_speedKeepSpikeHit",
1079-
"h_speedKeepSpikeHit"
1075+
{"spikeHits": {"mul": [2, "n_speedKeepAttempts"]}}
10801076
]},
10811077
{"and": [
10821078
"canChainTemporaryBlue",
1083-
"h_speedKeepSpikeHit",
1084-
"h_speedKeepSpikeHit",
1085-
"h_speedKeepSpikeHit"
1079+
{"spikeHits": {"mul": [
1080+
{"add": ["n_speedKeepAttempts", 2]},
1081+
"n_speedKeepAttempts"
1082+
]}}
10861083
]}
10871084
]},
10881085
"canSpeedball"
10891086
],
10901087
"flashSuitChecked": true,
10911088
"note": [
1092-
"Using only the short runway and spike pit, use one or two SpeedKeeps to Speedball towards the item location.",
1093-
"This requires either a very short shortcharge, or a second SpeedKeep in the spikes which also resets Samus' run speed with a crouch jump before spike i-frames expire."
1089+
"Using only the short runway and spike pit, use one or two speedkeeps to speedball towards the item location.",
1090+
"This requires either a very short shortcharge, or a second speedkeep in the spikes which also resets Samus' run speed with a crouch jump before spike i-frames expire."
1091+
],
1092+
"devNote": [
1093+
"1 - Stop and bounce on left ledge.",
1094+
"2 - Jump from ledge and bounce in spikes.",
1095+
"3 - Stop and bounce on left ledge, then stop in spikes and speedkeep again."
10941096
]
10951097
},
10961098
{

region/wreckedship/main/Bowling Alley.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -948,9 +948,7 @@
948948
"f_DefeatedPhantoon",
949949
"canSpeedKeep",
950950
"h_shinechargeMaxRunway",
951-
"h_speedKeepSpikeHit",
952-
"h_speedKeepSpikeHit",
953-
"h_speedKeepSpikeHit",
951+
{"spikeHits": {"mul": [3, "n_speedKeepAttempts"]}},
954952
{"shineChargeFrames": 145}
955953
],
956954
"exitCondition": {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$comment": "DO NOT EDIT THIS FILE MANUALLY. IT IS AUTO-GENERATED BY scripts/update_schema.py",
3+
"$schema": "http://json-schema.org/draft-07/schema#",
4+
"$id": "https://raw.githubusercontent.com/vg-json-data/sm-json-data/master/schema/m3-numeric-parameters.schema.json",
5+
"type": "string",
6+
"enum": [
7+
"n_speedKeepLenience",
8+
"n_speedKeepAttempts"
9+
]
10+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://raw.githubusercontent.com/vg-json-data/sm-json-data/master/schema/m3-numeric-value.schema.json",
4+
"definitions": {
5+
"nonNegativeIntegerValue": {
6+
"oneOf": [
7+
{
8+
"type": "integer",
9+
"minimum": 0
10+
},
11+
{
12+
"type": "string",
13+
"$ref": "m3-numeric-parameters.schema.json"
14+
},
15+
{
16+
"type": "object"
17+
}
18+
],
19+
"default": 1,
20+
"description": "A numeric value expressed in terms of constants, parameters, and/or arithmetic operations",
21+
"additionalProperties": false,
22+
"properties": {
23+
"add": {
24+
"type": "array",
25+
"description": "Sum of list of values (addition)",
26+
"minItems": 2,
27+
"items": {
28+
"$ref": "#/definitions/nonNegativeIntegerValue"
29+
}
30+
},
31+
"mul": {
32+
"type": "array",
33+
"description": "Product of list of values (multiplication)",
34+
"minItems": 2,
35+
"items": {
36+
"$ref": "#/definitions/nonNegativeIntegerValue"
37+
}
38+
}
39+
}
40+
}
41+
}
42+
}

schema/m3-numerics.schema.json

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://raw.githubusercontent.com/vg-json-data/sm-json-data/master/schema/m3-numerics.schema.json",
4+
"type": "object",
5+
"additionalProperties": false,
6+
"properties": {
7+
"$schema": {
8+
"type": "string",
9+
"description": "A path to the definition of this file's JSON schema."
10+
},
11+
"numericCategories": {
12+
"type": "array",
13+
"description": "An array of 'numeric' categories",
14+
"items": {
15+
"type": "object",
16+
"description": "A group of numeric parameters in a specific category",
17+
"required": [
18+
"name",
19+
"description",
20+
"numerics"
21+
],
22+
"additionalProperties": false,
23+
"properties": {
24+
"name": {
25+
"type": "string",
26+
"description": "The name of this numeric category",
27+
"pattern": "^(.*)$"
28+
},
29+
"description": {
30+
"type": "string",
31+
"description": "A description of this numeric category",
32+
"pattern": "^(.*)$"
33+
},
34+
"numerics": {
35+
"type": "array",
36+
"description": "An array of numeric parameters, describing leniency amounts or other quantities",
37+
"items": {
38+
"type": "object",
39+
"description": "A numeric parameter that describes a leniency amount or other quantity",
40+
"required": [
41+
"name",
42+
"value"
43+
],
44+
"additionalProperties": false,
45+
"properties": {
46+
"name": {
47+
"type": "string",
48+
"description": "The name of this numeric parameter, to be referenced in logical requirements",
49+
"pattern": "^(.*)$"
50+
},
51+
"value": {
52+
"$ref" : "m3-numeric-value.schema.json#/definitions/nonNegativeIntegerValue",
53+
"description": "The default value of this numeric parameter"
54+
},
55+
"minimum": {
56+
"type": "integer",
57+
"minimum": 0,
58+
"description": "The minimum allowable value of this numeric parameter"
59+
},
60+
"maximum": {
61+
"type": "integer",
62+
"minimum": 0,
63+
"description": "The maximum allowable value of this numeric parameter"
64+
},
65+
"note": {
66+
"$ref" : "m3-note.schema.json#/definitions/note"
67+
},
68+
"devNote": {
69+
"$ref" : "m3-note.schema.json#/definitions/devNote"
70+
}
71+
}
72+
}
73+
}
74+
}
75+
}
76+
}
77+
}
78+
}

0 commit comments

Comments
 (0)