work on macro simulation
This commit is contained in:
parent
5e2f3d457b
commit
581de4f58a
@ -122,6 +122,12 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
"name" : "Goblin",
|
||||
"bodyParts" : [
|
||||
@ -234,6 +240,15 @@
|
||||
"modelPath" : "Models/goblin1.fbx"
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
"name" : "CUBE_MAN",
|
||||
@ -276,5 +291,9 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
8
assets/Data/races.json
Normal file
8
assets/Data/races.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"raceMap" : [
|
||||
{
|
||||
"name" : "Human",
|
||||
"associatedCreature" : "Human"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"symbolismMap" : [
|
||||
{
|
||||
"name" : "fire",
|
||||
"name" : "wind",
|
||||
"relations" : [
|
||||
{
|
||||
"name" : "water",
|
||||
@ -10,21 +10,573 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "water",
|
||||
"name" : "fire",
|
||||
"relations" : [
|
||||
{
|
||||
"name" : "fire",
|
||||
"strength" : -1
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "earth",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "ice",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "water",
|
||||
"relations" : [
|
||||
{
|
||||
"name" : "fire",
|
||||
"strength" : -1
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "lightning",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "metal",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "crystal",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "storm",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "lava",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "gravity",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "light",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "dark",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "arcane",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "time",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "sound",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "poison",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "mirror",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "barrier",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "void",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "crescent",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "life",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "death",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "nightmare",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "dream",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "sleep",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "sky",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "speed",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "mind",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "dawn",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "dusk",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "spring",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "summer",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "fall",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "winter",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "hunting",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "sun",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "moon",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "sky",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "earth",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "cloud",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "song",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "harmony",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "discord",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "beginning",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "end",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "moral",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "amoral",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "storm",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "flower",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "shadow",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "wealth",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "poverty",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "undeath",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "afterlife",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "logic",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "writing",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "violence",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "warfare",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "strategy",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "trade",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "law",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "order",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "justice",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "marriage",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "family",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "sea",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "harvest",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "argiculture",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "nature",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "wisdom",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "handicraft",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "prophecy",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "philosophy",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "archery",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "truth",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "inspiration",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "poety",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "art",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "medicine",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "healing",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "wilderness",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "protection",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "love",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "invention",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "volcanoes",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "travel",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "communication",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "borders",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "diplomacy",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "theft",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "game",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "civilization",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "structure",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "festivity",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "madness",
|
||||
"relations" : [
|
||||
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@ -4,6 +4,8 @@ import electrosphere.game.config.creature.type.model.CreatureTypeMap;
|
||||
import electrosphere.game.config.foliage.type.model.FoliageTypeMap;
|
||||
import electrosphere.game.config.item.type.model.ItemTypeMap;
|
||||
import electrosphere.game.config.structure.type.model.StructureTypeMap;
|
||||
import electrosphere.game.server.race.model.RaceMap;
|
||||
import electrosphere.game.server.symbolism.model.SymbolMap;
|
||||
import electrosphere.util.FileLoadingUtils;
|
||||
|
||||
/**
|
||||
@ -16,6 +18,8 @@ public class Config {
|
||||
StructureTypeMap structureTypeMap;
|
||||
ItemTypeMap itemMap;
|
||||
FoliageTypeMap foliageMap;
|
||||
SymbolMap symbolMap;
|
||||
RaceMap raceMap;
|
||||
|
||||
public static Config loadDefaultConfig(){
|
||||
Config config = new Config();
|
||||
@ -23,6 +27,8 @@ public class Config {
|
||||
config.itemMap = FileLoadingUtils.loadObjectFromAssetPath("Data/items.json", ItemTypeMap.class);
|
||||
config.structureTypeMap = FileLoadingUtils.loadObjectFromAssetPath("Data/structures.json", StructureTypeMap.class);
|
||||
config.foliageMap = FileLoadingUtils.loadObjectFromAssetPath("Data/foliage.json", FoliageTypeMap.class);
|
||||
config.symbolMap = FileLoadingUtils.loadObjectFromAssetPath("Data/symbolism.json", SymbolMap.class);
|
||||
config.raceMap = FileLoadingUtils.loadObjectFromAssetPath("Data/races.json", RaceMap.class);
|
||||
return config;
|
||||
}
|
||||
|
||||
@ -42,4 +48,12 @@ public class Config {
|
||||
return foliageMap;
|
||||
}
|
||||
|
||||
public SymbolMap getSymbolMap() {
|
||||
return symbolMap;
|
||||
}
|
||||
|
||||
public RaceMap getRaceMap() {
|
||||
return raceMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,15 +1,44 @@
|
||||
package electrosphere.game.server.character;
|
||||
|
||||
import electrosphere.game.server.character.diety.Diety;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class Character {
|
||||
boolean isDiety;
|
||||
Diety diety;
|
||||
boolean hasBasicPersonality;
|
||||
BasicPersonality basicPersonality;
|
||||
boolean hasAdvancedPersonality;
|
||||
AdvancedPersonality advancedPersonality;
|
||||
int discreteX;
|
||||
int discreteY;
|
||||
static int entity_id_iterator = 0;
|
||||
|
||||
int id;
|
||||
|
||||
HashMap<String,Object> data = new HashMap();
|
||||
|
||||
LinkedList<String> dataKeys = new LinkedList();
|
||||
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id){
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void putData(String key, Object o){
|
||||
data.put(key,o);
|
||||
dataKeys.add(key);
|
||||
}
|
||||
|
||||
public List<String> getDataKeys(){
|
||||
return dataKeys;
|
||||
}
|
||||
|
||||
public Object getData(String key){
|
||||
return data.get(key);
|
||||
}
|
||||
|
||||
public Character(){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
package electrosphere.game.server.character;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author amaterasu
|
||||
*/
|
||||
public class CharacterDataStrings {
|
||||
|
||||
public static final String POSITION_DISCRETE = "position";
|
||||
public static final String DIETY = "diety";
|
||||
public static final String PERSONALTIY_BASIC = "personalityBasic";
|
||||
public static final String PERSONALITY_ADVANCED = "personalityAdvanced";
|
||||
public static final String RACE = "race";
|
||||
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
package electrosphere.game.server.character;
|
||||
|
||||
import electrosphere.game.server.culture.Culture;
|
||||
import electrosphere.game.server.character.Character;
|
||||
import electrosphere.game.config.creature.type.CreatureType;
|
||||
|
||||
public class CharacterGenerator {
|
||||
|
||||
public static Character generateCharacter(CreatureType creature, Culture culture){
|
||||
Character character = new Character();
|
||||
|
||||
return character;
|
||||
}
|
||||
|
||||
public static void positionCharacter(Character c, int x, int y){
|
||||
c.discreteX = x;
|
||||
c.discreteY = y;
|
||||
}
|
||||
|
||||
|
||||
public static Character generateDietyOfArchetype(){
|
||||
Character character = new Character();
|
||||
|
||||
return character;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package electrosphere.game.server.character;
|
||||
|
||||
import electrosphere.game.server.character.Character;
|
||||
import electrosphere.game.server.character.diety.Diety;
|
||||
import electrosphere.game.server.race.model.Race;
|
||||
import org.joml.Vector2i;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author amaterasu
|
||||
*/
|
||||
public class CharacterUtils {
|
||||
|
||||
public static void addDiscretePosition(Character character, int posX, int posY){
|
||||
character.putData(CharacterDataStrings.POSITION_DISCRETE, new Vector2i(posX,posY));
|
||||
}
|
||||
|
||||
public static Vector2i getDiscretePosition(Character character){
|
||||
return (Vector2i)character.getData(CharacterDataStrings.POSITION_DISCRETE);
|
||||
}
|
||||
|
||||
public static void addDiety(Character character, Diety diety){
|
||||
character.putData(CharacterDataStrings.DIETY, diety);
|
||||
}
|
||||
|
||||
public static Diety getDiety(Character character){
|
||||
return (Diety)character.getData(CharacterDataStrings.DIETY);
|
||||
}
|
||||
|
||||
public static void addRace(Character character, Race race){
|
||||
character.putData(CharacterDataStrings.RACE, race);
|
||||
}
|
||||
|
||||
public static Race getRace(Character character){
|
||||
return (Race)character.getData(CharacterDataStrings.RACE);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,6 +1,43 @@
|
||||
package electrosphere.game.server.character.diety;
|
||||
|
||||
import electrosphere.game.server.symbolism.model.Symbol;
|
||||
import electrosphere.game.server.symbolism.model.SymbolMap;
|
||||
import electrosphere.main.Globals;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class Diety {
|
||||
|
||||
int godlyPower;
|
||||
List<Symbol> symbols = new LinkedList();
|
||||
|
||||
//TODO: eventually add function where we can pass intial symbol to seed rest of diety off of
|
||||
//this lets us create a "good" diety" and a "bad" diety to guarentee a more balanced pantheon
|
||||
|
||||
public static Diety generateDiety(long seed){
|
||||
Random random = new Random();
|
||||
Diety rVal = new Diety();
|
||||
|
||||
//TODO: eventually use bucket based rng system where previous choices affect chances on future ones
|
||||
//add symbols
|
||||
SymbolMap symbolMap = Globals.gameConfigCurrent.getSymbolMap();
|
||||
int numSymbolTypes = symbolMap.getSymbolismMap().size();
|
||||
int numSymbolsToAdd = 3 + Math.abs(random.nextInt()) % 5;
|
||||
for(int i = 0; i < numSymbolsToAdd; i++){
|
||||
Symbol potentialSymbol = symbolMap.getSymbolismMap().get(random.nextInt(numSymbolTypes));
|
||||
while(rVal.symbols.contains(potentialSymbol)){
|
||||
potentialSymbol = symbolMap.getSymbolismMap().get(random.nextInt(numSymbolTypes));
|
||||
}
|
||||
rVal.symbols.add(potentialSymbol);
|
||||
}
|
||||
|
||||
return rVal;
|
||||
}
|
||||
|
||||
public List<Symbol> getSymbols() {
|
||||
return symbols;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -12,4 +12,6 @@ public class Story {
|
||||
}
|
||||
|
||||
StoryType type;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
package electrosphere.game.server.culture.religion;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author amaterasu
|
||||
*/
|
||||
public class StoryDataStrings {
|
||||
/*
|
||||
FABLE, //a story including animals/things that explains a moral
|
||||
MYTH, //an explanation for some fact
|
||||
PARABLE, //a story strictly starring humans that explains a moral
|
||||
*/
|
||||
public static final String STORY_TYPE = "storyType";
|
||||
public static final String STORY_TYPE_FABLE = "fable";
|
||||
public static final String STORY_TYPE_MYTH = "myth";
|
||||
public static final String STORY_TYPE_PARABLE = "parable";
|
||||
|
||||
|
||||
public static final String MYTH_GOAL = "mythGoal"; //what is the goal of the myth?
|
||||
public static final String MYTH_GOAL_CREATE = "creationism"; //the goal is to tell of the creation of the world
|
||||
|
||||
|
||||
public static final String MYTH_CREATE_MECHANISM = "creationismMechanism"; //what is the mechanism that the world is created by in the myth
|
||||
public static final String CREATE_MECH_FROM_NOTHING = "fromNothing"; //there was nothing, and then the primary diety created the world
|
||||
public static final String CREATE_MECH_START_TIME = "startTime"; //everything that existed at the start was frozen, and then time began
|
||||
public static final String CREATE_MECH_DIVER = "diver"; //a primordial being dives into something and retrieves the world
|
||||
public static final String CREATE_MECH_EMERGENCE = "emergence"; //primordial entities morph through stages until they're the current world
|
||||
public static final String CREATE_MECH_DISMEMBERMENT = "dismemberment"; //some priomordial being is dismembered and the remains are the world
|
||||
|
||||
}
|
||||
22
src/main/java/electrosphere/game/server/race/model/Race.java
Normal file
22
src/main/java/electrosphere/game/server/race/model/Race.java
Normal file
@ -0,0 +1,22 @@
|
||||
package electrosphere.game.server.race.model;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author amaterasu
|
||||
*/
|
||||
public class Race {
|
||||
|
||||
String name;
|
||||
String associatedCreature;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getAssociatedCreature() {
|
||||
return associatedCreature;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package electrosphere.game.server.race.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author amaterasu
|
||||
*/
|
||||
public class RaceMap {
|
||||
|
||||
List<Race> raceMap;
|
||||
|
||||
public List<Race> getSymbolismMap() {
|
||||
return raceMap;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
package electrosphere.game.server.symbolism;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SymbolismMap {
|
||||
|
||||
List<SymbolismRelation> symbolismMap;
|
||||
|
||||
public List<SymbolismRelation> getSymbolismMap() {
|
||||
return symbolismMap;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package electrosphere.game.server.symbolism;
|
||||
package electrosphere.game.server.symbolism.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
package electrosphere.game.server.symbolism.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SymbolMap {
|
||||
|
||||
List<Symbol> symbolismMap;
|
||||
|
||||
public List<Symbol> getSymbolismMap() {
|
||||
return symbolismMap;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package electrosphere.game.server.symbolism;
|
||||
package electrosphere.game.server.symbolism.model;
|
||||
|
||||
public class SymbolismRelation {
|
||||
String name;
|
||||
144
src/main/java/electrosphere/game/server/world/MacroData.java
Normal file
144
src/main/java/electrosphere/game/server/world/MacroData.java
Normal file
@ -0,0 +1,144 @@
|
||||
package electrosphere.game.server.world;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import electrosphere.game.server.character.Character;
|
||||
import electrosphere.game.server.character.CharacterDataStrings;
|
||||
import electrosphere.game.server.character.CharacterUtils;
|
||||
import electrosphere.game.server.character.diety.Diety;
|
||||
import electrosphere.game.server.race.model.Race;
|
||||
import electrosphere.game.server.race.model.RaceMap;
|
||||
import electrosphere.game.server.symbolism.model.Symbol;
|
||||
import electrosphere.main.Globals;
|
||||
import java.util.Random;
|
||||
import org.joml.Vector2i;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author amaterasu
|
||||
*/
|
||||
public class MacroData {
|
||||
|
||||
List<Character> initialDieties = new LinkedList();
|
||||
List<Race> races = new LinkedList();
|
||||
List<Character> characters = new LinkedList();
|
||||
List<Character> aliveCharacters = new LinkedList();
|
||||
|
||||
|
||||
static Character generateInitialDiety(long seed){
|
||||
Character rVal = new Character();
|
||||
|
||||
|
||||
Diety diety = Diety.generateDiety(seed);
|
||||
CharacterUtils.addDiety(rVal, diety);
|
||||
|
||||
|
||||
return rVal;
|
||||
}
|
||||
|
||||
public static MacroData generateWorld(long seed){
|
||||
Random random = new Random(seed);
|
||||
MacroData rVal = new MacroData();
|
||||
|
||||
//generate initial dieties
|
||||
int numDieties = 3 + Math.abs(random.nextInt()) % 7;
|
||||
for(int i = 0; i < numDieties; i++){
|
||||
Character diety = generateInitialDiety(random.nextLong());
|
||||
rVal.initialDieties.add(diety);
|
||||
rVal.characters.add(diety);
|
||||
}
|
||||
|
||||
//generate initial races
|
||||
if(Globals.gameConfigCurrent.getRaceMap().getSymbolismMap().size() < 3){
|
||||
for(Race race : Globals.gameConfigCurrent.getRaceMap().getSymbolismMap()){
|
||||
rVal.races.add(race);
|
||||
}
|
||||
} else {
|
||||
RaceMap raceMap = Globals.gameConfigCurrent.getRaceMap();
|
||||
int numRacesToGenerate = 3 + random.nextInt(Math.min(raceMap.getSymbolismMap().size() - 3,7));
|
||||
for(int i = 0; i < numRacesToGenerate; i++){
|
||||
Race raceToAdd = raceMap.getSymbolismMap().get(random.nextInt(raceMap.getSymbolismMap().size()));
|
||||
while(rVal.races.contains(raceToAdd)){
|
||||
raceToAdd = raceMap.getSymbolismMap().get(random.nextInt(raceMap.getSymbolismMap().size()));
|
||||
}
|
||||
rVal.races.add(raceToAdd);
|
||||
}
|
||||
}
|
||||
|
||||
//spawn initial characters in each race
|
||||
//find initial positions to place characters at per race
|
||||
//generate initial characters
|
||||
//place them
|
||||
List<Vector2i> occupiedStartingPositions = new LinkedList();
|
||||
for(Race race : rVal.races){
|
||||
boolean foundPlacementLocation = false;
|
||||
while(!foundPlacementLocation){
|
||||
Vector2i start = new Vector2i(random.nextInt(Globals.serverTerrainManager.getWorldDiscreteSize()),random.nextInt(Globals.serverTerrainManager.getWorldDiscreteSize()));
|
||||
//are we above sea level?
|
||||
if(Globals.serverTerrainManager.getDiscreteValue(start.x, start.y) > 25){ //TODO: Set to actual sea level value
|
||||
//is this position already occupied?
|
||||
boolean match = false;
|
||||
for(Vector2i known : occupiedStartingPositions){
|
||||
if(known.x == start.x && known.y == start.y){
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!match){
|
||||
//occupy position
|
||||
occupiedStartingPositions.add(start);
|
||||
foundPlacementLocation = true;
|
||||
//make characters
|
||||
int numCharactersToMake = 5 + random.nextInt(20);
|
||||
for(int i = 0; i < numCharactersToMake; i++){
|
||||
Character character = new Character();
|
||||
CharacterUtils.addDiscretePosition(character, start.x, start.y);
|
||||
CharacterUtils.addRace(character, race);
|
||||
rVal.characters.add(character);
|
||||
rVal.aliveCharacters.add(character);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rVal;
|
||||
}
|
||||
|
||||
public List<Character> getAliveCharacters(){
|
||||
return aliveCharacters;
|
||||
}
|
||||
|
||||
public void describeWorld(){
|
||||
System.out.println("Initial dieties");
|
||||
System.out.println("==========================");
|
||||
for(Character chara : initialDieties){
|
||||
System.out.println("Diety");
|
||||
Diety diety = CharacterUtils.getDiety(chara);
|
||||
for(Symbol symbol : diety.getSymbols()){
|
||||
System.out.print(symbol.getName() + " ");
|
||||
}
|
||||
System.out.println("\n");
|
||||
}
|
||||
System.out.println("==========================");
|
||||
System.out.println("\n\n");
|
||||
System.out.println("Initial races");
|
||||
System.out.println("==========================");
|
||||
for(Race race : races){
|
||||
System.out.println(race.getName());
|
||||
int numCharsOfRace = 0;
|
||||
//n*m complexity - yikes! - as long as we're not making a million chars at start this should be _ok_
|
||||
for(Character chara : characters){
|
||||
if(chara.getDataKeys().contains(CharacterDataStrings.RACE)){
|
||||
if(CharacterUtils.getRace(chara).equals(race)){
|
||||
numCharsOfRace++;
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println(numCharsOfRace + " initial characters");
|
||||
System.out.println("\n");
|
||||
}
|
||||
System.out.println("==========================");
|
||||
}
|
||||
|
||||
}
|
||||
@ -8,6 +8,8 @@ import electrosphere.game.server.culture.Culture;
|
||||
import electrosphere.game.server.culture.religion.Religion;
|
||||
import electrosphere.game.server.structure.virtual.Structure;
|
||||
import electrosphere.game.server.town.Town;
|
||||
import electrosphere.main.Globals;
|
||||
import electrosphere.game.server.character.Character;
|
||||
import electrosphere.util.FileLoadingUtils;
|
||||
import electrosphere.util.Utilities;
|
||||
import java.util.LinkedList;
|
||||
@ -15,16 +17,18 @@ import java.util.List;
|
||||
|
||||
public class MacroSimulation {
|
||||
|
||||
List<Civilization> civilizationList = new LinkedList();
|
||||
List<Culture> cultureList = new LinkedList();
|
||||
List<Religion> religionList = new LinkedList();
|
||||
List<CreatureType> creatureList = new LinkedList();
|
||||
List<Character> characterList = new LinkedList();
|
||||
List<Town> townList = new LinkedList();
|
||||
List<Structure> structureList = new LinkedList();
|
||||
// List<Civilization> civilizationList = new LinkedList();
|
||||
// List<Culture> cultureList = new LinkedList();
|
||||
// List<Religion> religionList = new LinkedList();
|
||||
// List<CreatureType> creatureList = new LinkedList();
|
||||
// List<Character> characterList = new LinkedList();
|
||||
// List<Town> townList = new LinkedList();
|
||||
// List<Structure> structureList = new LinkedList();
|
||||
|
||||
boolean isReady = false;
|
||||
|
||||
public MacroSimulation(){
|
||||
init();
|
||||
isReady = true;
|
||||
}
|
||||
|
||||
void init(){
|
||||
@ -33,6 +37,8 @@ public class MacroSimulation {
|
||||
}
|
||||
|
||||
public void simulate(){
|
||||
|
||||
for(Character character : Globals.macroData.getAliveCharacters()){
|
||||
//do something
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,6 +31,7 @@ import electrosphere.game.state.MacroSimulation;
|
||||
import electrosphere.game.server.terrain.manager.ServerTerrainManager;
|
||||
import electrosphere.game.server.town.Town;
|
||||
import electrosphere.game.server.world.ServerWorldData;
|
||||
import electrosphere.game.server.world.MacroData;
|
||||
import electrosphere.game.server.world.datacell.DataCellManager;
|
||||
import electrosphere.game.state.MicroSimulation;
|
||||
import electrosphere.menu.Menu;
|
||||
@ -204,6 +205,7 @@ public class Globals {
|
||||
|
||||
//macro simulation
|
||||
public static MacroSimulation macroSimulation;
|
||||
public static MacroData macroData;
|
||||
|
||||
//micro simulation
|
||||
public static MicroSimulation microSimulation;
|
||||
|
||||
@ -16,6 +16,9 @@ import electrosphere.entity.types.attach.AttachUtils;
|
||||
import electrosphere.engine.LoadingThread;
|
||||
import electrosphere.game.client.ClientFunctions;
|
||||
import electrosphere.game.config.UserSettings;
|
||||
import electrosphere.game.server.terrain.manager.ServerTerrainManager;
|
||||
import electrosphere.game.server.world.MacroData;
|
||||
import electrosphere.game.state.MacroSimulation;
|
||||
import electrosphere.game.state.MicroSimulation;
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
import electrosphere.renderer.RenderingEngine;
|
||||
@ -114,6 +117,19 @@ public class Main {
|
||||
//init global variables
|
||||
Globals.initGlobals();
|
||||
|
||||
//world gen testing
|
||||
//gen terrain
|
||||
Globals.serverTerrainManager = new ServerTerrainManager(2000,50,100,0.0f,0);
|
||||
Globals.serverTerrainManager.load();
|
||||
//gen world
|
||||
MacroData world = MacroData.generateWorld(0);
|
||||
world.describeWorld();
|
||||
boolean run = true;
|
||||
Globals.macroSimulation = new MacroSimulation();
|
||||
while(run){
|
||||
Globals.macroSimulation.simulate();
|
||||
}
|
||||
|
||||
//debug: create terrain/world viewer
|
||||
// TerrainViewer.runViewer();
|
||||
|
||||
@ -136,9 +152,6 @@ public class Main {
|
||||
///
|
||||
Vector3f cameraRotationVector = new Vector3f();
|
||||
|
||||
double posX = -1;
|
||||
double posZ = 0;
|
||||
|
||||
//main loop
|
||||
while (running) {
|
||||
|
||||
@ -200,10 +213,10 @@ public class Main {
|
||||
//
|
||||
// P L A Y E R W O R L D P O S I T I O N U P D A T E
|
||||
//
|
||||
if(Globals.playerCharacter != null && Globals.commonWorldData != null){
|
||||
newPlayerCharacterPosition = EntityUtils.getPosition(Globals.playerCharacter);
|
||||
Globals.clientPlayerData.setWorldPosition(Globals.commonWorldData.convertRealToWorld(newPlayerCharacterPosition.x), Globals.commonWorldData.convertRealToWorld(newPlayerCharacterPosition.z));
|
||||
}
|
||||
// if(Globals.playerCharacter != null && Globals.commonWorldData != null){
|
||||
// newPlayerCharacterPosition = EntityUtils.getPosition(Globals.playerCharacter);
|
||||
// Globals.clientPlayerData.setWorldPosition(Globals.commonWorldData.convertRealToWorld(newPlayerCharacterPosition.x), Globals.commonWorldData.convertRealToWorld(newPlayerCharacterPosition.z));
|
||||
// }
|
||||
|
||||
///
|
||||
/// C L I E N T C E L L M A N A G E R
|
||||
|
||||
Loading…
Reference in New Issue
Block a user