Skip to content

Commit

Permalink
Add a description field to difficulties and automatically generate di…
Browse files Browse the repository at this point in the history
…fficulty listing in the README
  • Loading branch information
trumank committed Apr 12, 2022
1 parent 1003956 commit f1621e5
Show file tree
Hide file tree
Showing 21 changed files with 99 additions and 23 deletions.
33 changes: 17 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Custom Difficulties

This is collection of difficulties to be used with the [Custom Difficulty](https://drg.mod.io/custom-difficulty) mod for Deep Rock Galactic.

Note: This README.md is generated by `make.js`. Before commiting changes, run `node make.js` to format difficulties and regerate this difficulty listing.

## [Hazard 1](difficulties/Hazard_1.cd.json)
Vanilla Hazard 1

Expand All @@ -17,20 +18,17 @@ Vanilla Hazard 4
## [Hazard 5](difficulties/Hazard_5.cd.json)
Vanilla Hazard 5

## [Hazard 6](difficulties/Hazard_6.cd.json) by Ike
[Mod.io page](https://drg.mod.io/ike)

## [Hazard 7](difficulties/Hazard_7.cd.json) by Ike
[Mod.io page](https://drg.mod.io/hazard-7)

## [Hazard 5 Carry](difficulties/Hazard_5_Carry.cd.json)
Hazard 5 with all properties that normally scale with player count fixed to 4 player values regardless of player count.

## [Hazard 5 - Praetorian Edition](difficulties/Hazard_5_Praetorian_Edition.cd.json)
Like the other version which replaces grunts with praetorians, but here we adjust the spawn cost to match grunts, increase the ideal spawn size from 3 to 6 and remove the maximum spawn size (was 4). I've also changed the rarity to 1, which is the lowest rarity present in the EnemyDescriptors and the rarity of grunts.

## [Hazard 5 - Praetorian Edition](difficulties/Hazard_5_Praetorian_Edition_v2.cd.json)
This is a demonstration custom difficulty that shows how to remove grunts and create a new praetorian descriptor that takes the place of grunts. The low rarity works like the grunt rarity in that it nearly guarantees praetorians get picked first for any spawns. A future version might demonstrate adjusting spawn costs and size to increase praetorian spawn counts.

## [Hazard 5 - Praetorian Edition V2](difficulties/Hazard_5_Praetorian_Edition_v2.cd.json)
Like the other version which replaces grunts with praetorians, but here we adjust the spawn cost to match grunts, increase the ideal spawn size from 3 to 6 and remove the maximum spawn size (was 4). I've also changed the rarity to 1, which is the lowest rarity present in the EnemyDescriptors and the rarity of grunts.
## [Hazard 6](difficulties/Hazard_6.cd.json)
Imported from Ike's [Hazard 6 on Mod.io](https://drg.mod.io/ike)

## [Hazard 6x2 40 Nitra](difficulties/Hazard_6x2_40_Nitra.cd.json)
Hazard 6 with 2x enemy count, 40 nitra resupplies, and 180/180 spawn caps. Prospector and Data Vault disabled.
Expand All @@ -44,14 +42,17 @@ Experimenting with adding some more enemy variants to otherwise normal hazard6x2
## [Hazard 6x3 40 Nitra](difficulties/Hazard_6x3_40_Nitra.cd.json)
Hazard 6 with 3x enemy count, 40 nitra resupplies, and 180/180 spawn caps. Prospector and Data Vault disabled.

## [Starship Troopers Pro](difficulties/Starship_Troopers_Pro.cd.json) by The Brain
FOR VETERANS OF THE STARSHIP TROOPERS ELITE MOD, this mod changes spawn size, so expect to be swimming in bugs if you don't kill fast enough. The enemies still have Haz4 specifications (speed*, damage, resistance, ..) as regular Starship Troopers. I don't recommend this mod for player level below 999, and even then I saw high level players rush in the middle of a new cave, die and make the mission fail as everybody risks their live or die in rescue attempts. This is easily comparable to Hazard 9 or Hazard 10.

## [Starship Troopers INSANE](difficulties/Starship_Troopers_INSANE.cd.json) by Masala
Huge amounts of very fast enemies with very low hp, resups cost 40. Had no idea what I was doing and it's mostly a meme https://clips.twitch.tv/CogentGoodVultureVoteNay-2QOzDrdDH3kMOWyh
## [Hazard 7](difficulties/Hazard_7.cd.json)
Imported from Ike's [Hazard 7 on Mod.io](https://drg.mod.io/hazard-7)

## [Low Enemy Count](difficulties/Low_Enemy_Count.cd.json) by The Brain
## [Low Enemy Count](difficulties/Low_Enemy_Count.cd.json)
Not many bugs spawn. Difficult, but beatable.

## [Oops All Bulks](difficulties/Oops_All_Bulks.cd.json)
## [Oops all bulks](difficulties/Oops_All_Bulks.cd.json)
This is a Custom Difficulty version of Milligin's "Oops all bulks" event he often plays on stream. It's usually played on a refinery mission, but other mission types could be interesting as well.

## [starship troopers INSANE](difficulties/Starship_Troopers_INSANE.cd.json)
Huge amounts of very fast enemies with very low hp, resups cost 40. Had no idea what I was doing and it's mostly a meme https://clips.twitch.tv/CogentGoodVultureVoteNay-2QOzDrdDH3kMOWyh

## [Starship Troopers Pro](difficulties/Starship_Troopers_Pro.cd.json)
FOR VETERANS OF THE STARSHIP TROOPERS ELITE MOD, this mod changes spawn size, so expect to be swimming in bugs if you don't kill fast enough. The enemies still have Haz4 specifications (speed*, damage, resistance, ..) as regular Starship Troopers. I don't recommend this mod for player level below 999, and even then I saw high level players rush in the middle of a new cave, die and make the mission fail as everybody risks their live or die in rescue attempts. This is easily comparable to Hazard 9 or Hazard 10.
1 change: 1 addition & 0 deletions base.cd.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"Name": "Hazard 5",
"Description": "Vanilla Hazard 5",
"MaxActiveCritters": 40,
"MaxActiveSwarmers": 60,
"MaxActiveEnemies": 60,
Expand Down
5 changes: 5 additions & 0 deletions cd.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@
"Hazard 5"
]
},
"Description": {
"type": "string",
"description": "A optional description of the difficulty.",
"default": ""
},
"MaxActiveCritters": {
"type": "integer",
"description": "The maximum number of critters (maggots, lootbugs, silica harvesters, etc.) allowed to exist at once.",
Expand Down
1 change: 1 addition & 0 deletions difficulties/Hazard_1.cd.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"Name": "Hazard 1",
"Description": "Vanilla Hazard 1",
"ExtraLargeEnemyDamageResistance": [
0.2,
0.4,
Expand Down
1 change: 1 addition & 0 deletions difficulties/Hazard_2.cd.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"Name": "Hazard 2",
"Description": "Vanilla Hazard 2",
"ExtraLargeEnemyDamageResistance": [
0.3,
0.4,
Expand Down
1 change: 1 addition & 0 deletions difficulties/Hazard_3.cd.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"Name": "Hazard 3",
"Description": "Vanilla Hazard 3",
"ExtraLargeEnemyDamageResistance": [
0.5,
0.55,
Expand Down
1 change: 1 addition & 0 deletions difficulties/Hazard_4.cd.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"Name": "Hazard 4",
"Description": "Vanilla Hazard 4",
"ExtraLargeEnemyDamageResistance": [
0.7,
0.75,
Expand Down
1 change: 1 addition & 0 deletions difficulties/Hazard_5_Carry.cd.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"Name": "Hazard 5 Carry",
"Description": "Hazard 5 with all properties that normally scale with player count fixed to 4 player values regardless of player count.",
"ExtraLargeEnemyDamageResistance": [
1.7,
1.7,
Expand Down
1 change: 1 addition & 0 deletions difficulties/Hazard_5_Praetorian_Edition.cd.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"Name": "Hazard 5 - Praetorian Edition",
"Description": "Like the other version which replaces grunts with praetorians, but here we adjust the spawn cost to match grunts, increase the ideal spawn size from 3 to 6 and remove the maximum spawn size (was 4). I've also changed the rarity to 1, which is the lowest rarity present in the EnemyDescriptors and the rarity of grunts.",
"EnemyDescriptors": {
"ED_My_Praetorian": {
"Base": "ED_Spider_Tank",
Expand Down
1 change: 1 addition & 0 deletions difficulties/Hazard_5_Praetorian_Edition_v2.cd.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"Name": "Hazard 5 - Praetorian Edition",
"Description": "This is a demonstration custom difficulty that shows how to remove grunts and create a new praetorian descriptor that takes the place of grunts. The low rarity works like the grunt rarity in that it nearly guarantees praetorians get picked first for any spawns. A future version might demonstrate adjusting spawn costs and size to increase praetorian spawn counts.",
"EnemyDescriptors": {
"ED_My_Praetorian": {
"Base": "ED_Spider_Tank",
Expand Down
1 change: 1 addition & 0 deletions difficulties/Hazard_6.cd.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"Name": "Hazard 6",
"Description": "Imported from Ike's [Hazard 6 on Mod.io](https://drg.mod.io/ike)",
"MaxActiveSwarmers": 180,
"MaxActiveEnemies": 180,
"ResupplyCost": 60,
Expand Down
1 change: 1 addition & 0 deletions difficulties/Hazard_6x2_40_Nitra.cd.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"Name": "Hazard 6x2 40 Nitra",
"Description": "Hazard 6 with 2x enemy count, 40 nitra resupplies, and 180/180 spawn caps. Prospector and Data Vault disabled.",
"MaxActiveSwarmers": 180,
"MaxActiveEnemies": 180,
"ResupplyCost": 40,
Expand Down
1 change: 1 addition & 0 deletions difficulties/Hazard_6x2_Diversity_Edition.cd.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"Name": "Hazard 6x2 - Diversity Edition",
"Description": "This plays very similarly to normal Hazard 6x2. It's identical except that EnemeyDiversity is always the max. This results in very different enemy compositions. This variant can bring a little spice when Hazard 6x2 is feeling a little too same-y.",
"MaxActiveSwarmers": 180,
"MaxActiveEnemies": 180,
"ResupplyCost": 40,
Expand Down
1 change: 1 addition & 0 deletions difficulties/Hazard_6x2_Plus.cd.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"Name": "Hazard 6x2 Plus",
"Description": "Experimenting with adding some more enemy variants to otherwise normal hazard6x2. Currently only adds sentinels (for their aggressive digging which can disrupt otherwise comfortable positioning) and a fast but weak slasher. Subject to change.",
"MaxActiveSwarmers": 180,
"MaxActiveEnemies": 180,
"ResupplyCost": 40,
Expand Down
1 change: 1 addition & 0 deletions difficulties/Hazard_6x3_40_Nitra.cd.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"Name": "Hazard 6x3 40 Nitra",
"Description": "Hazard 6 with 3x enemy count, 40 nitra resupplies, and 180/180 spawn caps. Prospector and Data Vault disabled.",
"MaxActiveSwarmers": 180,
"MaxActiveEnemies": 180,
"ResupplyCost": 40,
Expand Down
1 change: 1 addition & 0 deletions difficulties/Hazard_7.cd.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"Name": "Hazard 7",
"Description": "Imported from Ike's [Hazard 7 on Mod.io](https://drg.mod.io/hazard-7)",
"MaxActiveSwarmers": 180,
"MaxActiveEnemies": 180,
"ResupplyCost": 50,
Expand Down
1 change: 1 addition & 0 deletions difficulties/Low_Enemy_Count.cd.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"Name": "Low Enemy Count",
"Description": "Not many bugs spawn. Difficult, but beatable.",
"ExtraLargeEnemyDamageResistance": [
3,
3,
Expand Down
1 change: 1 addition & 0 deletions difficulties/Oops_All_Bulks.cd.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"Name": "Oops all bulks",
"Description": "This is a Custom Difficulty version of Milligin's \"Oops all bulks\" event he often plays on stream. It's usually played on a refinery mission, but other mission types could be interesting as well.",
"ResupplyCost": 20,
"EnemyWaveInterval": [
{
Expand Down
1 change: 1 addition & 0 deletions difficulties/Starship_Troopers_INSANE.cd.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"Name": "starship troopers INSANE",
"Description": "Huge amounts of very fast enemies with very low hp, resups cost 40. Had no idea what I was doing and it's mostly a meme https://clips.twitch.tv/CogentGoodVultureVoteNay-2QOzDrdDH3kMOWyh",
"MaxActiveCritters": 600,
"MaxActiveSwarmers": 180,
"MaxActiveEnemies": 180,
Expand Down
1 change: 1 addition & 0 deletions difficulties/Starship_Troopers_Pro.cd.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"Name": "Starship Troopers Pro",
"Description": "FOR VETERANS OF THE STARSHIP TROOPERS ELITE MOD, this mod changes spawn size, so expect to be swimming in bugs if you don't kill fast enough. The enemies still have Haz4 specifications (speed*, damage, resistance, ..) as regular Starship Troopers. I don't recommend this mod for player level below 999, and even then I saw high level players rush in the middle of a new cave, die and make the mission fail as everybody risks their live or die in rescue attempts. This is easily comparable to Hazard 9 or Hazard 10.",
"MaxActiveSwarmers": 180,
"MaxActiveEnemies": 180,
"ResupplyCost": 60,
Expand Down
66 changes: 59 additions & 7 deletions tools/format.js → make.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/**
* Usage: node tools/format.js <difficulty...>
* Usage: node make.js
*
* Sorts fields, removes default values, and formats the specified difficulties in place.
* Sorts fields, removes default values, and formats all difficulties and rebuilds README.md to include entries for each
*/

const fs = require('fs');
const path = require('path');

const base = JSON.parse(fs.readFileSync('base.cd.json'));

const paths = process.argv.slice(2);

const keys = [
'Name',
'Description',
'MaxActiveCritters',
'MaxActiveSwarmers',
'MaxActiveEnemies',
Expand Down Expand Up @@ -137,8 +137,16 @@ function deepEquals(a, b) {
return sortedStringify(a) === sortedStringify(b);
}

function formatDifficulty(path) {
function loadDifficulty(path) {
const difficulty = JSON.parse(fs.readFileSync(path));
return {
...base,
...difficulty
};
}

function formatDifficulty(path) {
let difficulty = loadDifficulty(path);
for (let key of Object.keys(difficulty)) {
if (deepEquals(difficulty[key], base[key])) {
delete difficulty[key];
Expand All @@ -147,6 +155,50 @@ function formatDifficulty(path) {
fs.writeFileSync(path, JSON.stringify(difficulty, getSortedKeys(difficulty, getKeyIndexDifficulty).flat(), 2));
}

for (let path of paths) {
formatDifficulty(path);
function getFiles(dir, files_){
files_ = files_ || [];
const files = fs.readdirSync(dir);
for (let i in files){
const name = dir + '/' + files[i];
if (fs.statSync(name).isDirectory()){
getFiles(name, files_);
} else {
if (/\.cd\.json$/.test(name)) files_.push(name);
}
}
return files_;
}

function getDifficulties() {
const paths = getFiles('difficulties');
return paths.map(p => ({
path: p,
difficulty: loadDifficulty(p)
}));
}

function makeReadmeSection(header, title, body) {
return `${'#'.repeat(header)} ${title}\n${body}\n`;
}

function makeReadme(entries) {
const sections = [];
sections.push(makeReadmeSection(1, 'Custom Difficulties', `This is collection of difficulties to be used with the [Custom Difficulty](https://drg.mod.io/custom-difficulty) mod for Deep Rock Galactic.
Note: This README.md is generated by \`make.js\`. Before commiting changes, run \`node make.js\` to format difficulties and regerate this difficulty listing.`));
for (let e of entries) {
sections.push(makeReadmeSection(2, `[${e.difficulty.Name}](${e.path.split(path.sep).join('/')})`, e.difficulty.Description));
}
fs.writeFileSync('README.md', sections.join('\n'));
}


function make() {
const entries = getDifficulties();
for (let e of entries) {
formatDifficulty(e.path);
}
makeReadme(entries);
}

make();

0 comments on commit f1621e5

Please sign in to comment.