DevLog Episode 2 is out!

In this episode I make the first prototype for the game. There's not much spectacular stuff going on here, mostly you can see how I've started to work with Godot in earnest. But I've already laid the foundations for the main mechanics of the game here.

Link

2023-09-15 16:44:41
Pathfinding tutorial

In this video I show you how to create pathfinding navigation in Godot 4 using NavigationAgent. In the video you will see the 2d navigation, but the 3d version is almost the same, except that you have to take the third dimension into account.

Link

2023-08-23 17:47:45
DevLog Episode 1 is out!

This episode covers the start of the project and basic NPC navigation. Check it out on the Devlog page or on our youtube channel!

Link

2023-08-04 15:57:33
Script breaking

Script - An intensely controlled sequence of behaviours where participants move from the starting point to the end point in a predefined way.

If you look at the video game market today, there are very few games that do not use scripts or scripted scenes at all. Story-driven games tend to use a lot of scripting to achieve the desired impact. Take Detroit: Become Human, for example, or any of Quantic Dream's similar games, which contain so many scripts that they are almost more like interactive films than games. Or there's the legendary character in Resident Evil 2 Remake, Mr. X. Although he largely moves around the map in dynamic pursuit of the player, he's also controlled by a script, for example, in his first appearance, when he pushes the helicopter aside, or when he rushes out of the meeting room through the wall.

The NPCs of Enslaved: The Awakening are driven by two big algorithms, RUTIN and SCRIPT. RUTIN is responsible for dividing the NPCs' time into days, like in real life, sending them to work, sleep, hang out. This is considered the "default state" as it will continue to run indefinitely if not interrupted. This is where SCRIPT comes in, responsible for exceptional situations.
The relationship between the two algorithms can best be illustrated by the water in a lake. If there is no external influence, the water in the pond is still, that's RUTIN. But if a stone is thrown into the pond, i.e. an unexpected event occurs, the water in the pond will ripple until it returns to its normal, peaceful state. This is SCRIPT.

Currently, both algorithms are based on a behaviour tree that controls most of the internal devices of the NPCs. In this tree there is either a SCRIPT branch, which is empty by default. Scripts are saved as separate branches, which are given to each participant before the script is started, so that each participant only owns the scripts it needs.
To start a script, you must first define its actors. More precisely, each NPC that owns the script must assume a role, based on which the script will decide which branch to traverse. Each participant will see the branches of all the actors in the script, which is necessary to be able to switch roles even during the script. These roles can be assigned at the start of the script, or actors can assign roles to each other.
The result of this division is that the script is present in the program as many times as its actors are present at the same time, because they are technically independent of each other, they just communicate with signals to advance each other's processes.
When the NPC has reached the end of the script, the last step is the "leave_script" command, which returns it to the RUTIN.

However, it is not enough that RUTIN can be broken by a script, sometimes it is also necessary that a script is broken by another script. Take for example the tutorial level of The First One. The three human NPCs are controlled by a long script all along, telling them when to go where, what to say. But one of them might see the player in the process. You need a mechanism to chase the player, and then, having lost track of him, to pick up the original script where you left off. This is Script Break.

Break

Okay, that catchy name actually covers four algorithms, break, add subscript, reset position and continue.
The process is opened by Break, which disables the basic script's behavior tree and saves its required external values. It also stops the dialog immediately and stops the motion of the character.

Add subscript


Creates a new behaviour tree and inserts the desired subscript into it. It then gives this behavior tree as a child to the character and starts the script it contains. Thus the character has two behavior trees at subscript time, whose internal data do not overwrite each other.

Reset position


If the subscript has done its job and we want to return to the original script, we first need to reset the conditions before the break. Since the original script does not know that it has been stopped and replaced by another script, it cannot correct itself. For example, if you revert to the original script after a chase, the NPCs will continue talking 30 meters away from each other, which creates some pretty funny moments.
This is why we need to reset the position of the characters, among other things. When the function is run, it first disconnects from the character and deletes the subscript that was running, then creates a new subscript to navigate back to the coordinate that was saved when the break started.
To know when the character has reached its destination, the navigation component temporarily connects the signal indicating this to the is_ready_to_continue function, which, when executed, removes the current subscript and calls the script_continue function.

Continue


Essentially the reverse of Break, it restores the saved values and starts the original behavior tree. This will cause the script to continue at the exact step where it was stopped.

After that, there's nothing left to do but to hook the first and last elements of this chain to the vision, so that the start is triggered when a character sees the player, and the reset starts when the player leaves its sight.

 

2023-07-24 16:18:46
Our Website is ready!
On this website you can follow the progress of the project. We will post our progress here, in smaller steps and in more detail than on our YouTube channel.
2023-07-19 18:20:38