Wednesday, 28 June 2023

Checking PCB Traces with a UV Light


 Recently I was working with a Snapmaker Artisan and using the CNC module to cut a simple PCB from copper-clad FR4.

For best results, the cut board needs to be lightly sanded and cleaned up. But I wanted to check how clean the cuts ended up -- any stray copper or rough bits of cut would cause a short. It's necessary to inspect the quality of the traces.

I stumbled upon using a UV illuminator to shine on the PCB. Because FR4 (the PCB material under the copper) glows under UV, it is very easy to see with the naked eye whether cuts are clean or not. Previously I was using a magnifier and lots of light, but shining some UV is so much easier.

Clean CNC cuts show up as clean, unbroken glowing lines. Any debris or rough edges or stray bits of copper (if there are any) are easily spotted as a result. Just a quick little tip!

Sunday, 21 May 2023

3 Critical Things for Playing D&D With an AI (as DM)

 

I tried a very successful experiment where I had ChatGPT act as a player in a D&D game. I recently had an even more successful test where I had GPT-4 act as DM for me, and played an entire short adventure from beginning to end without a single hitch!

I'll share a link to the full transcript, but here are the three biggest things that led to success.

1. Use ChatGPT with the GPT-4 model. 

The GPT-4 model is much better than previous models at pretty much everything.

2. Provide a Proper Prompt.

See below for the exact prompt I used. It can be adjusted, but the format worked wonderfully.

3. Be "Honest" With the AI.

The AI is not an adversarial DM. Be honest and clear about what your character is trying to do or wanting to happen.

The Prompt

Here is the exact prompt I used:
You are DM_GPT, and your role is to act as a DM in a D&D 5e game, to help me practice being a player.

--- BEGIN SCENARIO INSTRUCTIONS ---
Here is a setting, a conflict, some leads to follow, and a boss showdown suitable for level 1 characters:

- The adventure takes place in the small town of Whitecliff, located in a thriving kingdom near the edge of civilization. 

- The small town has recently been threatened by an evil force known as the Cult of the Dark Moon. Led by a mysterious figure known as the High Priest, the cult has been terrorizing the town and its people. 

- The players must investigate the mysterious cult and its nefarious deeds. They will soon discover that the cult is planning to summon a powerful demon lord. 

- In order to stop the cult, the players must explore the nearby forest, where they will find clues leading them to the cult's base of operations. Once they have infiltrated the base, they must battle the cultists and the High Priest in order to prevent the demon lord's summoning. 

- Ultimately, the players must defeat the High Priest in a climactic boss showdown, thus saving the town of Whitecliff and its people.
--- END SCENARIO INSTRUCTIONS --

Please begin by offering to create a character for the player.

By the way, the scenario instructions in the above were also generated by AI!  I simply asked (in a separate chat) for it to "Create notes for a simple D&D 5e adventure suitable for level 1 characters. Include a setting, a conflict, some leads to follow, and a boss showdown."

The Transcript

Here is the completely un-altered transcript, which you can read for yourself.

The adventure "worked" and was playable from beginning to end, with no problems. That's a pretty big deal!

Sunday, 14 May 2023

Playing D&D With an AI.. as Player, Not the DM

Many people have experimented with having an AI like ChatGPT act as Dungeon Master in a D&D game. Results tend to be encouraging, but mixed. (Update: Here are my keys to success!)

But a while ago I flipped the concept on its head and asked an AI to act as a player, instead of DM. The results convinced me that there was some mileage in this idea, and I'll explain why.

The Big Takeaways

1. ChatGPT's GPT-4 model is better than GPT-3.5 (3.5 being the default at the time of the experiment.)

Both work, but GPT-4 is noticeably better at chains of reasoning, grasping cause and effect, remembering important details, and so forth.

2. The AI is really good at creating a character and walking through the process.

Simply asking the AI something like "create yourself a D&D 5e character and explain each choice step-by-step" is very effective. (You can also ask it to summarize the character afterwards.)

3. As a player, the AI can be expected to be "On Board" and cooperative

This may be a result of me asking the AI to be a player in order to "help me practice being a DM", but I found that as a player the AI will follow your lead and not play in an adversarial or antagonistic way.

4.  The AI model forgets things as time goes on, and makes mistakes a human would not make. 

This includes forgetting ability numbers, but also things like forgetting the fact that it is supposed to be the player, not the DM. This isn't too surprising considering how AI language models work, but it's not very intuitive. There are effective workarounds, such as being careful about how one phrases things. For example, ending with 'What would your character like to say or do?" is always helpful. It's also helpful to try to focus on one thing happening at a time, to make the chain of roles and events clear.

Even so, GPT-4 was still extremely good at remembering high level details of the story and events. It demonstrated this with its response to my asking it to summarize the adventure after it concluded. It did a great job of that, even if it was also sometimes forgetting things like ability numbers or slipping into wanting to act as the DM. 

5. If Things Get Off Track, Edit the Last Thing You Said 

I needed to occasionally use the "redo" function where I edited the last prompt I gave and re-generate the response to get things back on track. For example, if the AI tried to "take over" the narrative, adding a question like "What does your character think about that?" or "What would your character like to say or do at this point?" makes the roles clear.

Sometimes, as the adventure went on, the AI would occasionally respond to my request for an ability check with something like "as an AI language model, I can't make dice rolls..." Re-phrasing things to something like "Please make a Perception check for <character name> and tell me the result" usually fixed that.

In the adventure transcript (which can be found below), I tried to make a note of when this happened, but the actual "re-writes" are not included.

6. Give the AI a Push If Necessary

I found the AI seemed to prefer to continue to gather information and prepare when there was uncertainty, rather than make a choice about a way forward. In these cases, the AI responded well to clear direction or a clear lead.

However, now that I think about it, this preference for investigation and learning over action may have been the result of the AI's player character personality (in my experiment, the AI played a bard with a sage background and a predilection for learning.) I'll have to test this idea.

7. Combat is still a question mark

I handled combat in a mostly narrative and hand-wavy way in my experiment, and this angle isn't well explored.


The Adventure 

Here it is, in ChatGPT's own words:

How would you, in your own words, summarize the adventure and your role in it?

 In this adventure, I took on the role of Elara, a skilled investigator and mage hired to help the town of Greenhollow with a mysterious creature causing trouble. The town had experienced a series of strange incidents that were both harmful and mischievous. Elara conducted investigations, interviewed townsfolk, and studied the local environment to uncover clues about the creature's nature and intentions.

During the investigation, the mayor mentioned that a mage named Sint was also expected to arrive in town to help with the problem. Upon Sint's arrival, Elara proposed a collaborative approach to resolving the issue, which Sint eventually agreed to. Together, they devised a plan to lure the creature, identified as a Will-o'-wisp, and confront it.

With the help of a desperate prisoner, they lured the creature into a confrontation, where Elara and Sint combined their magical abilities to overpower and ultimately defeat it. Although there was a loss of life during the confrontation, the town was freed from the Will-o'-wisp's mischief, and Elara gained both the town's gratitude and a share of the reward.

As Elara, I provided the player's perspective, making decisions and taking actions based on the information and situations presented by the DM, while the DM crafted the story, controlled the NPCs, and guided the overall narrative.

There is one glitch in the above -- Elara was a bard (not a mage) although I hand-waved the magic use during the final confrontation and ignored the AI's poor sense of what spells Elara would or would not have access to. That probably contributed to the error. But besides that, the summary is excellent.

The Full Transcript

For those interested in more details -- including comments on how things worked (or didn't) -- the full transcript is here, with comments.

Friday, 16 December 2022

Remarkably Accurate (and Concise) Description Of How AI Art Generation Works

 Just a link here to the Washington Post which has an excellent semi-interactive article that can be browsed in a few minutes that really does a great job of explaining how AI art generators work: https://www.washingtonpost.com/technology/interactive/2022/ai-image-generator/

Thursday, 8 December 2022

My Inter-dimensional Camera Takes Photos of an Alternate Reality


I had an idea recently that I quickly prototyped: The Interdimensional Camera.

The idea is that the camera takes images not of the reality directly in front of the lens, but from a neighboring dimension (or parallel universe, if you prefer.)

It uses the Dall-E API from OpenAI to turn what the camera sees into an alternate-reality version that is kind of close, but also entirely different.

The original image -- what the camera ACTUALLY sees -- is actually never shown to the user, which feeds the narrative that the camera is somehow seeing into an alternate reality.

What keeps this from just being a crappy snapchat filter knock-off is the fact that it works on ANYTHING. Not just people, not just faces, but ANYTHING including objects, scenery, animals, plants, etc.

Check out the code and details if you're interested.


Wednesday, 16 November 2022

How-To's for Stable Diffusion (Art-Generating AI)

 Art-generating AIs are fantastic and developments are happening at a breakneck pace. While experimenting with Stable Diffusion (via the fantastic Automatic1111 Webgui) to generate images I made a document to keep track of what I learned and the ways I was fixing problems.

Here is my HOW TO guide which includes my recommended settings and techniques for:

If you're messing with Stable Diffusion, this should help!

Saturday, 25 June 2022

All The Good VR Ideas Came From The 1960s

 I'd like to highlight an article of mine that was published a short time ago: all the truly good VR ideas were dreamt up in the 1960s.

The core of the article is to highlight that VR is a combination of simulation and interaction, and combining them effectively had to wait until the 60s, when the digital revolution and computers provided the right tools.

Here is an excerpt from my article:

In 1965 Ivan Sutherland, a computer scientist, authored an essay entitled The Ultimate Display (PDF) in which he laid out ideas far beyond what was possible with the technology of the time. One might expect The Ultimate Display to be a long document. It is not. It is barely two pages, and most of the first page is musings on burgeoning interactive computer input methods of the 60s.

The second part is where it gets interesting, as Sutherland shares the future he sees for computer-controlled output devices and describes an ideal “kinesthetic display” that served as many senses as possible. Sutherland saw the potential for computers to simulate ideas and output not just visual information, but to produce meaningful sound and touch output as well, all while accepting and incorporating a user’s input in a self-modifying feedback loop. This was forward-thinking stuff; recall that when this document was written, computers weren’t even generating meaningful sounds of any real complexity, let alone visual displays capable of arbitrary content.

 I round out the article with a list of ideas from the 60s that happened, as well as listing some that have not happened yet. I also highlight the difference between "important" features, and "cool" ones.

Give it a read, and maybe you'll come away with some new ideas or perspectives on VR, and where it is going.