I'm not sure if anybody is interested in this, but I thought it could be fun to take a look at how exactly the engine's parser works at this time. It's also fun for me to look at it in the future and see how much it has evolved over time. It might get a bit technical, so questions are welcome as always.
The location that is currently fleshed out the most is the central plaza. The location parser is simple. It starts out with a name and a description:
"name": "Central Plaza",I trust that this part speaks for itself. The next block contains the coordinates of the location:
"description": "You walk to the the Central Plaza of the city. This place is mostly used for meeting up with people, as it connects all of the different districts of the city.\n\nThere is a giant fountain in the center of the plaza. You've always wondered how anyone managed to create something like this.\n\nSeveral guards are guarding the passage to the Southern District. The eastern district looks welcoming as always, with several shops opened up and ready for business. You can see the entrance of the city to the north."
"coordinates": {The direction keys work like this. Going in a certain direction changes your X and Y position according to the below table. The indexes go: north, east, south, west respectively. The first index determines the change in the X position, while the second index determines the change in the Y position.
"x": 16,
"y": 14,
"z": 1
}
0: {0: 0, 1: 1},The next part is a bit more confusing if I take all the actions from the Central Plaza, so I've taken the liberty of choosing one. Simply said, an action is when you get a choice to do something on a location. One of those actions is to inspect the border.
1: {0: 1, 1: 0},
2: {0: 0, 1: -1},
3: {0: -1, 1: 0}
"actions": {An action always has text for the player to click on. and starts a dialog after he/she does. An action may trigger a dialog that is specific to a companion, if companion_only is set to true. If it is set to false, it will be a generic dialog without companion interaction.
"1": {
"text": "Inspect Border",
"dialog_id": 12,
"companion_only": true,
"flag": {
"0": {
"id": 10,
"value": 1
},
"1": {
"id": 25,
"value": 0
}
}
}
}
Some options are only visible when certain conditions are met. In this case, flag 10 needs value 1, and flag 25 needs value 0. I keep track of the flags manually; In this case the player needs to have the quest accepted from Bart to go to the Southern District (flag 10, value 1), and this option must not have been clicked before (flag 25, value 0). If this option hás been clicked before, the player will get the option to simply go down the sewers without doing the dialog again.
"directions": {When you are at a location, you have the option to go north, east, south or west respectively. If the associated index is set to false, you can't go that way. If it is set to true, you can go that way. If you specify a flag, the specified flag id needs to have the specified value. If this condition is not met, the value of that direction will be treated as false, and the message will be shown on the screen.
"0": true,
"1": true,
"2": {
"flag": {
"0": {
"id": 16,
"value": 1,
"message": "A giant stockade blocks yours way into the southern district. You probably can't go this way without the guards stopping you anyway."
}
}
},
"3": true
}
In this case, flag id 16 always has value 1. This means the player will always see this message and cannot head south from the central district. If I wanted the player to be able to go south from this location, I would have to change the value of flag 16 to anything else.
That's all you have to do to create a working location, aside from the writing ofcourse. The game will automatically load in the new area file when saved and make it accessable to the player.
Sincerely Yours,
JV
No comments:
Post a Comment