For Godot 4 - Godot 3 version here
HyperLog allows you to easily track node variables and information on screen.
It allows you to log and graph information while in the game, making debugging much easier.
First step is to download and install the addon either from here or from the Godot Asset library (we recommend using the version here).
After activating the addon in Godot, you will be able to use HyperLog via the HyperLog global.
To use HyperLog in 3D or on Spatial nodes you need to set the camera_3d variable on HyperLog:
HyperLog.camera_3d = $CameraIf you don't do that, all logs will be displayed on the top-left corner.
Inside the project, you will find example scenes how HyperLog is used in 2D and 3D. We highly recommend checking them out.
We have a Scene called Player_Ship with the following variables in its script:
extends KinematicBody2D
var position = Vector2(10.241, 282.2035)
var direction = Vector2(-1, 0)
var angle = 1.570796
var health_current = 8
var health_max = 12
var speed = 0.0
onready var ship = self
func _ready():
...To use HyperLog to track any of these variables (or properties from the class), add these snippets to your _ready function.
You do not have to add it to _process or _physics_process or update it in any other way, the changes of the variables are tracked automatically by HyperLog.
Displays the text:
position:x 10next to theshipnode.
HyperLog.log(ship).text("position:x>round")Displays the text:
direction 3.141593.
HyperLog.log(ship).text("direction>angle")Displays the text:
position (10.24, 282.20)next toself(in our example, the ship).
HyperLog.log(self).text("position>%0.2f")Logs the rotation of the ship's
gunto the log-panel of the ship.
HyperLog.log(ship).color("modulate")Draws a line chart graph out the x and y
positionof the ship.
HyperLog.log(ship).graph("position")Draws a line chart graph out of
speed, rounds it to one decimal and updates it every second frame.
HyperLog.log(ship).graph("speed>%0.1f").set_steps(2)Draws a line chart graph out the
health, usinghealth_maxas the maximum value of the line-chart.
HyperLog.log(ship).graph("health_current").set_range(0, health_max)Draws an angle-log, a visual angle indicator.
HyperLog.log(ship).angle(["direction", "angle"])Draws an angle-log of the
rotationof the ship'sgunto the log-panel of theship.
HyperLog.log(ship).angle("rotation", ship.get_node("gun"))Adds an offset of (200, -20) to the panel.
HyperLog.log(ship).offset(Vector2(200, -20))Will align the panel to the right horizontally and to the center vertically.
HyperLog.log(ship).align(HALIGN_RIGHT, VALIGN_CENTER)Will display a health line-chart graph above the ship.
HyperLog.log(ship).align(HALIGN_CENTER, VALIGN_BOTTOM).offset(Vector2(0, - 50)).graph("health_current").set_range(0, health_max)Alternatively you can log to the main panel by accessing the functions directly from HyperLog:
HyperLog.graph("position", ship)There are some drawing tools that you can use for additional debugging.
You can call those from anywhere to draw visual debugging elements.
For example calling HyperLog.sketch_arrow(position, direction, 1) will draw an arrow on position, direction for one second.
These draw tools behave differently from the normal HyperLog logging and will not automatically update!
You can use them in _process or on certain functions in your game (e.g. display the direction of your projectile when shooting via HyperLog.sketch_line.
It's best to check out the provided example scenes or the code in the plugin to get a better understanding of those draw tools.
Draw a line from
fromtotofordurationseconds.
HyperLog.sketch_line(from:Vector2, to:Vector2, duration:float = 0, color:Color = Color.tomato)Draw an arrow at
position, pointing tovectorfordurationseconds.
HyperLog.sketch_arrow(position:Vector2, vector:Vector2, duration:float = 0, color:Color = Color.tomato)Draw a circle at
positionwith the radiusradiusfordurationseconds.
HyperLog.sketch_circle(position:Vector2, radius:float, duration:float = 0, color:Color = Color.tomato)Draw a box at
positionwith the dimensionssizefordurationseconds.
HyperLog.sketch_box(position:Vector2, size:Vector2, duration:float = 0, color:Color = Color.tomato)Draw a Rect2 with the data from
rectfordurationseconds.
HyperLog.sketch_rect(rect:Rect2, duration:float = 0, color:Color = Color.tomato)