DEVLOG 5: Система World State

WILD

Administrator
Staff member
ADMIN
SELLER
SUPREME
MEMBER
Joined
Jan 21, 2025
Messages
219
Reaction score
633
Deposit
0$
Hello everyone!Today we're talking about the world state system—it allows for variability, remembering player decisions, and creating lines/responses based on flags.I was a bit surprised to learn about this system—in games, we usually see various systems with which the player interacts: various choice options, skill sets and bonuses, skill trees, or complex NPC behavior. However, it turns out that almost all games have a world state system. However, it's implicit, existing only in the game logic.If you approach an NPC, you'll only unlock certain lines after a certain check, after saying a line, meeting someone else, or discovering new information. You want to make the game reactive to the player's actions.How I did it:I created a dynamic structure—WorldStateMap—that can add new values.Initially, it's completely empty, and the more you play the game, the more it fills with values the game can use.To access the structure, each NPC line and each player response has three fields (they are added in Articy templates, and then my converter script processes them):bRecordToWS — If checked, the line should record a flag.WSFlagName — The flag name. (Example: SETBOOL(met_person).)NodeVisibilityCondition — Visibility conditions. (Example: GETBOOL(met_person).) Each node is checked. If the conditions return FALSE, the node is not shown.The actual cycle of writing and retrieving data from the WS:SETBOOL(met_person) --> Writing to WS --> GETBOOL(met_person) --> true/falseWhen writing to the WS, a simple parser parses the text into arguments and sends the values to the command selection: (SCREEN_1)SETBOOLGETBOOLSETINTGETINTHAS_VISITED is a special field that allows you to dim already read replies. (SCREEN_2)ADD_VISITED is another field that adds all read replies to the list.
DD_VISITED — ещё одно поле, которое записывает в список все прочитанные реплики.

СКРИН_1
 
Top Bottom