PLEX Game File Formats

Comment 1 Standard

This week I’ve been dealing with game file formats. Each character in the game has to have different maps that the game starts off with initially. The NPC will start off in different locations, the available items will be different, and so forth and so on. I was thinking of breaking all the game data into several files. By default, each character in the game will have a set of maps that are loaded when a new game is started, so each character will need their own map file.

While one file is used for all the map information in the game, another file is going to be used to store all the other game information, from the player’s current items, positions, and values of variables that were stored when they saved their game.

The third and final file will contain information about all the NPC’s in the game. Their location, what lines of text they should start displaying when a game has been loaded again, etc.

This means that every character will have a set of 3 files when a new game is started that will have to be loaded into the game when it begins. It also means that every time someone chooses to save their game, it will have to create three files storing the current state of all maps, character information, and NPC information. Here is the format I came up with for each of the three different file types. It may change as I implement the load/save and realize I need to add/subtract information, but it should follow these basic formatting principles.

1) All files will be separated using tabs ‘/t’ to indicate all information on that line is associated some how. For instance, all information on that line could be a row of blocks on a level of one map.

2) All files will have a carriage return ‘/n’ at the end of a line to indicate a new piece of information is present.

3) Text will be surrounded by quotation marks “” to delineate where the string starts and stops.

4) Variables will be bound to any value on the right of an equals = sign. If there is no value or spaces following the equal sign and \n the variable will be bound to null.

5) An exclamation mark can be used to represent that new or different data is present. For instance, an ! mark in a map file lets the parser know that a new map is to be read.

6) A line with no data on it, or spaces followed by an \n will be ignored.

7) A comma between numbers will be treated as a coordinate set.

8 ) Information between a set of parentheses () should be ignored as a comment

Map File Format:

MapName\n

0, 0,0 /t6\t5\t2\t1\t \t7\t2\t2\n

0, 0,1 /t6\t5\t2\t1\t \t7\t2\t2 \n

!

MapName2\n

0, 0,0 /t6\t5\t2\t1\t \t7\t2\t2\n

0, 0,1 /t6\t5\t2\t1\t \t7\t2\t2 \n

Player File Format:

CharacterName (the character they’re playing as)\n

x,y,z (current position)\n

mapName (map they’re on)\n

shovels = 6 \n

bombs = 2 \n

health = 7 \n

ramps = 2\n

NPC File Format:

CharacterName/n

x, y, z /n

textLine = 452/n

nextItem = 2/n

!

CharacterName/n

x, y, z /n

textLine = 12/n
nextItem = 2/n

!

CharacterName/n

x, y, z /n

textLine = 772/n
nextItem = /n

The only thing I have to worry about with the files is that when someone saves their game they then go into the saved game files and change the information that in them. For that reason I’m considering some type of encryption so they can’t read the files once they’ve been saved unless they can figure out how to decrypt them.

Advertisements

One thought on “PLEX Game File Formats

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s