AI Dev Blog: An Exclusive Look into the Buildbox 4 AI Workflow

By April 4, 2024Buildbox

Welcome to the AI Dev Blog! In this post, we will be exploring the AI workflow for Buildbox 4. Buildbox 4 is capable of accomplishing impressive tasks, including scene and asset generation, as well as applying cool effects like fog or particles in your game with just a simple prompt. These capabilities are made possible through our AI workflow and the classifiers we employ. 

An AI workflow involves gathering data, training the AI model, and using it to make predictions or decisions based on what it has learned. By using specific classifiers in our AI workflow, we can train the AI to recognize and understand different actions to help you build your game. 

Once the AI model is trained, it can execute prompt-initiated actions and generate the required code (aka. AI code generation).

AI Workflow & Classifiers in Buildbox 4

In the AI Workflow, we have two top level trained classifiers that understand what the user wants to do in the game. 

The first classifier has three classes:

  • GAME: “Understands that user wants to generate a scene, so it trigger its own scene generation AI and also skybox and ground generations”
  • EDIT: The first classifier understands the user wants to edit a game, so we trigger the second classifier
  • OTHER: To understand if the user types anything that is not related to game development or asks for any sensitive information. For example: “What time is it”, “Create a python function that ….”, “How can I create a bomb?”

The second classifier has the following classes:

  • BEHAVIOR(Game Logic): If AI understands that the user wants to edit game logic by generating code or assembling nodes. 
    • Ex: Make the enemies jump randomly
  • ADD: If the user wants to add something in the game without specifying a pattern. 
    • Ex: Add a car
  • PLACE: If the user wants to add something in the game by specifying a pattern. Here we use a combination of AI+Procedural Generation. 
    • Ex: Stack 5 cars.
  • REMOVE: If use wants to remove something from the game 
    • Ex: Remove the cats
  • UPDATE: If the user wants to edit (Move, Resize or Rotate) something in the game: 
    • Ex: Rotate all buildings 50 degrees.
  • SPECIAL EFFECTS: If user wants to apply a specific type of particle 
    • Ex: Make it rain
    • Ex:  Add fog
  • Skybox: Apply skybox 
    • Ex: I want to have a dark night sky
  • Ground: Apply ground 
    • Ex: Please give me a Lava ground

The Code Generation Process 

Now let’s dive a little deeper into how the AI code generation actually works in Buildbox 4. The first step that takes place is the AI classifies the user’s prompt to understand if they want to edit the logic of an asset. If they aren’t, we redirect them to the ‘Other’ workflow. If they are, we continue. You can view an example of this process in the flowchart below. 

Our AI analyzes how to integrate what the user wants to the existing asset logic.

As there’s already a “Jump” node with jumping logic, our AI modifies it to add the new behavior. 

Our AI analyzes how to integrate the user’s desired changes into the existing asset logic, as depicted below.

If there’s no node related to it, our AI creates a new node for the logic.

For complex user prompts, our AI divides the prompt into different logical components, and it creates a node for each of them. In this example, our AI edited the already existing “Follow Player” node to add the functionality of following the player only when it gets close. On the other hand, as there’s no “Damage” node, and it doesn’t make sense to include that logic into the existing nodes, our AI creates a new node to store the damage logic.

The result will be different components created with Custom Attributes so that you are able to fine tune the details of their game without touching one line of code. In this case, the AI created the attribute “Jump Force”, so that you can edit that property. If you want to keep editing the existing logic, you can do it with a prompt. For example: “I want it to be able to perform only a double jump” should edit the “Jump” node and add a property like “Max Jumps” with the value 2, making sure that it only can perform a double jump, but allowing you to edit this if you change your mind in the future.

With the AI generating the code for you, there’s no need to write a single line yourself. Buildbox 4 is changing the game by showcasing the power of AI in game development.

Tiana Crump

About Tiana Crump

Tiana Crump is a journalist and social media manager at Buildbox with a passion for inspiring others and driving brand awareness. As a gamer and creator, she enjoys sharing game development insights, tips, and success stories from the Buildbox community.