Bug Fixing with Blocks

Yesterday I was testing out blocks (sub-circuits) and getting really confused over what was causing some bugs so decided to leave it until today.

It’s good to take a break when you are stuck.

So, today I started by creating simple circuit examples and turning them into blocks and playing with them. This was a great way to fully understand what was going on and to fix the bugs.

The problems that I identified:

  • Connections coming into a block have an external port number to a pin, but the pin output is on port zero internally
  • Connections going out from a block need to know what external port they connect to

The first problem was a simple fix to simply set the port number to zero when initially calling the internal level/value propagation logic.

The second problem was solved by setting a data value on each IO node specifying its external port number at the time of compiling the block.

Then I continued testing encapsulating the various parts such as ALU as a block and testing the circuit with input pins surrounding the block against its truth table.

I came up with an efficient procedure to set up these test circuits which I should explain in a manual at some stage.

Common way to alert about unsaved changes

After thinking about warning players about having unsaved changes I implemented a Yes/No popup window which replaced the standard Confirm Dialog. This was used for when quitting the game and for when going to wipe the scene or load another circuit before saving changes. This provided a consistent and nice interface that actually pops up the save dialog depending on the choice of the user.

Now this could be a great topic for a tutorial.


Massive progress today. But I haven’t thought much about implementing nested sub-circuits. Maybe it will be unnecessary or impractical? Have to see.

Comments Forum

More Devlog entries

Most recent first