M
M
MaxYenot2020-09-16 20:55:06
JavaScript
MaxYenot, 2020-09-16 20:55:06

How are these text games written? Game logic?

Hello. Thinking about how to write a detailed game. Needed for educational purposes, not going to promote. The main thing is the working mechanism. It is even possible for the game to throw out replicas to the console, and the options had to be entered through prompt ().
Of the programming languages, I know .js best. I
understand what constructor functions are in .js, what is json. But I do not understand how to make the logic of this game.

What is the essence:
The game is very similar to a book, to some kind of story. But, from time to time, there is an opportunity to make a choice. And this choice can affect the further plot.
For some options, you can get a plus for observation. A sufficient number of points of observation, in the future, can help make some kind of choice without spending diamonds (another game currency). Also, the player has a reputation that improves or worsens depending on the decisions he makes. And, probably, there is a player's rating in the eyes of other characters in the game. For example, if in a game, while talking with a girl, you constantly choose options that will offend her, then later she may end up dancing with you, or taking a walk.

Maybe there is some book / manual on how to create such games? Not necessarily in .js. It could be another language, or even pseudocode. The main thing is that I understand the algorithm of the game, see its "architecture" (so to speak).

PS game from play market. Stories your choice. Maybe it will be easier for someone to navigate by name.
5f624d52ca891093615332.jpeg5f624d6b908b0285758596.jpeg

Answer the question

In order to leave comments, you need to log in

6 answer(s)
G
Griboks, 2020-09-16
@Griboks

This is a visual novel. There are many ready-made engines and libraries. But, in principle, the logic of the game depends solely on you. You can write your game however you like.

N
Nikita Mikhailov, 2020-09-16
@Psixodelik

For some options, you can get a plus for observation. A sufficient number of points of observation, in the future, can help make some kind of choice without spending diamonds (another game currency).

Well, here's the algorithm for you. You store the value separately and, when issuing options, you check whether the value of the parameter has reached a certain limit.
For example, if in a game, while talking with a girl, you constantly choose options that will offend her, then later she may end up dancing with you, or taking a walk.

There is a character, this character has a relationship parameter with GG. Branches are built from this.
I don't recommend jumping into this right away. Start simple: a story, with one fork. Depending on the answer, show one or another branch of the story. Learn it first. Then introduce gradually the characteristics of the GG. Only then start thinking about other characters

R
Ruslan., 2020-09-16
@LaRN

Here's a similar question.
https://qna.habr.com/answer?answer_id=975360#comme...

K
Konstantin Kitmanov, 2020-09-16
@k12th

This genre is called "visual novels" or "interactive literature" (if there are almost no pictures).
The most famous visual novel engine is Ren'Py .

K
Kirill Makarov, 2020-09-17
@kirbi1996

In general, I played it for a long time, in fact there should be an event tree, and different scenarios. As an option, events can be stored just the same in the object, but the answer should change your coefficient of influence. Well, functions to handle all this. In fact, for the first project a difficult task. It will be easier to create a branch in which there is no influence factor, but simply a sequential action depending on the answer

H
HellWalk, 2020-09-17
@HellWalk

Maybe there is some book / manual on how to create such games?

Learn to program - you will be able to make such novels without any problems (from graphics, as I understand, there are only static pictures)
You can, of course, take a simpler and faster path - using other people's engines and libraries, but they often impose a number of restrictions. But in order to realize exactly your ideas (especially if they are tied to unique game mechanics), and not depend on anything, it’s better to make your own, from scratch.
At the same time, there will be good practice in programming.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question