Skip to content
Robert Konrad edited this page Nov 2, 2013 · 9 revisions

Kha uses a JSON file called project.kha to organize the assets of your project and some essential project data. A basic project.kha looks like this:

{
	"format": 1,
	"game":
	{
		"name": "SML",
		"width": 600,
		"height": 520
	},
	"assets":
	[
		{
			"id": "a057c5a0-43e7-11e3-8f96-0800200c9a66",
			"type": "image",
			"file": "blockcoin.png",
			"name": "blockcoin"
		},
		{
			"id": "abf4cb60-43e7-11e3-8f96-0800200c9a66",
			"type": "sound",
			"file": "coin",
			"name": "coin"
		},
		{
			"id": "b2db9c10-43e7-11e3-8f96-0800200c9a66",
			"type": "music",
			"file": "level1",
			"name": "level1"
		},
		{
			"id": "ba2b19a0-43e7-11e3-8f96-0800200c9a66",
			"type": "blob",
			"file": "level.map",
			"name": "level.map"
		}
	],
	"rooms":
	[
		{
			"id" : "c06ef390-43e7-11e3-8f96-0800200c9a66",
			"name": "level1",
			"parent": null,
			"neighbours": [],
			"assets":
			[
				"a057c5a0-43e7-11e3-8f96-0800200c9a66",
				"abf4cb60-43e7-11e3-8f96-0800200c9a66",
				"b2db9c10-43e7-11e3-8f96-0800200c9a66",
				"ba2b19a0-43e7-11e3-8f96-0800200c9a66"
			]
		}
	]
}

All assets are identified using a UUID. Kha supports five different types of assets:

image

For all kinds of images. You can provide images in jpeg, png, tga, bmp or gif format. All images are currently converted to png before actual use.

sound

For small sound files in wav format. This is converted to different formats dependent on the target system.

music

For large sound files in wav format which will be streamed at runtime. This is converted to different formats dependent on the target system.

video

For video files. These are currently not converted automatically.

blob

For binary blobs / everything else - provides a byte array at runtime.

Assets are organized in rooms. Typically a room corresponds to a level in a game. A room can have a parent room - when a room is loaded, all assets of that room are loaded as well as all assets of all parents. Applications typically use just one room.

Clone this wiki locally