There are many things still to improve, but you guys have been waiting for so long, I think it’s time to finally get GearBlocks into your hands! My planned Steam early access release date is November 9th. I’m also planning on entering the Steam Next Fest from October 9th to 16th, hopefully with a special tutorial demo.
Hi all, over the holiday period I decided to take some time out to try an experiment: attempt to add undo functionality to the game. Specifically, implement a command history, to which a command would be added for each tool action (e.g. select, move, or attach parts, apply material or paint, etc.) and then allow the player to undo or redo the commands in that history.
The game’s tools were not originally built with this in mind, but the code is reasonably well structured so I thought it might be possible. The initial prototype turned out to be promising, and showed the potential improvement to usability this would bring.
Well, I couldn’t resist seeing this through to completion, and so that’s what I’ve been working on for the past few weeks. It required substantial refactoring of some of the tool code, and took a while, but the results are well worth it I think.
Here it is in action, I’ve exposed the command history to Lua scripting, and made a script mod that shows the current list of commands:-
Rather than store an absolute snapshot every time something changes, the commands in the history store relative deltas. A command keeps a record of the change that was made by a tool action. This means implementation was kind of an “all or nothing” prospect: all tool actions must be accounted for the command history (in the right order!) for everything to work properly.
Here are the commands I ended up with, these are added to history when…
Select tool: …a tool is selected (some actions are only valid when the
correct tool is active, so this must go in the history).
Select parts: …any frozen parts are selected or deselected.
Select pivot: …a pivot point is selected, which detaches all the selected part(s).
Move / resize selection: …the selected part(s) are translated, rotated, or resized via manipulators.
Replace attachment: …an attachment’s type is changed.
Lock attachment: …an attachment is locked or unlocked.
Delete attachments: …attachments are deleted (whether directly, due to the
selection being detached, or due to a part being destroyed).
Spawn / destroy construction: …a part / construction is spawned or destroyed.
Freeze construction: …a construction is frozen or unfrozen.
Swap material: …a material is applied to a part.
Add / remove links: …link(s) between link nodes are added or removed.
Apply paint: …paint colour is applied to a part.
The command history has a buffer containing references to the added commands, in the order they were added. This allows for the commands to be undone in reverse order, and redone in forward order.
The history maintains an index of the last undone command, and if a new command is added, it will go into the buffer at this point. Any commands that came after the one most recently undone will be lost.
The buffer is a finite size (currently 256), if a command is added to history and it’s full, the oldest command is removed.
So, the game now has full undo / redo capability (using Ctrl + Z / Ctrl + Y). This is a feature that this genre of game really should have, and I think it was worth making the effort to get it done.
There are still a couple of issues left to deal with, but it’s now in a usable state, so I’ve just updated the demo to include it. A lot of code had to change, hopefully I haven’t introduced any glaring bugs, it seems stable so far. Give it a try and let me know how you get on with it!
Happy New Year everyone! I’ve just put out a minor demo update with a new selection menu, optimised intersection testing when aligning parts together, and several bug fixes.
This is a new menu that provides more ways to add and remove parts to / from the selection. It’s accessible by holding the Right Mouse Button, deletion has now been moved to Left Shift + RMB by default. Of course the key bindings can be changed (in the controls options menu) if you prefer.
With the selection menu you can:-
Toggle targeted part selected (shortcut key: Left Ctrl + LMB).
Select all parts in targeted construction, deselecting anything previously selected (shortcut key: Left Ctrl + A).
Add targeted construction to the selection, without deselecting anything.
Grow the selection, adds parts neighbouring those already selected (shortcut key: Left Ctrl + Up Arrow).
Shrink the selection, removes parts with unselected neighbours (shortcut key: Left Ctrl + Down Arrow).
Invert the selection, selects parts in targeted construction other than those already selected (shortcut key: Left Ctrl + I).
Deselect all parts (same as left clicking while not targeting anything).
An option to enable selecting both highlighted parts when targeting an attachment.
Destroy all selected parts.
I hope to expand this menu eventually to include things like: the ability to hide selected parts, save & recall selections, and filter selection by part type, material, paint colour etc.
OK, I’ve just released a minor update to the demo with a few small changes.
I changed part duplication to behave more like it did before the builder tool overhaul, so that you don’t have to hunt around for the duplicated part, and thereby hopefully speeding up the building process.
Now, holding Left Alt + LMB duplicates the targeted part. After which, releasing Left Alt (while still holding LMB) allows the duplicated part to be dragged away for repositioning.
I also fixed a couple of bugs relating to part selection and the move manipulator.