Jump to content

  • Log In with Google      Sign In   
  • Create Account




- - - - -

Musings on Data Configs

Posted by , 04 May 2013 · 917 views

JSON Data Driven Games Vaerydian
Haven't done too much over this week. Mainly just working on concepts surrounding creature definition files and ideas on how i'll make map configs work.

Here is how the creatures.v file is forming up so far:
{
  "creature_defs":[
  {
    "name":"BAT",
    "character_def":"BAT",
    "behavior_def":"DEFAULT_ENEMY",
    "acb_def":"DEFAULT_ENEMY",
    "skill_level":0,
    "information":{
      "name":"Bat",
      "general_group":"BAT",
      "variation_group":"NONE",
      "unique_group":"NONE"
    },
    "interactions_def":"DEFAULT_ENEMY",
    "equipment":{
      "weapon_def":"BAT_SONIC",
      "armor_def":"BAT_ARMOR"
    },
    "knowledges":{
    },
    "statistics":{
    },
    "health":{
    },
    "skills":{
    },
    "factions":{
    }			
  }
  ]
}


not much to see yet, but it captures most of the non derived/generated component definitions.

The maps are a different affair.

some early configs just for generation parameters looked like so:
{
  "WORLD" :{
    "x" : 0,
    "y" : 0,
    "dx" : 854,
    "dy" : 480,
    "z" : 5.0,
    "xsize" : 854,
    "ysize" : 480,
    "seed" : 42
  },
  "CAVE" :{
    "x" : 100,
    "y" : 100,
    "prob" : 45,
    "cell_op_spec" : true,
    "iter" : 50000,
    "neighbors" : 4,
    "seed" : 42 
  } 
}



but those just tell the generation routines what to use as defaults. So i thought of how i may start clustering like-minded information together and came up with my maps.v
{
  "map_types":{
    "CAVE": 0,
    "DUNGEON": 1,
    "TOWN": 2,
    "CITY": 3,
    "TOWER": 4,
    "OUTPOST": 5,
    "FORT": 6,
    "NEXUS": 7,
    "WORLD": 8,
    "WILDERNESS": 9
  },
  "map_defs":[
    {"name":"NONE", "id":0},
    {"name":"CAVE", "id":1}
  ],
  "map_params":{
    "WORLD" :{
      "world_params_x" : 0,
      "world_params_y" : 0,
      "world_params_dx" : 854,
      "world_params_dy" : 480,
      "world_params_z" : 5.0,
      "world_params_xsize" : 854,
      "world_params_ysize" : 480,
      "world_params_seed" : null
    },
    "CAVE" :{
      "cave_params_x" : 100,
      "cave_params_y" : 100,
      "cave_params_prob" : 45,
      "cave_params_cell_op_spec" : true,
      "cave_params_iter" : 50000,
      "cave_params_neighbors" : 4,
      "cave_params_seed" : null
    }
  }
}

here you can see i took the params file and just shoved it in an object def location. I also think the config defs like "cave_params_cell_op_spec" need to be shortened, but we'll see if i end up calling it enough times for it to matter. The new sections are just a listing of the types of maps i want to players to know they can generate and a definitions section where the maps will be defined. What i'm thinking of doing is having some default, yet tweakable parameters for each map definition, maybe not for the world, but definitely for the other maps. The idea would be that the map would expect one-to-many terrain definitions to be set in certain list definitions in the json, it would then choose them during run-time to set the tiles and data structures. so you would have definitions like:
"walls":[
  "TERRAIN_GRANITE",
  "TERRAIN_CARVED_STONE",
  "TERRAIN_STONE_WALL_TORCH"
],
"floors":[
  "TERRAIN_STONE_FLOOR",
  "TERRAIN_TILED_STONE",
  "TERRAIN_CRACKED_STONE_FLOOR"
]
and each of those definitions would be defined in the terrain.v config file like so:
{
  "name" : "BASE_LAND",
  "id" : 1,
  "texture" : "terrain\\default",
  "texture_offset" : [
    0,
    0
  ],
  "color" : [
    255,
    255,
    255
  ],
  "passible" : true,
  "effect" : "NONE",
  "type" : "FLOOR"
}

This way the game would know to randomly select "floor" terrain during generation that is defined in its data structures using the specs defined in the terrain.v files. To increase variety i may add some additional info like probability of occurrence based on either pure randomness or maybe depth of the player. So you start out in more wilderness-y like maps then move into caves then move into small dungeons then into underground cities, etc. Not sure how i want to approach that or if it should just be added to my back-log of things to do after alpha 2 is complete.

Anyway, I think that'll give me a fun and flexible map system to work with.

That's all for now!






December 2016 »

S M T W T F S
    123
45 6 78910
11121314151617
18192021222324
25262728293031

Recent Comments