📜 ⬆️ ⬇️

Lovers of text quests. Constructor.

December 31, I proposed the idea of ​​creating a site on which any user can create and place their own text quest. Then there was a rather prolonged new year, and here I am again in the ranks.

In this topic, I want to share with you my thoughts on the constructor of quests - the most important element of the project. I would like to hear both your comments on the planned functionality, and on the architecture as a whole.


')
For the main structural element, I decided to take the location. The location will be described by name, description and picture. You can move between locations. The following elements can be placed on the location:

1. Action
Which will be represented as a text link (with an icon?) And will lead to the execution of the next element - the event. Actions can be of several standard types - as long as it only occurred to me to take / give away a thing, or simply to display an event.

2. Event
The result of the action. The event is also described by name, description and picture. For each event, you can bind an unlimited number of actions that are displayed in the list when the event is loaded. Example - when switching to a location, the default action is loaded - the index which causes an event that displays the location description.

3. NPC
Game character. Described again by name, description and picture. When you click on a character link in a location, a window opens with available dialogs. Dialogues, by the way, are made in a separate module of the constructor and represent the same actions and events, only presented in a slightly different form.

Also, when creating a dialogue, it will be possible to indicate what things are needed to continue one of its branches or to get another thing (exchange).

Items (Item)

I have already mentioned the possibility of receiving / returning things. In my opinion, this greatly expands the possibilities of text quests. Who played quests like “Petka and Vasily Ivanovich”, he thinks, he remembers the eternal problem “who needs to give a candelabrum to get a condom, which later needs to be used to go to a confidant who owns important information”. It was interesting after all?

In a good way, an array with the player's items must be stored in the cache according to the key associated with the user id - but for such a case, at least vps should be taken. We will launch the project by March and we will take a server for it - but don’t we wait until March? Therefore, I think that you can start by storing an array of things in a session.

Saving the results of conversations and actions

First, an example. I was “rude” to the NPC and he refuses to give me a key-item. If you do not save the result of the dialogue, it will be possible to go through it anew everything rests stupidly in a bust options. And so the result of the dialogue will be preserved in the same session, and if the authors do not provide for other scenarios, the quest is overwhelmed. Above this moment it is worth still to think, because with illiterate use in quests, dead ends will appear.

I think this functionality to start enough with a vengeance. Then you can add more interesting things. I have already planned to spend more than a few days.

Source: https://habr.com/ru/post/48360/


All Articles