Skip to content

Instantly share code, notes, and snippets.

@cspotcode
Created January 12, 2012 01:34
Show Gist options
  • Save cspotcode/1597921 to your computer and use it in GitHub Desktop.
Save cspotcode/1597921 to your computer and use it in GitHub Desktop.
New GG2 map format
categories:
[
{ name: "Control Points"
, types:
[
{ name: "controlPoint1"
, humanReadableName: "Control Point 1"
, id: "controlPoint1"
, mapImage: "controlPoint1_map.png"
, mapImageOrigin: {x: 0, y: 0}
, paletteImage: "controlPoint1_palette.png"
, gameModes: ["CP", "STCP"] /* this entity type will only be visible in CP or STCP modes */
}
, { /* some other entity type */
}
]
}
, { name: "Spawn points"
, types:
[
{ name: "redspawn"
, humanReadableName: "Red Spawn"
, id: "redspawn"
, mapImage: "redspawn_map.png"
, mapImageOrigin: {x: 29, y: 40}
, paletteImage: "redspawn_palette.png"
}
, { name: "bluespawn"
, humanReadableName: "Blue Spawn"
, id: "bluespawn"
, mapImage: "bluespawn_map.png"
, mapImageOrigin: {x: 29, y: 40}
, paletteImage: "bluespawn_palette.png"
}
]
}
]
/* New format for GG2 leveldata.
* This JSON document fully describes a GG2 level.
* It can be embedded into a PNG with GG2DLL,
* packed up in a zip along with any BG/WM images,
* sent over the network, etc.
*
* Also this should be ready for future improvements and changes, unlike the terrible older format.
*/
{ format: 1 /* a format number?
* GG2 can reject maps with newer format numbers than it supports,
* and can provide legacy loading code for older format numbers
*/
, mapInfo:
{ name: 'TwoDeeFort-Redux'
, gameMode: 'CTF' /* support multiple gamemodes in a single map?
* cspotcode says 'no' because it would be too complicated,
* require extra GUI in GG2 for server host to choose game mode,
* and provide only minimal benefit
*/
, description: 'Anything the author wants. Could have contact info. Could be displayed in a possible GG2 levelpicker GUI'
/* other stuff?
* setup time, respawn wave duration, other timers?
*/
}
, collisionMasks: /* list of collision images.
[ * These are all black/white like a walkmask but can theoretically be used for anything.
* They will be turned into collision sprites by GG2 and can be referenced by entities below.
*/
{ name: 'walkmask'
, size: {width: 700, height: 300}
, data: 'TODO WHAT FORMAT SHOULD THIS DATA BE IN? MAYBE A BASE64 ENCODED STREAM OF BITS?'
}
, { name: 'funkyShape' /* could be some strange, non-rectangular shape for a fragbox that the level designer wanted to paste all over the map */
, size: {width: 10, height: 20}
, data: 'AIENCMNUE'
}
]
, graphics: /* list of pictures.
* They can theoretically be used for anything.
* They are references by name within the entities below.
*/
[
{ name: 'backgroundImage'
, file: 'background.png'
}
{ name: 'creepyFogForeground'
, file: 'fog.png'
}
]
, entities: /* all entities on the map */
[
{ type: 'redspawn' /* basic entity */
, position: {x: 156, y:34}
}
, { type: 'fragBox'
, position: {x:500, y:435}
, size: {width: 200, height: 20} /* a resizable entity! */
}
, { type: 'controlPoint'
, position: {x: 20, y: 20}
, pointNumber: 2 /* an entity parameter! */
}
, { type: 'wall'
, position: {x: 0, y: 0}
, collisionMask: 'walkmask' /* refers to the collisionMasks array above */
}
, { type: 'wall',
, position: {x: 200, y: 250},
, size: {width: 10, height: 10} /* same entity type as above, but this time we specify the collision mask as a solid rectangle.
* No collisionMasks reference needed */
}
, { type: 'graphic' /* An image that's rendered by the game engine. Can be any PNG included in the map's .zip */
, position: {x: 0, y: 0}
, graphic: 'backgroundImage'
}
, { type: 'graphic'
, position: {x: 0, y: 0}
, graphic: 'creepyFogForeground'
, z-index: 10 /* z-index is used to stack images on top of each other. This image will appear in the foreground */
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment