New this build: debugger breakpoints! This is an initial release, and it doesn't yet support everything we want it to, but hopefully we will be adding more support over the next few releases.
Debugger breakpoints
Breakpoints allow you to mark an event, condition or action. Then when you run in the debugger, when it reaches that event, condition or action, it will pause and highlight it in the editor. This allows you to then browse the state of the game in the debugger at a specific moment in the events. You can even then step through your entire event sheet, going through events, conditions and actions one by one, watching the state of variables and seeing how everything changes. It should be extremely helpful for identifying why some events are not doing what you want them to.
Here's how it works: press F3 or use the ribbon or right-click menu Toggle Breakpoint options to set a breakpoint. Below a breakpoint is set on an event block, meaning it will pause just before it runs the block (so before any conditions have been tested or any actions run). Currently it is marked with a red square, but we'll have a nicer icon soon!
Then we run the debugger. When the event is reached, the game pauses. The debugger says Hit breakpoint: Game events, event 35, and the editor highlights the event to show it's about to be executed:
We can use the rest of the debugger to view, watch, or edit variables - in exactly the state they are just before the particular highlighted event is run. Pressing Continue in the debugger will resume the game, until the breakpoint is hit again.
Breakpoints can also be set on individual conditions or actions. Here a breakpoint has been set on the Destroy action:
Now the debugger breaks just before that action runs. This means all the conditions must have tested as true before the debugger pauses on the action. So the game keeps running, and then when an enemy's health reaches 0, it pauses and highlights the action:
Again we can inspect or change things from the debugger before continuing. We can also hit the Next button (or press F10) to step to the next action, condition or event:
Now the Destroy action has been run - and the object disappears in the preview window. By repeatedly pressing Next (or F10) you can advance all the way through the event sheet, event by event, condition by condition, action by action, with a real-time view of everything in the debug inspector, and seeing the display of the game update after each step as well. You can even set and remove more breakpoints during preview, or while paused on a breakpoint!
Breakpoint limitations
Due to the complexity of this feature, it has a couple of limitations at first. We will do our best to resolve this in future releases, but for now:
- You cannot set breakpoints anywhere inside a triggered event. This includes any sub-events to triggers.
- You cannot set breakpoints anywhere inside a looping event (with looping conditions like Repeat or For Each). This includes any sub-events to looping events.
We're aware these are fairly serious limitations. However it is quite difficult to support these, and since our policy is to release early and often, we thought it would be best not to delay any longer and ship a beta where you can at least debug ordinary non-triggered non-looping events.
Due to the architecture of Javascript, modern browser technology, and the fact we allow third party plugins using an SDK, it may be difficult to ever support breakpoints in triggers. We're aware many users have projects that make heavy use of functions, so we will do our best to at least support breakpoints in function calls. Hopefully we'll be able to add support for breakpoints in looping events in an update in the near future.
In the mean time happy debugging, and please be sure to report any issues you encounter to our Bugs forum!