package com.lucasdnd.ags.gameplay.market;
import java.util.Random;
public class NameSystem {
private Random random;
private String[] gamePrefixes, gameSuffixes;
private String[] gameAdjectives, gameFirstNouns, gameSecondNouns, gameVersions;
private String[] consoleAdjectives, consoleNouns, consoleVersions;
public String generateGameName() {
String name = "";
// 50/50: Adjective + Noun or just a randomly generated Noun
// if (random.nextInt(2) == 0) {
name += gameAdjectives[random.nextInt(gameAdjectives.length)];
name += " " + gameFirstNouns[random.nextInt(gameFirstNouns.length)];
// } else {
// name += gamePrefixes[random.nextInt(gamePrefixes.length)] + gameSuffixes[random.nextInt(gameSuffixes.length)];
// }
// 50% chance to have a second noun
if(random.nextBoolean()) {
name += " " + gameSecondNouns[random.nextInt(gameSecondNouns.length)];
}
// Small chance of having a version
if(random.nextInt(12) == 0) {
// Check if the name has space for a new piece. Max 36 characters.
int currentLength = name.length();
String version = gameVersions[random.nextInt(gameVersions.length)];
if(currentLength + version.length() <= 36) {
name += " " + version;
}
}
return name;
}
public String generateConsoleName() {
String name = "";
name += consoleAdjectives[random.nextInt(consoleAdjectives.length)];
name += " " + consoleNouns[random.nextInt(consoleNouns.length)];
if(random.nextBoolean()) {
name += " " + consoleVersions[random.nextInt(consoleVersions.length)];
}
return name;
}
public NameSystem() {
random = new Random();
// Games: max 36 characters
gameAdjectives = new String[] {
"Super", "Advanced", "Ridiculous", "Awesome", "Amazing", "Red", "Blue", "Green", "Yellow", "Black", "Erotic", "Rough", "Weird", "Lame",
"Gigantic", "Mini", "Poisonous", "Retro", "Fluffy", "Twin", "Orbital", "Underground", "Happy", "Bizarre", "The Amazing", "Lair of the",
"Cute", "Master", "Electric", "Extreme", "Acrobatic", "The Last", "The", "Grand", "Dragon"
};
gameFirstNouns = new String[] {
"Combat", "Crystal", "Penguin", "Kangaroo", "Farm", "Space Mutants", "Mafia", "Goat", "Squirrel", "Cat", "Dog", "Sword", "Galaxy", "Space", "Thief",
"Soldier", "Mutants", "Wood", "Army", "Ship", "Bicycle", "Theft", "Kingdom", "Whale", "Delivery", "Shield", "Armor", "Warrior", "Hunter", "Wizard"
};
gameSecondNouns = new String[] {
"Adventure", "in Space", "Studio", "Forever", "Saga", "Feud", "Horde", "Alliance", "of Death", "Boxing", "Race", "Civilization",
"Colonization", "Exploration", "from Mars", "Explorer", "Soccer", "Tenis", "Golf", "Basketball", "Ski", "Colony", "Fail"
};
gameVersions = new String[] {
"3D", "2000", "3000", "64", "Jr.", "Reloaded", "Plus", "Pro", "95", "98", "2", "3", "X", "- The Prequel"
};
// Single words
gamePrefixes = new String[] {"Grass", "Post", "Cup", "Pizza", "Fail"};
gameSuffixes = new String[] {"crab", "gen", "holder", "ant"};
// Consoles: max 23 characters
consoleAdjectives = new String[] {
"Super", "Advanced", "Master", "Extreme", "VR", "Grand", "Optimal", "Amazing", "Nice", "Mini", "Great", "Ultra", "Plastic", "Game", "Retro",
"Awesome", "Family", "Epoch", "Arcade", "Action", "Max"
};
consoleNouns = new String[] {
"System", "Optimus", "Station", "Machine", "Box", "Drive", "Vision", "Computer", "Video", "PC", "Challenger"
};
consoleVersions = new String[] {
"2", "3", "4", "CD", "64x", "16-bit", "8-bit", "32-bit", "3D", "2000", "3000", "2600", "3800", "64", "Plus",
"X", "Y", "Z"
};
int gamePossibilities = gameAdjectives.length * gameFirstNouns.length * gameSecondNouns.length * gameVersions.length;
int consolePossibilities = consoleAdjectives.length * consoleNouns.length * consoleVersions.length;
System.out.println("Game names possibilities: " + gamePossibilities);
System.out.println("Console names possibilities: " + consolePossibilities);
System.out.println("");
System.out.println("Game name max characters: " + getMaxGameNameLength());
System.out.println("Console name max characters: " + getMaxConsoleNameLength());
}
private int getMaxGameNameLength() {
int result = 0;
result += getMaxLength(gameAdjectives);
result += getMaxLength(gameFirstNouns);
result += getMaxLength(gameSecondNouns);
result += getMaxLength(gameVersions);
return result;
}
private int getMaxConsoleNameLength() {
int result = 0;
result += getMaxLength(consoleAdjectives);
result += getMaxLength(consoleNouns);
result += getMaxLength(consoleVersions);
return result;
}
private int getMaxLength(String[] array) {
int result = 0;
String largest = "";
for(String item : array) {
if(item.length() > result) {
result = item.length();
largest = item;
}
}
System.out.println("largest = " + largest);
return result;
}
}