Guide to Visual Scripting in Tempest AI
Introduction to Visual Scripting
Visual scripting in Tempest AI allows users to create complex game logic and behaviors without writing a single line of code. By using an intuitive drag-and-drop interface, users can connect various blocks to form chains of actions, making game development more accessible, especially for beginners. Lets get started
Overview of Visual Scripting
Visual scripting organizes game logic into chains of actions. Each chain begins with a "Game Chain" block, which acts as the head of the chain. These game chains are categorized by primary asset types, such as characters, items, or locations, and they help manage different aspects of the game.
Using Visual Scripting
Navigating The Interface
Game Chains
Located at the bottom of the screen, these blocks represent the starting points of your script chains. Each game chain is tied to a primary asset type.
Block Library
On the left side, you'll find the block library organized by categories like AssetManager and CharacterManager. These blocks perform various actions and functions within your scripts.
Cached Arguments
Located above the game chains, these are bit of data saved and available to use as arguments for blocks
Game Flow Board
This is where you drag and drop all your logic onto
Creating a script
Drag and Drop
To create a script, simply drag blocks from the library into the workspace. Connect these blocks by linking their input and output nodes to form a chain of actions.
Organizing Chains
Each chain starts with a game chain block. For example, a "Character_Found" game chain might include blocks for generating dialogue, updating character stats, and managing inventory items.
Game Chain Blocks and Iteration
Each game chain starts with a mode head block. The mode head has a class, such as character, location, or item. This class determines how many times the chain will repeat based on the instances present in the scene. For example:
- Location Chains: Execute once, as there is typically one location per scene.
- Character Chains: Execute multiple times, once for each character in the scene.
Additionally, you can add a dynamic variable with assets, and it will iterate over all the primary assets in that list, allowing for flexible and dynamic game logic.
Integrating with Other Systems
Visual scripting in Tempest AI seamlessly integrates with other systems like asset management, character management, and narrative generation. This integration ensures that your scripts can interact with various game elements, enhancing the complexity and interactivity of your games.
- Asset Management: Use blocks from the AssetManager category to add, update, or retrieve game assets dynamically.
- Character Management: Incorporate blocks from the CharacterManager to create, initialize, and manipulate character objects within your scripts.
- Narrative Generation: Combine visual scripting with the NarrativeManager to generate and manage in-game events
Using Dynamic Variables
When you click on a visual element, a toolbar pops up with a list of variables, including returns from previous block elements and persistent cached elements, labelled with the tag [c] . You can drag these variables into fields to add them as dynamic attributes to each function.
Using Nested Returns
Nested returns allow you to perform more complex operations by running functions within other functions. This capability lets you create dynamic and conditional behaviors based on multiple inputs and their interactions.
What are Nested Returns?
Nested returns are a way to use the output of one function as an argument in another function. This can be particularly useful when you need to combine multiple data sources or perform sequential operations within your visual scripting flow.
This is how you write nested returns as an attribute of a block
[nf] {'type': 'nested_function', 'asset_id': 'ui_manager', 'name': 'get_model_data', 'value': [{'type': 'static', 'value': 'character'}, 'calculateCharacterProbability_return', {'type': 'static', 'value': 'name'}]}
Here’s what each part means:
- [nf]: Indicates that this is a nested function.
- 'type': 'nested_function': Specifies that the block is using a nested function.
- 'asset_id': 'ui_manager': Identifies the asset or manager that contains the function.
- 'name': 'get_model_data': The name of the function to be called.
- 'value': []: An array of values or parameters to be passed to the function.
Static Variables
In Tempest AI visual scripting, static variables are values that you input directly into a block without any special tags or references. These values remain constant and do not change during the execution of the script. Static variables are useful for setting fixed parameters that do not depend on other dynamic elements or previous function outputs.
How to Use Static Variables
When you input a value into a block without any tags, it is automatically treated as a static variable. This means the exact value you typed in will be used as a parameter in the operation.
Example of Static Variable
In this example, we are using the "Construct Message" block to create a message with static values for various parameters:
component_type: mode-prompts
The type of message component being constructed. Here, the static value "mode-prompt" is used.
data_1: Talk to Character
The first data parameter, set to the static value "Talk to Character". This value will be used as part of the message content.
data_2: DIALOGUE
The second data parameter, set to the static value "DIALOGUE". This value defines the dialogue mode for the message.
Mechanic Objects:
Mechanic objects are located above the game flow dashboard. Here, you can define generic objects like values, collections, and more. Creating a mechanic object will unlock corresponding blocks in the block library.
- Defining Mechanic Objects: Access the mechanic objects area and create new elements, such as values or collections.
- Unlocking Blocks: Once created, these objects will appear as blocks in the block library.
- Using Mechanic Objects: When you drag a mechanic object block into the flow graph, you need to drag and drop the actual mechanic object into the block as the primary object.
What You Can Create
Visual scripting opens up endless possibilities for game creation. Here are a few examples of what you can achieve:
- Dynamic Quests: Create quests that adapt based on player actions and decisions.
- Player Inventory and Item Management Systems: Keep track of items and manage player inventory dynamically.
- Complex AI Behaviors: Develop AI characters with intricate behaviors and decision-making capabilities.
- Custom Game Events: Design events that trigger based on specific conditions or player achievements.
This guide provides an introduction and basic understanding of visual scripting in Tempest AI. For detailed block descriptions, advanced features, and troubleshooting, refer to the corresponding sections in the guide. Happy scripting!