Adding Interactivity
G3Engine uses a powerful visual scripting system based on node graphs. Build complex game logic without writing code by connecting visual nodes.Visual Scripting Fundamentals
Nodes are the building blocks of game logic. Each node represents an action, event, or data operation.
┌─────────────────────────┐
│ 🔀 Branch │ ← Header (category color + icon + name)
├─────────────────────────┤
│ ◼️ │ ◻️ │ ← Execution pins (white squares)
│ Condition │ True │ ← Data pins (colored circles)
│ │ False │
└─────────────────────────┘
↑ Inputs Outputs ↑
Building Your First Interactive Behavior
┌──────────────────────┐
│ ⌨️ On Key Press │
├──────────────────────┤
│ ◻️ │ exec-out
│ Key ● │ string (which key was pressed)
└──────────────────────┘
┌──────────────────────┐
│ ➡️ Move To │
├──────────────────────┤
│ ◼️ ◻️ │ exec in/out
│ Target ● │ object
│ Position ● │ vector
│ Speed ● │ float
│ Done ◻️ │ exec (when complete)
└──────────────────────┘
- Target: Select your cube from the dropdown
- Position: Set to
{x: 2, y: 0.5, z: 0} - Speed: Set to
1.0
Common Event Nodes
Event Begin Play
Fires once when the game starts.- Initialize game state
- Spawn starting objects
- Set up the scene
- Play background music
Event Tick
Fires every frame (60 times per second).- Continuous movement
- Rotation animations
- Check conditions every frame
- Update UI
On Key Press
Fires when a keyboard key is pressed."ArrowUp","ArrowDown","ArrowLeft","ArrowRight""w","a","s","d""Space"" Enter"
On Click
Fires when an object is clicked.- Clickable buttons
- Selecting objects
- Interactive objects
- Point-and-click navigation
On Collision
Fires when two objects collide.- Collecting items
- Taking damage
- Triggering events
- Bounce/physics reactions
Common Action Nodes
Move To
Move an object to a position over time.- Target: The object to move
- Position: Destination
- Speed: Movement speed (units per second)
Rotate
Rotate an object by degrees.Spawn Object
Create a new object in the scene.- Spawn enemies
- Create projectiles
- Drop items
- Particle effects
Destroy
Remove an object from the scene.- Remove collected items
- Destroy defeated enemies
- Clear temporary objects
Set Visible
Show or hide an object.- Hidden doors/passages
- Collectible indicators
- UI elements
- Secret areas
Play Sound
Play an audio clip.Logic and Flow Control
Branch (If/Else)
Conditional execution based on a boolean.- Add “Branch” node
- Connect condition to “Has Key” variable
- Connect True output to “Move To” (open door)
- Connect False output to “Print String” (“You need a key!”)
Sequence
Execute multiple actions in order.- Play sound
- Spawn particle effect
- Award points
Delay
Wait for a duration before continuing.- On trigger: Open door
- Delay 5 seconds
- Close door
For Loop
Repeat an action N times.- For Loop with Count = 10
- Loop Body → Spawn Enemy
- Use Index to offset position
Math and Variables
Get Position
Read an object’s current position.Add
Add two numbers.Compare
Compare two values.- Compare: A = score variable, B = 100
- Use A > B output in a Branch
- If true: Show victory screen
Random Float
Generate a random number.Complex Example: Collectible System
Tips for Visual Scripting
Keep It Organized
Arrange nodes left-to-right (events → logic → actions). Use the minimap to navigate large graphs.
Color Coding
Node headers are colored by category. Use this to quickly identify node types.
Test Incrementally
Test each node connection immediately. Don’t build large graphs without testing.
Use Sequence
When one event should trigger multiple actions, use Sequence instead of multiple connections.
Debugging Visual Scripts
Nothing happens when I press Play
Nothing happens when I press Play
Check that:
- Your Event node is present (Begin Play, Tick, Key Press, etc.)
- Execution connections (white lines) are complete
- Target objects are correctly assigned
- Objects are visible in the scene
Nodes won't connect
Nodes won't connect
Pin types must match:
- Exec (white square) only connects to exec
- Data pins connect to matching types (green to green, etc.)
- Some conversions are automatic (int to float)
Action happens too fast or too slow
Action happens too fast or too slow
- Check Delta Time usage in Tick events
- Adjust Speed parameters
- Use Delay nodes to pace actions
- Lower Rotate degrees for slower spinning
Can't find a node
Can't find a node
Use the search bar in the node palette. Node names are descriptive (“Move To”, “Play Sound”, etc.)
Advanced Patterns
State Machine
Use variables to track game state:Timer System
Health System
Next Steps
- Web3 Wallet Setup - Add blockchain features with Web3 nodes
- Publishing Games - Deploy your interactive game
- Creating Your First Game - Review the basics