Best way to store level data

5 posts

Flag Post

My current game is a block avoider/collector game (think BIT.TRIP BEAT). At the moment I’m using XML to store the level data, but I was wondering if there were a better format/easier to use, since at the moment I’m loading an external XML file.

 
Flag Post

JSON is smaller, although a little less readable perhaps, but easier to write also.
You could use a custom data format too if you wanted.

 
Flag Post

Can you tell us how you plan to produce the level data? Level editor or just tying the data out?

 
Flag Post
Originally posted by qwerberberber:

Can you tell us how you plan to produce the level data? Level editor or just tying the data out?

Type it out, most likely. I may develop a level editor if making levels for this thing gets too complex.

<Pattern id="0">
			<Step id="pause"><Pause time="300"/></Step>
			<Step id="01">
				<Particle type="3" x="243" y="-30" group="1" xVel="5" yVel="10" />
				<Particle type="3" x="243" y="-355" group="1" xVel="5" yVel="15" />
				<Pause time="2000" />
			</Step>
			<Step id="02">
				<Particle type="3" x="343" y="-30" group="1" xVel="5" yVel="10" />
				<Particle type="3" x="343" y="-355" group="1" xVel="5" yVel="15" />
				<Pause time="2000" />
			</Step>
			<Step id="03">
				<Particle type="3" x="400" y="-30" group="1" xVel="5" yVel="10" />
				<Particle type="3" x="400" y="-355" group="1" xVel="5" yVel="15" />
				<Pause time="2000" />
			</Step>
			<Step id="04">
				<Particle type="3" x="150" y="-30" group="1" xVel="5" yVel="10" />
				<Particle type="3" x="150" y="-355" group="1" xVel="5" yVel="15" />
				<Pause time="2000" />
			</Step>
	</Pattern>

Here’s what I’m currently using, typed manually.

 
Flag Post

I’d recommend JSON.

I currently load a settings.json for flash config into my flash project (Final product the json is embedded) that looks like such:

{ 
"framerate":30,
"screen":"none",
"background":{
		 "tile":"dark_brick_wall.png",
		 "tint_color":"0xCCCCFF",
		 "parallax_speed":0
		},
"player":{
		 "gravity":1.20,
		 "friction":0.80,
		 "jump_power":8.5,
		 "max_y_velocity":11,
		 "camera_following":false,
		 "jumps_in_a_row":1,
		 "min_run_speed":1.0
		},
"menu":{
		"Menu_Credits":"Give Credit Where Credit is due.\n\n\nAll of these amazing people and sites helped to make this game.",
		"Menu_More Games":"More Games. You'll never run out. We promise.",
		"Menu_Hall of Fame":"Only if you have truly beat the game, will your name live on.\n\nTo do so, you need to collect every chest AND beat the secret level!",
		"Menu_Settings":"Select your settings by collecting keys. \n\n\nThe music is awesome though. We suggest you keep it on."
		},
"transition": {
		 "duration":30,
		 "stripeDuration":10,
		 
		 "retry_duration":15,
		 "retry_stripeDuration":5
		},
"dirt":{
		 "disolveSpeed":1,
		 "distanceAboveToTriggerDisolve":-2
		},
"fireball":{
		 "rotateSpeed":1
		},
"chest":{
		 "flashSpeed":1
		},
"spike":{
		 "tile29":"up",
		 "tile28":"right",
		 "tile27":"left",
		 "tile25":"down",
		 "up":		{ "width":12, "height":8, "x":-2, "y":-8 },
		 "down":	{ "width":12, "height":8, "x":-2, "y": 0 },
		 "left":	{ "width":8, "height":12, "x":-8, "y":-2 },
		 "right":	{ "width":8, "height":12, "x": 0, "y":-2 }
		},
"hud":{
		 "scrollXY":0,
		 "font_size":10,
		 "font_color":"0xffffff",
		 "font_width":75,
		 "x_pos":15,
		 "y_pos":10
		}
}