Posts

Timeout

Bild
Switching AIs from ChatGPT to stable diffusion as I need a number of images for warriors, guards, peacekeepers, traders, cowards, to populate my dungeon. And a hero of course. Working with SD 15 model (the RPG model wasn't so impressive). The Elden Ring Lora and the extension to remove backgrounds are very helpful, and controlnet helps me have everybody have the same stance. Won't try animation for the first attempt. Still quite a bit to do - 5 different elements x about 8 different types of NPC/monster x create 100 images to select the best from = 3000 images to be generated. Here's a few. Need to be scaled and cleaned up still.

Why you should ALWAYS and THOROUGHLY review ChatGPT's code

TL;DR: sometimes ChatGPT does stupid coding mistakes. And if you ask it to correct them, sometimes it has no clue about the root cause and tries to hack around it, which is not what you want.    Came across a fun issue when creating the second HTML page. In the first page, a tiny bit of its JS code was stupidly wrong, and I didn't notice it: It added an event listener to the button to proceed to the next page, and for mysterious reasons added a listener to add a listener, instead of adding a listener.   startButton.addEventListener("click", function() {       startButton.addEventListener("click", function() {           ... do stuff ..           // Navigate to the next screen, e.g.:           window.location.href = "levelconfirmation.html";       });     }); As a result, the f...

ChatGPT as UX designer / HTML coder

Bild
TL;DR: ChatGPT can be fairly creative if you let it. The question is when to give it this kind of freedom and when will this just create crap? For designing simple HTML pages with some Javascript for the interaction of elements it is almost perfect.   Like pretty much every computer scientist, I suck at creating beautiful UIs. There is a reason that UX designers have studied design and have different skills. So for my little RPG I hopefully convinced ChatGPT that it is an excellent UX designer and HTML coder. Let's see if it can create responsive, good looking start screens for my game... We both started full of enthusiasm and I promptly ran into the "if the prompt is too complicated it will just error out" issue. (could be also random issues, right now ChatGPT is erroring out often). So I came up with a more focused, task-oriented prompt that gave ChatGPT less freedom and a very clear list of things to do. Here it is: Background: the game is about turning web pages into ...

Documenting code is a cool ChatGPT skill

TL;DR ChatGPT creates excellent JSDoc comments that explain method purpose, parameters and return values. Can't help to think: if a comment can be automatically and reliably generated by an AI, it shouldn't be part of the code but generated on demand when needed.  (please note: I'm a JS newbie, sometimes I'm easy to amaze) So I thought why not give ChatGPT the task to write good comments for the method I had asked it to create. So I took a class and a method and asked it to create a comment.  And it did. Here's an example: /**    * Equips a tool from the creature's bag to a specified limb.   * @param {Tool} tool - The tool to be equipped on the limb.   * @param {number} limbIndex - The index of the limb in the creature's limbs array.   * @returns {boolean} - Returns true if the tool was successfully equipped on the limb, and false if the tool was not found in the bag,   * the limb already has a tool equipped, or the tool is not compatible with the...

Overwhelming ChatGPT with a lengthy wish? Inventory management

Bild
TL;DR: Learned two things today: 1. when you confront ChatGPT with a too complicated request you just get a technical error. 2. ChatGPT is really good at explaining how the code works that it generates, incl. simple to understand code snippets. Now this was underwhelming: Me: Assume I have a class Creature that represents a Creature (a monster, a NPC, a player) in a role playing game. This creature needs to have a bag in which it carries stuff. It also has the following limbs: head, arms, body, feet, and it has two hands. Also I have a class Tool that can be any tool that can be put into a bag, and from the bag moved to a limb or to a hand. A limb and a hand can only hold maximum 1 tool. If I move a tool from bag to limb or hand, and there is a tool there already, the former tool will automatically move to the bag. Can you create code for methods a) to put a tool in the bag b) to take a tool out of the bag and assign it to a limb. If the limb holds another tool, this is put into the...

Creating unit tests: is the glass half empty or half full

You can ask ChatGPT to create unit tests for a class. Just paste the class code into the prompt and ask it to create unit test. It will then create a good start for a unit test that will fail 100%. ChatGPT 4 does understand the concept of a unit test. It understands what to test for a class that has this and that member and this and that method. Not perfectly well but usable as a great starting point. However, ChatGPT is no human who understands what the class is supposed to do. It is a large language model and it tries to make sense of the class in terms of the words you're using for members and such, often with hilariously wrong test data. I still find it useful, it generates all the right method calls and correct syntax and even descriptions what the test does. All you need to do is to change what the test data you feed in and result really should be. So for me the glass is half full. ChatGPT makes my writing unit tests faster by maybe a factor of 2.

A first summary and recommendations after a few days of work

I notice I'm diving to deep into details about the game I'm converting to Javascript with ChatGPT.Maybe much is not so interesting for you, dear reader. So here's a summary without such details, along with a few recommendations for working with it that might help you when doing the same. Working on modular and independent classes is magic ChatGPT is extraordinarily good at working on single classes that don't have too many dependencies to other classes. Tasks like creating new methods, either by converting a method from Java to Javascript, or by understanding a specification text and implementing it, are perfect for ChatGPT. On these tasks it performs on a superhuman level. With the AI, I got stuff done in Javascript (where I'm a beginner) in 1/10th of the time that I get similar stuff done in Java (where I'm an expert).  Limitation: it doesn't really think and comes up with patterns / algorithms that do the job but don't perform perfect and can be optim...