Skip to content

Commit

Permalink
! Port all source documentation to DocLang
Browse files Browse the repository at this point in the history
All JSON structures (besides UI1) have been documented in DocLang.
The source files have a .docl extension and can be found in the
doc/game/data directory.

Right now, only JSON schemas are built from these files. This will
extend to HTML documentation and config classes soon.

Changes in doc/game/generate.py:
- Fixed multiline descriptions (use \n, don't do line breaks!).
- Added reference types ($file, Class, #) and multitypes.
- Fixed enum object choices with no additional fields.
- Added objects with possibility of any keys.
- "required" field will no longer generate if it's empty.
  • Loading branch information
jakubg1 committed Aug 20, 2023
1 parent 2b2dd17 commit a252642
Show file tree
Hide file tree
Showing 54 changed files with 1,219 additions and 273 deletions.
9 changes: 9 additions & 0 deletions doc/game/data/config.docl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- (object) - The root object.
- name* (string) - The game name to be displayed in Rich Presence and in the game window.
- windowTitle* (string) - The window title which the engine window will have, if defined.
- engineVersion (string) - Specifies the version a game is for. Not really used at the moment, but mandatory.
- nativeResolution (Vector2) - The native resolution of the game.
- richPresence (object) - Defines the Discord Rich Presence behavior.
- enabled (boolean) - Should be always `true`, unless you want the game to be a secret. In that case, loading a game with this flag set to `false` causes Rich Presence to disconnect.
- applicationID* (string) - Optional. If defined, this will be used as an Application ID when running this game, instead of the default OpenSMCE one.
- useUI2* (boolean) - Enables experimental UI2 support. The game will launch using UI2 instead of legacy UI.
11 changes: 11 additions & 0 deletions doc/game/data/config/collectible.docl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- (object) - The root object.
- particle (Particle) - A persistent particle packet which will follow the collectible entity.
- pickupParticle (Particle) - A one-time particle packet which will be launched when the collectible is catched.
- spawnSound (SoundEvent) - A sound event which will play when the collectible is spawned.
- pickupSound (SoundEvent) - A sound event which will play when the collectible is collected.
- pickupName* (string) - A label which will appear above the shooter when the powerup is collected.
- pickupFont* (Font) - A font which will be used for the label.
- effects* (array) - A list of effects to be applied when the powerup is collected.
- ($collectible_effect) - A single collectible effect.
- dropEffects* (array) - A list of effects to be applied when the powerup is not collected and falls out of the screen.
- ($collectible_effect) - A single collectible effect.
31 changes: 31 additions & 0 deletions doc/game/data/config/collectible_effect.docl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
- (object) {type: A collectible effect type.} - A collectible effect.
- "replaceSphere" - Replaces the current sphere the shooter has with a defined sphere. This can be used to spawn otherwise unobtainable bonus balls, i.e. wild or lightning.
- color (integer) - A sphere ID of a sphere the shooter should get.
- "multiSphere" - Spawns a certain amount of a defined sphere to the shooter. This can be used to i.e. spawn 10 daggers the player can shoot anywhere they want.
- color (integer) - A sphere ID of a sphere the shooter should get.
- count (integer) [>=1] - How many spheres of that type should be given.
- "speedShot" - Replaces the default shooting speed and spawns a speed shot beam effect.
- time (number) [>0] - The duration of the effect in seconds.
- speed (number) [>0] - A new speed of the shot balls, in pixels per second.
- "speedOverride" - Changes the speed of spheres on the board.
- speedBase (number) - A value to be added to the multiplied sphere speed.
- speedMultiplier (number) - A multiplier by which the nominal path speed will be multiplied.\nThe formula for the final speed is: `speedBase + (pathSpeed * speedMultiplier)`.
- decceleration (number) - A sphere decceleration rate which will be applied alongside speed changes.
- time (number) [>0] - The duration of the effect in seconds.
- "destroyAllSpheres" - Clears the board from all spheres.
- "destroyColor" - Destroys the spheres of a specified color.
- color (integer) - The color of spheres to be destroyed.
- "spawnScorpion" - Spawns a scorpion on the board.
- "lightningStorm" - Starts a lightning storm, spawning a given amount of strikes which destroy single spheres.
- count (integer) [>=1] - The amount of strikes.
- "activateNet" - Activates a net which collects collectibles for a given amount of time.
- time (number) [>0] - The duration of the effect in seconds.
- "changeGameSpeed" - Changes the game speed to a defined value for a specified period of time.
- speed (number) [>0] - The game speed multiplier.
- duration (number) [>0] - The duration of the effect in seconds. It is not affected by the game speed itself.
- "setCombo" - Sets the current level combo to a specified value.
- combo (integer) [>=0] - The combo value to be set.
- "grantScore" - Grants a certain amount of score to the current player.
- score (integer) - The score to be given.
- "grantCoin" - Grants a single coin to the current player.
- "incrementGemStat" - Adds one to the gem pickup statistics for the current level.
26 changes: 26 additions & 0 deletions doc/game/data/config/collectible_generator.docl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
- (object) {type: Type of the Collectible Generator Entry.} - A collectible generator entry.
- "collectible" - Evaluates to a single collectible.
- name (string) - A collectible ID to be evaluated to.
- conditions* (array) - A list of conditions. All of them must be satisfied. In other case, this entry will not generate any collectibles and return an empty list.
- ($collectible_generator_condition) - A single condition.
- "collectibleGenerator" - Evaluates to another collectible generator result.
- name (string) - A collectible generator ID to be evaluated.
- conditions* (array) - A list of conditions. All of them must be satisfied. In other case, this entry will not generate any collectibles and return an empty list.
- ($collectible_generator_condition) - A single condition.
- "combine" - Evaluates a list of given entries and returns a list of all collectibles generated.
- entries (array) - A list of collectible entries to be evaluated.
- (#) - A single collectible generator entry.
- conditions* (array) - A list of conditions. All of them must be satisfied. In other case, this entry will not generate any collectibles and return an empty list.
- ($collectible_generator_condition) - A single condition.
- "repeat" - Evaluates a given entry a number of times and returns a list of all collectibles generated.
- entry (#) - A collectible entry to be evaluated.
- count (integer) [>=2] - How many times the entry should be evaluated.
- conditions* (array) - A list of conditions. All of them must be satisfied. In other case, this entry will not generate any collectibles and return an empty list.
- ($collectible_generator_condition) - A single condition.
- "randomPick" - Evaluates all the choices, discards empty ones, and selects one of the remaining results at random.
- pool (array) - A list of choices to be picked from.
- (object) - A single choice.
- entry (#) - A collectible generator entry to be evaluated.
- weight* (number) [>0] - The bigger this number is, the more likely this option is to be chosen. Defaults to 1.
- conditions* (array) - A list of conditions. All of them must be satisfied. In other case, this entry will not generate any collectibles and return an empty list.
- ($collectible_generator_condition) - A single condition.
9 changes: 9 additions & 0 deletions doc/game/data/config/collectible_generator_condition.docl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- (object) {type: Condition type.} - A single condition.
- "expression" - Returns `true` if the provided expression returns `true`.
- expression (boolean) - An expression to be evaluated.
- "colorPresent" - Returns `true` if a given color is present on the board.
- color (integer) - A color to be checked.
- "cmpLatestCheckpoint" - Returns `true` if the profile latest checkpoint value is within defined bounds.
- min* (number) - If the checked value is lower than this value, this check will fail.
- max* (number) - If the checked value is greater than this value, this check will fail.
- value* (number) - If the checked value is not equal to this value, this check will fail.
14 changes: 14 additions & 0 deletions doc/game/data/config/color_generator.docl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
- (object) - The root object.
- type (string) - Defines the type of this Color Generator.
- "random" - The colors are generated randomly from the pool.
- "nearEnd" - The colors are generated based on which colors are in proximity of a Path's endpoint.
- hasToExist* (boolean) - Required if type is `"random"`. Whether in order for a color to be generated it needs to already exist on the board.
- selectChance* (number) [>0,<=1] - Required if type is `"nearEnd"`. The chance for a ball's color to be selected for the next generation, starting from the frontmost sphere on a randomly chosen path.
- pathsInDangerOnly* (boolean) - Required if type is `"nearEnd"`. Whether only paths in danger should be taken into account when generating colors. If no path is in danger, a random path is selected as if this was set to `false`.
- colors (array) - A list of colors which can be ever generated by this generator.
- (integer) - A single sphere ID.
- fallback - What should be generated when this generator fails.
- (integer) - The color to be generated when this generator fails.
- (#) - Another Color Generator to be used when this generator fails.
- colorsRemoveIfNonexistent* (array) - A list of colors which will be removed from the Shooter if no instances of that color are present on the board.
- (integer) - A single sphere ID.
63 changes: 63 additions & 0 deletions doc/game/data/config/gameplay.docl
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
- (object) - The root entry.
- level (object) - Defines some key level times.
- controlDelay (number) [>=0] - Time between launching the first spheres in a level and the shooter activation in seconds.
- finishDelay (number) [>=0] - Time between considering the level complete (win condition met and empty board) and releasing the first bonus scarab.
- bonusDelay (number) [>=0] - Time between each consecutive bonus scarab launch in multi-path levels in seconds.
- wonDelay (number) [>=0] - Time between the last bonus scarab destruction and considering the level fully won.
- sphereBehaviour (object) - Defines behavior of the spheres.
- acceleration (number) - The default acceleration rate of spheres being pushed.
- foulAcceleration* (number) - The acceleration rate of spheres used only when the player fails to complete a level.
- attractionAcceleration* (number) - The acceleration rate of spheres magnetizing to each other.
- attractionForwardDecceleration* (number) - The decceleration rate of spheres when magnetizing to the group behind while still moving forward.
- attractionForwardDeccelerationScarab* (number) - The decceleration rate of spheres when magnetizing to a scarab behind while still moving forward.
- decceleration (number) - The default decceleration rate of spheres.
- backwardsDecceleration* (number) - The decceleration rate of spheres when they're moving backwards.
- attractionSpeedBase (number) - Maximum attraction speed of groups of like color being attracted together.\nThis and `attractionSpeedMult` form a final value together using this expression: `attractionSpeedBase + max(1, chain) * attractionSpeedMult`.
- attractionSpeedMult (number) - The second value used in the formula. For description look at `attractionSpeedBase`.
- knockbackSpeedBase (number) - Speed induced when a group of spheres crashes into another sphere group behind it.\nThis and `knockbackSpeedMult` form a final value together using this expression: `knockbackSpeedBase + max(1, chain) * knockbackSpeedMult`.
- knockbackSpeedMult (number) - The second value used in the formula. For description look at `knockbackSpeedBase`.
- knockbackTime* (number) - If set, this will be the duration the knockback speed will persist for, in seconds.
- knockbackStopAfterTime* (boolean) - Only if `knockbackTime` is set. If `true`, the speed of the group will be set to 0 once the knockback time is over. Else, the sphere group will deccelerate normally.
- foulSpeed (number) - Maximum speed of spheres when the player fails to complete a level.
- overspeedCheck (boolean) - If `true`, spheres will never move faster than the maximum speed defined at a given point of the path.
- invincibleScarabs (boolean) - If `true`, scarabs cannot be crushed by spheres behind them. Instead, they are pushed.
- luxorized* (boolean) - Enables sphere physics gimmicks specific to the original Luxor game to mimic it better.
- joinSound (SoundEvent) - A sound event to be played when two groups of spheres hit each other.
- newGroupSound (SoundEvent) - A sound event to be played when a new sphere chain appears on the board.
- noScarabs (boolean) - If `true`, the scarabs will not appear in the game.
- permitLongMatches (boolean) - If `true`, the spheres will try to make the biggest clump possible before matching together.
- collectibleBehavior (object) - Defines how Collectibles behave.
- speed (ExprVector2) - A starting speed of the Collectibles.
- acceleration (ExprVector2) - An acceleration rate of the Collectibles.
- bonusScarab (object) - Defines the Bonus Scarab.
- sprite (Sprite) - The sprite to be used by the Bonus Scarab.
- shadowSprite (Sprite) - The shadow sprite to be used by the Bonus Scarab.
- stepLength (number) [>0] - The length of a single segment, which gives points. The formula defining how many points are given is as follows: `max(floor(distance / stepLength), 1) * pointsPerStep`.
- pointsPerStep (integer) [>=0] - How many points are given for each step. The bonus score will be always a multiple of this value.
- coinDistance* (number) [>0] - The delay between generating collectibles. If omitted, the Bonus Scarab will not spawn any collectibles.
- coinGenerator* (CollectibleGenerator) - A collectible generator used periodically.
- speed (number) [>0] - How fast does the Bonus Scarab move, in pixels per second.
- trailParticle* (Particle) - A one-time particle packet which the Bonus Scarab would emit. May be omitted if no particles are supposed to be generated.
- trailParticleDistance* (number) [>0] - Every how many pixels a specified particle will spawn. May not exist if `trailParticle` is not specified.
- loopSound (SoundEvent) - A looping sound event which is played during Bonus Scarab's existence.
- destroySound (SoundEvent) - A sound event which will be played when the Bonus Scarab is destroyed.
- destroyParticle (Particle) - A one-time particle packet which the Bonus Scarab will launch upon destruction.
- destroyGenerator* (CollectibleGenerator) - A collectible generator used when the Bonus Scarab is destroyed.
- scoreFont (Font) - A font to be used to display the bonus value on the screen.
- scorpion* (object) - Defines the Scorpion.
- sprite (Sprite) - The sprite to be used by the Scorpion.
- shadowSprite (Sprite) - The shadow sprite to be used by the Scorpion.
- maxSpheres* (integer) [>0] - The maximum amount of spheres the Scorpion can destroy. When exceeded, the Scorpion is destroyed. May not exist when no such limit is expected.
- maxChains* (integer) [>0] - The maximum amount of chains the Scorpion can destroy. When exceeded, the Scorpion is destroyed. May not exist when no such limit is expected.
- speed (number) [>0] - How fast does the Scorpion move, in pixels per second.
- trailParticle* (Particle) - A one-time particle packet which the Scorpion would emit. May be omitted if no particles are supposed to be generated.
- trailParticleDistance* (number) [>0] - Every how many pixels a specified particle will spawn. May not exist if `trailParticle` is not specified.
- loopSound (SoundEvent) - A looping sound event which is played during Scorpion's existence.
- sphereDestroySound (SoundEvent) - A sound event which will be played when the Scorpion destroys a sphere.
- destroySound (SoundEvent) - A sound event which will be played when the Scorpion is destroyed.
- destroyParticle (Particle) - A one-time particle packet which the Scorpion will launch upon destruction.
- destroyGenerator* (CollectibleGenerator) - A collectible generator used when the Scorpion is destroyed.
- scoreFont (Font) - A font to be used to display the bonus value on the screen.
- net* (object) - Defines the Net.
- particle (Particle) - A persistent particle packet which is spawned when the Net is spawned, and destroyed when the Net expires.
- posY (integer) - The Y position of the Net.
Loading

0 comments on commit a252642

Please sign in to comment.