Compare commits

...

6 Commits

6 changed files with 555 additions and 6 deletions

375
.genres.json Normal file
View File

@ -0,0 +1,375 @@
{
"description": "A list of musical genres taken from wikipedia article titles.",
"genres":
[
"2-step",
"4-beat",
"Acid breaks",
"Acid house",
"Acid jazz",
"Acid rock",
"Acid techno",
"Acid trance",
"Aggrotech",
"Alternative dance",
"Alternative metal",
"Alternative rock",
"Ambient dub",
"Ambient house",
"Ambient techno",
"Ambient",
"Anarcho punk",
"Anti-folk",
"Art punk",
"Art rock",
"Asian Underground",
"Avant-garde jazz",
"Baggy",
"Balearic Beat",
"Baltimore Club",
"Bassline",
"Beat music",
"Bebop",
"Big beat",
"Bitpop",
"Black metal",
"Boogie-woogie",
"Boogie",
"Bossa nova",
"Bouncy house",
"Bouncy techno",
"Breakbeat hardcore",
"Breakbeat",
"Breakcore",
"Breakstep",
"British dance",
"Britpop",
"Broken beat",
"Bubblegum dance",
"Canterbury scene",
"Cape jazz",
"Celtic metal",
"Celtic punk",
"Celtic",
"Chamber jazz",
"Chicago house",
"Chill out",
"Chillwave",
"Chinese rock",
"Chiptune",
"Christian metal",
"Christian punk",
"Christian rock",
"Classic trance",
"Coldwave",
"Contemporary folk",
"Continental Jazz",
"Cool jazz",
"Cosmic disco",
"Cowpunk",
"Crossover jazz",
"Crossover thrash",
"Crunk",
"Crust punk",
"Crustgrind",
"Cybergrind",
"D-beat",
"Dance-pop",
"Dance-punk",
"Dance-rock",
"Dark ambient",
"Dark cabaret",
"Dark electro",
"Dark psytrance",
"Dark Wave",
"Darkcore",
"Darkside jungle",
"Darkstep",
"Death industrial",
"Death metal",
"Deathcore",
"Deathrock",
"Deep house",
"Desert rock",
"Detroit techno",
"Digital hardcore",
"Disco house",
"Disco polo",
"Disco",
"Diva house",
"Dixieland",
"Djent",
"Doom metal",
"Doomcore",
"Downtempo",
"Dream house",
"Dream pop",
"Dream trance",
"Drone metal",
"Drone",
"Drum and bass",
"Drumfunk",
"Drumstep",
"Dub",
"Dubstep",
"Dubstyle",
"Dubtronica",
"Dunedin Sound",
"Dutch house",
"EDM",
"Electro backbeat",
"Electro house",
"Electro-grime",
"Electro-industrial",
"Electro",
"Electroacoustic",
"Electroclash",
"Electronic art music",
"Electronic rock",
"Electronica",
"Electronicore",
"Electropop",
"Electropunk",
"Emo",
"Epic doom",
"Ethereal wave",
"Ethnic electronica",
"Euro disco",
"Eurobeat",
"Eurodance",
"European free jazz",
"Europop",
"Experimental rock",
"Filk",
"Florida breaks",
"Folk metal",
"Folk punk",
"Folk rock",
"Folk",
"Folktronica",
"Freak folk",
"Freakbeat",
"Free tekno",
"Freestyle house",
"Freestyle",
"French house",
"Full on",
"Funeral doom",
"Funk metal",
"Funky house",
"Funky",
"Futurepop",
"Gabber",
"Garage punk",
"Garage rock",
"Ghetto house",
"Ghettotech",
"Glam metal",
"Glam rock",
"Glitch",
"Goregrind",
"Gothic metal",
"Gothic rock",
"Grime",
"Grindcore",
"Groove metal",
"Grunge",
"Happy hardcore",
"Hard bop",
"Hard NRG",
"Hard rock",
"Hard trance",
"Hardbag",
"Hardcore punk",
"Hardcore/Hard dance",
"Hardstep",
"Hardstyle",
"Heavy metal",
"Hi-NRG",
"Hip house",
"Horror punk",
"House",
"IDM",
"Illbient",
"Indie folk",
"Indie pop",
"Indie rock",
"Indietronica",
"Industrial folk",
"Industrial metal",
"Industrial rock",
"Industrial",
"Intelligent drum and bass",
"Italo dance",
"Italo disco",
"Italo house",
"Japanoise",
"Jazz blues",
"Jazz fusion",
"Jazz rap",
"Jazz rock",
"Jazz-funk",
"Jump-Up",
"Jumpstyle",
"Krautrock",
"Laptronica",
"Latin house",
"Latin jazz",
"Liquid funk",
"Livetronica",
"Lowercase",
"Lo-fi",
"Madchester",
"Mainstream jazz",
"Makina",
"Math rock",
"Mathcore",
"Medieval metal",
"Melodic death metal",
"Metalcore",
"Minimal house/Microhouse",
"Minimal",
"Modal jazz",
"Moombahton",
"Neo-bop jazz",
"Neo-psychedelia",
"Neo-swing",
"Neofolk",
"Neurofunk",
"New Beat",
"New jack swing",
"New prog",
"New rave",
"New wave",
"New-age",
"Nintendocore",
"No wave",
"Noise pop",
"Noise rock",
"Noise",
"Noisegrind",
"Nortec",
"Novelty ragtime",
"Nu jazz",
"Nu metal",
"Nu skool breaks",
"Nu-disco",
"Oldschool jungle",
"Orchestral jazz",
"Orchestral Uplifting",
"Paisley Underground",
"Pop punk",
"Pop rock",
"Post-bop",
"Post-Britpop",
"Post-disco",
"Post-grunge",
"Post-hardcore",
"Post-metal",
"Post-punk revival",
"Post-punk",
"Post-rock",
"Power electronics",
"Power metal",
"Power noise",
"Power pop",
"Powerviolence",
"Progressive breaks",
"Progressive drum & bass",
"Progressive folk",
"Progressive house",
"Progressive metal",
"Progressive rock",
"Progressive techno",
"Progressive",
"Psybreaks",
"Psychedelic folk",
"Psychedelic rock",
"Psychedelic trance",
"Psychobilly",
"Psyprog",
"Punk jazz",
"Punk rock",
"Raga rock",
"Ragga-jungle",
"Raggacore",
"Ragtime",
"Rap metal",
"Rap rock",
"Rapcore",
"Riot grrrl",
"Rock and roll",
"Rock in Opposition",
"Sadcore",
"Sambass",
"Screamo",
"Shibuya-kei",
"Shoegaze",
"Ska jazz",
"Ska punk",
"Skate punk",
"Skweee",
"Slowcore",
"Sludge metal",
"Smooth jazz",
"Soft rock",
"Soul jazz",
"Sound art",
"Southern rock",
"Space disco",
"Space house",
"Space rock",
"Speed garage",
"Speed metal",
"Speedcore",
"Stoner rock",
"Straight-ahead jazz",
"Street punk",
"Stride jazz",
"Sufi rock",
"Sung poetry",
"Suomisaundi",
"Surf rock",
"Swing house",
"Swing",
"Symphonic metal",
"Synthcore",
"Synthpop",
"Synthpunk",
"Tech house",
"Tech trance",
"Technical death metal",
"Techno-DNB",
"Techno-folk",
"Techno",
"Technopop",
"Techstep",
"Tecno brega",
"Terrorcore",
"Third stream",
"Thrash metal",
"Thrashcore",
"Toytown Techno",
"Trad jazz",
"Traditional doom",
"Trance",
"Trap",
"Tribal house",
"Trip hop",
"Turbofolk",
"Twee Pop",
"Uplifting trance",
"Vaporwave",
"Viking metal",
"Vocal house",
"Vocal jazz",
"Vocal trance",
"West Coast jazz",
"Western",
"Witch House/Drag",
"World fusion",
"Worldbeat",
"Yacht rock",
"Yorkshire Bleeps and Bass"
]
}

62
.media-formats.json Normal file
View File

@ -0,0 +1,62 @@
{
"description": "Audiovisual media distribution formats, from Discogs Formats List https://www.discogs.com/help/formatslist",
"instruments": [
"Vinyl",
"Acetate",
"Flexi-disc",
"Lathe Cut",
"Shellac",
"Pathé Disc",
"Edison Disc",
"Cylinder",
"CD",
"CDr",
"CDV",
"DVD",
"DVDr",
"HD DVD",
"HD DVD-R",
"Blu-Ray",
"Blu-ray-R",
"SACD",
"4-Track Cartridge",
"8-Track Cartridge",
"Cassette",
"DC-International",
"Elcaset",
"PlayTape",
"RCA Tape Cartridge",
"DAT",
"DCC",
"Microcassette",
"NT Cassette",
"Pocket Rocker",
"Revere Magnetic Stereo Tape Ca",
"Tefifon",
"Reel-To-Reel",
"Sabamobil",
"Betacam",
"Betacam SP",
"Betamax",
"Cartrivision",
"MiniDV",
"U-matic",
"VHS",
"Video 2000",
"Video8",
"Film Reel",
"Laserdisc",
"SelectaVision",
"VHD",
"Wire Recording",
"Minidisc",
"MVD",
"UMD",
"Floppy Disk",
"File",
"Memory Stick",
"Hybrid",
"All Media",
"Box Set"
]
}

View File

@ -25,3 +25,9 @@ example-charlatan.js is the 'hello world' of using the charlatan library.
createtown.js. - project-name-generator is a node.js library for generator heroku-style project names (a number of words in a row, separated by spaces, hyphens or a comma-separated list). In create-town.js I generate 3 to 6 example tiny village names, with an additional function to capitalize words.
generate-book-title.js - This is a minimal example to generate a book title. It doesn't have capitalization, but that could be added (see createtown.js).
### Play audio with troubadour
troubadour-play-loop.js - a small program to test playing audio in a loop. Troubadour works with (and requires) at least one commandline audio player, that must be specified. Can use sox, mplayer, mpg123, or vlc.
troubadour-play-two.js - is similar to above but allows simultaneously looping playback of 2 loops, of different lengths

View File

@ -0,0 +1,9 @@
const Troubadour = require('troubadour');
const troubadour = new Troubadour('mplayer'); //or pass in sox for example
troubadour.on('end', () => {
// Do something here when the audio finishes playing
troubadour.play('../assets/snd/chew.mp3');
});
troubadour.play('../assets/snd/chew.mp3');

View File

@ -0,0 +1,32 @@
const Troubadour = require('troubadour');
const troubadourLoop1 = new Troubadour('mplayer'); //or pass in sox for example
const troubadourLoop2 = new Troubadour('mplayer'); //or pass in sox for example
function loop1(file){
troubadourLoop1.on('start', () => {
// Do something here when the audio starts playing
});
troubadourLoop1.on('end', () => {
// Do something here when the audio finishes playing
troubadourLoop1.play(file);
});
troubadourLoop1.play(file);
}
function loop2(file){
troubadourLoop2.on('start', () => {
// Do something here when the audio starts playing
});
troubadourLoop2.on('end', () => {
// Do something here when the audio finishes playing
troubadourLoop2.play(file);
});
troubadourLoop2.play(file);
}
loop1('../assets/snd/chew.mp3');
loop2('../assets/snd/small-33.mp3');

View File

@ -19,6 +19,8 @@ const verbsFile = ".verbs.txt";
const inventoryFile = ".inventory.txt";
const placesFile = ".places.txt";
const terrainFile = ".terrain.txt";
const mediaFormatsFile = ".media-formats.json";
const genresFile = ".genres.json";
// game vars
program = blessed.program();
@ -35,6 +37,8 @@ let verbs = [];
let inventory = [];
let terrain = [];
let places = [];
let mediaFormats = [];
let genres = [];
let player = {"position": {
"x": null,
"y": null,
@ -57,7 +61,7 @@ function start(){
program.clear();
program.move(1, 1);
program.bg('blue');
// program.bg('blue');
program.write('A Visit to Moaning Cream Camp, and Other Villages', 'red fg');
//program.setx((program.cols / 4 | 0) );
program.setx(1);
@ -66,7 +70,7 @@ function start(){
program.setx(1);
program.down(1);
program.write('Q to quit');
program.bg('!black');
// program.bg('!black');
program.feed();
}
@ -280,13 +284,14 @@ function checkCollision() {
//check Collision with Items
for (let i = 0; i < roomItems.length; i++){
if ((player.position.x == roomItems[i].position.x) && (player.position.y == roomItems[i].position.y)){
program.setx(1)
program.setx(0)
program.down(1)
program.write(roomItems[i].name);
program.setx(1)
program.setx(0)
program.down(2)
program.write(roomItems[i].description);
program.down(1)
program.setx(0)
}
}
@ -294,6 +299,7 @@ function checkCollision() {
for (let i = 0; i < places.length; i++){
if ((player.position.x == places[i].position.x) && (player.position.y == places[i].position.y)){
//player is standing at this place
program.setx(0)
program.write(places[i].name);
}
}
@ -358,6 +364,7 @@ function createMap(){
createPlayer();
loadTextFiles();
createItems();
createTracks();
createBooks();
createPlaces();
createGraves();
@ -428,6 +435,12 @@ let loadTextFiles = () => {
itemDescriptions = fs.readFileSync(descriptionsFile).toString().split("\n");
verbs = fs.readFileSync(verbsFile).toString().split("\n");
let media = JSON.parse(fs.readFileSync(mediaFormatsFile).toString());
mediaFormats = media.instruments;
let genresList = JSON.parse(fs.readFileSync(genresFile).toString());
genres = genresList.genres;
}
let createItems = () => {
@ -521,6 +534,58 @@ let createBooks = () => {
}
let createTracks = () => {
let numToSpawn = Math.round(Math.random() * 2) + 2;
for (let i = 0; i < numToSpawn; i++){
const items = [ "♥", "♦", "♣", "♠", "•", "◘", "○", "◙", "♂", "♀", "♪", "♫", "☼", "►", "◄", "↕", "‼", "¶", "§", "▬", "↨", "↑", "↓", "→", "←", "∟", "↔", "▲", "▼", "{", "|", "}", "~", "⌂", "Ç", "ü", "é", "â", "ä", "à", "å", "ç", "ê", "ë", "è", "ï", "î", "ì", "Ä", "Å", "É", "æ", "Æ", "ô", "ö", "ò", "û", "ù", "ÿ", "Ö", "Ü", "¢", "£", "¥", "₧", "ƒ", "á", "í", "ó", "ú", "ñ", "Ñ", "ª", "º", "¿", "⌐", "¬", "½", "¼", "¡", "«", "»", "░", "▒", "▓", "│", "┤", "╡", "╢", "╖", "╕", "╣", "║", "╗", "╝", "╜", "╛", "┐", "└", "┴", "┬", "├", "─", "┼", "╞", "╟", "╚", "╔", "╩", "╦", "╠", "═", "╬", "╧", "╨", "╤", "╥", "╙", "╘", "╒", "╓", "╫", "╪", "┘", "┌", "█", "▄", "▌", "▐", "▀", "α", "ß", "Γ", "π", "Σ", "σ", "µ", "τ", "Φ", "Θ", "Ω", "δ", "∞", "φ", "ε", "∩", "≡", "±", "≥", "≤", "⌠", "⌡", "÷", "≈", "°", "∙", "·", "√", "ⁿ", "²", "■" ]
whichItem = Math.floor(Math.random()*items.length);
//pick bandname
let pre = ["The ",""];
let band;
if (Math.random()<0.8){
band = choose(pre)+generator.generate().spaced;
} else if (Math.random()<0.6){
band = choose(pre)+generator.generate({ words: 3, alliterative: true}).spaced;
} else {
band = choose(pre)+generator.generate({ words: 1}).spaced;
}
band=capitalize(band);
let trackNameLength = Math.round(Math.random()*3)+1;
let trackName = generator.generate({ words: trackNameLength}).spaced;
trackName = capitalize(trackName);
//assemble
let name = trackName + " " + choose(mediaFormats);
let symbol = choose(items);
let adj = ["killer","new","old","classic","nu-skool","heavy","thrilling","drugged-out","trippy","ethereal","hard","sublime","serene","airy","brilliant","beautiful","celebratory","chill","cold","serene","damaged","draining","dark","echoy","earnest","elated","elevated","erratic","ergodic","fantastic","freak","great","gleeful","iridescent","ultra","ill","crooked","light","sick","original","powerful","pretty","playful","quiet","rewarding","ripped","rave","roaring","raucous","severe","slick","superior","tortured","tinged","vanity","victorious","vicious","wicked","wailing","wizardly","wavy","max-ed out","zooted"];
let descrip = capitalize(choose(adj)) + " " + choose(genres) + " track "+ trackName + " by " + band + ".";
roomItems.push(
{
"name": name,
"symbol": symbol,
"description": descrip,
"position":
{
"x":Math.floor(Math.random()*width),
"y":Math.floor(Math.random()*height)
}
}
)
}
}
let choose = arr => arr[Math.floor(Math.random()*arr.length)];
let capitalize = (str) => {
@ -547,7 +612,7 @@ let createPlaces = () => {
//const buildings = ['🏛️','⛺','🏚️','⛩️','🗿']
const buildings = ['⌂','⏏','☖','☗','⛫']
const placeTypes = ['Village','Village','Village','House','House','Market','Market','Market','Crossroads','Place','Outpost','Trading Post','House','Shack','Meeting Place','Saloon','Watering Hole','Stall','Hideout','Cart','Camp','Camp','Camp','Camp','','','','Zone of Ill Repute']
const placeTypes = ['Radio','Village','House','Pirate Station','Autonomous Zone','Market','Crossroads','Place','Outpost','Trading Post','Space','Place','Gallery','Floor','House','Shack','Meeting Place','Saloon','Watering Hole','Stall','Hideout','Cart','Bar','Camp','','','','Zone']
let whichBuilding = buildings[Math.floor(Math.random()*buildings.length)];
@ -582,7 +647,7 @@ let createGraves = () => {
let gravestones = ['✝','✟','☨','✞','⛼'];
let whichGravestone = choose(gravestones);
let prefix = ["Here lies","RIP","","","","Resting place of ","Beloved"]
let reason = ["Made an enemy","Wasn't afraid to be","Tried","Died while","Passed while performing","Tried out","Dissapeared investingating","Wandered off while looking for","Last seen","Loved","Adored","A lifelong fan of","Our favorite at","The best at","Always in our hearts","Keep","Always be","Always","Just","Tried","Couldn't stop","Only ever found","Died","Passed while","Couldn't stop","Forgot to try","Never stopped","We'll always think of you when we're","It's not the same"]
let reason = ["Made an enemy","Wasn't afraid to be","Tried","Died while","Passed while performing","Tried out","Dissapeared investigating","Wandered off while looking for","Last seen","Loved","Adored","A lifelong fan of","Our favorite at","The best at","Always in our hearts","Keep","Always be","Always","Just","Tried","Couldn't stop","Only ever found","Died","Passed while","Couldn't stop","Forgot to try","Never stopped","We'll always think of you when we're","It's not the same"]
let epitaph = prefix[Math.floor(Math.random() * prefix.length)] + " " + name +"\n"+reason[Math.floor(Math.random() * reason.length)]+" " + verbs[Math.floor(Math.random()*verbs.length)] + ".";