New Game: Circuit Puzzle

Use this forum to share and discuss Uzebox games and demos.
CunningFellow
Posts: 1254
Joined: Mon Feb 11, 2013 8:08 am
Location: Brisbane, Australia

Re: New Game: Circuit Puzzle

Post by CunningFellow » Sat Aug 08, 2020 7:08 am

Nice work. Obviously I saw a lot if it during development, but still congrats are in order for getting across the line and finishing it.

It is an outstandingly polished game in terms of UI and general feel.

User avatar
Artcfox
Posts: 1060
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: New Game: Circuit Puzzle

Post by Artcfox » Sat Aug 08, 2020 2:37 pm

CunningFellow wrote:
Sat Aug 08, 2020 7:08 am
Nice work. Obviously I saw a lot if it during development, but still congrats are in order for getting across the line and finishing it.

It is an outstandingly polished game in terms of UI and general feel.
Thank You! :D

The last 10% took so long to finish, which is why I tried to polish the UI as much as I could in the beginning. Also, writing up a design document before I allowed myself to touch the compiler helped me focus on the big picture, and see what the completed game would look like in my head before I got myself lost in the details of the implementation. Thanks for all your help and motivation.

User avatar
L4rry
Posts: 242
Joined: Sun Dec 28, 2014 7:19 am
Location: Cape Town, South Africa

Re: New Game: Circuit Puzzle

Post by L4rry » Sun Aug 09, 2020 10:13 am

Congrats on your new game Artcfox! I'm 10 circuits in and it's very addictive. Looking forward to tackling the rest. I want to echo how polished the experience is. The attention to detail shines through. Game controls, UI (dig the custom font), music, sound, everything. Haven't come across any bugs either. Well done. Definitely a standout game in the Uzebox library. I can't really make any suggestions for improvement, apart from considering a demo mode that will solve a puzzle or two. This should also compliment the tutorial nicely. It really is a treat to see a new Uzebox game.

User avatar
Artcfox
Posts: 1060
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: New Game: Circuit Puzzle

Post by Artcfox » Sun Aug 09, 2020 1:27 pm

Thanks L4rry! That is awesome to hear. :D

I thought about a demo mode, but didn't want to give any solutions away, especially since the beginner ones are so important to kids just learning about circuits. When one of my kids sees the other solve one of the puzzles they will just blindly copy the other on their turn rather than stop and think critically about it. I used level 55 as my "worst case stress test" during development when the solver ran every frame no matter what, and now I can't unremember its solution to solve it naturally. The font is based on the one from the arcade game KiKi KaiKai, but customised by me to remove all of the "samurai flair" and thin diagonals from each letter, while keeping the brushstroke style I had been after (to match the brushstroke style I came up with for the X and checkmark).

I have almost beaten the game, but I am still stuck on levels 52 and 60. They have been play-tested with the correct solution, but I can't arrive at the correct solutions myself without peeking at the solution card to see where a couple of the key pieces need to go. I wonder who will be the first to complete all the levels and unlock the epic win?

User avatar
Jubatian
Posts: 1499
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: New Game: Circuit Puzzle

Post by Jubatian » Sun Aug 09, 2020 3:18 pm

Huh, Level 31 actually has at least 3 solutions... Game of course correctly identifies all them! :)

EDIT: One thing occurred to me though. Could it be possible to implement a swap when you drop a tile down to an occupied slot? (That is, then the tile on the slot would be picked up if it is possible to be picked up, and the one you were carrying would be dropped in its place) Likely has complications as now the tile unless you drop it to an open slot to receive it, would return to its old location (which in case of a swap would be occupied).

User avatar
Artcfox
Posts: 1060
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: New Game: Circuit Puzzle

Post by Artcfox » Sun Aug 09, 2020 5:25 pm

Jubatian wrote:
Sun Aug 09, 2020 3:18 pm
Huh, Level 31 actually has at least 3 solutions... Game of course correctly identifies all them! :)
Sweet! I will have to find this elusive 3rd solution.

One of the circuits (I think it might have been 34) made me realize that I needed to indicate both when there was a short circuit, and when the rules have been met, because during development before I added those, by all other indications I was sure I had solved the puzzle, but when I checked it against the solution card it was completely different! It turned out that my proposed solution contained a non-obvious short circuit that only occurred when the switch was in a position where all the LEDs were supposed to be off, and when I re-read the rule book it was clear that a solution can't contain a short circuit.
Jubatian wrote:
Sun Aug 09, 2020 3:18 pm
EDIT: One thing occurred to me though. Could it be possible to implement a swap when you drop a tile down to an occupied slot? (That is, then the tile on the slot would be picked up if it is possible to be picked up, and the one you were carrying would be dropped in its place) Likely has complications as now the tile unless you drop it to an open slot to receive it, would return to its old location (which in case of a swap would be occupied).
I put a lot of thought into that. It might be possible, the old location wouldn't be an issue, as the original old-location would remain the new old-location post swap. To complete the swap, you would lift A to drop, and then you wouldn't be holding down any buttons, but you would have a piece picked up (the swapped piece). You would have to press A then release it again to drop the swapped piece you are holding. Which may not be a problem, as you can simulate this with cuzebox right now by picking up a piece with the cursor, then pressing the Windows button on your keyboard to trigger a zoomed out view of the GNOME desktop. It steals the focus from cuzebox, and you can release the A button while the focus is stolen, and then if you go back to cuzebox, you are now holding no buttons, with a piece picked up. Pressing and releasing A does release it as expected, so I think the logic here is actually fine and wouldn't need to change. But for the popup menu to appear, I require that when you press START that no other buttons are being held at the same time (to ensure that you don't have a piece currently "picked up" because I steal all of the RAM tiles to draw the popup menu). If you perform a swap, but don't place the swapped piece down, that assumption would be violated and you could activate the popup menu with a piece picked up. That might actually be okay too, as I steal the RAM tiles from the locked/rotate overlay sprites that I place on the initial pieces (which is why they vanish when the popup menu is shown, and come back just fine when dismissed) and I could probably also steal the ram tiles from a picked up piece, but that too would vanish when the popup menu was active.

What stopped me was that the top and left edges of each of the 3x3 tokens have their pixels set to the color of the breadboard, and in order to indicate that an occupied piece is a drop (swap) target I would want to change those pixels to the salmon color. Clearly I am up against the ROM tile limit, and with a max of 8 (aligned) overlay sprites for the initial pieces on the board, and 3 RAM tiles used to display the circuit number and the difficulty color, and 16 RAM tiles used because you have a 3x3 (unaligned) mega-sprite picked up with the cursor, I do not have 5 RAM tiles to spare to indicate that an occupied board position is a swap target, and I didn't want to break consistency.

Maybe the swap target can be indicated normally (using sprite overlays) for some levels, and then on the levels where I ran out of sprites (RAM tiles), use a sprite-flickering technique just for those 5 mostly-transparent sprites used to indicate a swap target, but at what cost? Technically it may be possible to add that feature, but I weighed it against all of the added complications it would bring, and the increased risk of introducing bugs, and compromises that I don't like (sprite-flickering).
Last edited by Artcfox on Mon Aug 10, 2020 2:02 am, edited 2 times in total.

User avatar
Jubatian
Posts: 1499
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: New Game: Circuit Puzzle

Post by Jubatian » Sun Aug 09, 2020 7:21 pm

Done! Completed all the levels, had seen the success screen! You had quite some ROM left to store those frames! :) (The images probably take up some 2-3 Kbytes I guess unless it is something like 4bpp extracted into RAM tiles)

I think it could be okay if the tile was dropped when bringing up the menu, I would probably even expect it to happen as carrying a tile is a transitory (no pun intended) action. But I certainly see there is some extra logic involved for such a function.

User avatar
Artcfox
Posts: 1060
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: New Game: Circuit Puzzle

Post by Artcfox » Sun Aug 09, 2020 8:44 pm

Jubatian wrote:
Sun Aug 09, 2020 7:21 pm
Done! Completed all the levels, had seen the success screen! You had quite some ROM left to store those frames! :) (The images probably take up some 2-3 Kbytes I guess unless it is something like 4bpp extracted into RAM tiles)
Wow! Congratulations! :D

I ended up freeing up a bunch of space by optimizing the PCM sounds, and refactoring the code a bit, and then I promptly spent 5076 bytes just for those tiles + maps. :lol:
Jubatian wrote:
Sun Aug 09, 2020 7:21 pm
I think it could be okay if the tile was dropped when bringing up the menu, I would probably even expect it to happen as carrying a tile is a transitory (no pun intended) action. But I certainly see there is some extra logic involved for such a function.
I don't think I would need to drop the picked up tile, but it would have to vanish when the popup menu was active, and reappear when it was dismissed, both for RAM purposes, and because I hide all sprites on purpose otherwise their z-ordering may draw them on top of the user RAM tiles/normal tiles used for the popup menu. Thinking more about it now, there are at least a couple other edge cases I would need to take care of as well.

User avatar
Artcfox
Posts: 1060
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: New Game: Circuit Puzzle

Post by Artcfox » Tue Aug 18, 2020 4:14 am

nicksen782 wrote:
Sun Aug 02, 2020 3:59 pm
I would be interesting in you describing the technical portions of your game.
So I did some thinking about this, and I mentioned that I arranged the tokens in the game in an attempt to build all the circuits that should have at least one LED that was lit, and then noted the hex representation of its netlist (which itself was generated from the matrix representation that was discovered by pruning the board and then sending out "electrons" from each piece of interest). Then I manually added LED-on bits for the LEDs that should be lit with that arrangement, and wrote a program to take all of the netlists and LED-on bits I discovered manually and permute them to swap the LED colors around. It was possible for this permutation process to generate netlists that I had already discovered, so to get rid of any duplicated netlists as I permuted them, I performed a set-insert into a red-black tree. This both sorted them for me and removed duplicates.

I recently found and fixed a couple bugs in my red-black tree C implementation (The CLRS "Introduction to Algorithms" textbook I own is a second edition, first printing with errors, grr!), and in the process I added routines that can dump the state of the tree in a configurable way. Instead of just showing the red/black nodes and the hex representation of the netlist and led states in the tree, it can show the tree structure, the color of the nodes (red/black), the hex representation of the netlist, the colors of the LEDs that are on, and expand the hex representation back into the matrix netlist for each of the circuits that are stored in Circuit Puzzle.

Here is just a small portion of the full red-black tree (capital letters denote anodes, lowercase cathodes):
rbtree_print_dot_snippit.png
rbtree_print_dot_snippit.png (35.41 KiB) Viewed 3691 times
If you want to see the full visualization, run:

Code: Select all

git clone https://github.com/artcfox/circuit
cd circuit/oracle2
make
./main
and you will see a new file in that directory called rbtree.dot

To turn that into a PNG file run:

Code: Select all

sudo apt-get install -y graphviz
if you don't already have graphviz installed, and then:

Code: Select all

dot -Tpng rbtree.dot -o rbtree.png
to render the DOT file into a PNG file, then open rbtree.png with an image viewer, and you can see the full tree (283 nodes), but be warned, the PNG file is 21679 pixels wide by 3575 pixels tall, so make sure your computer has enough memory and can handle it!

You can also open rbtree.dot in a text editor, and see the programmatically generated red-black tree representation in the DOT (graph description language).

Data is beautiful! I would love to print out the full tree and hang it on my wall as art.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests