Posts

Using ChatGPT to code calling ChatGPT to be my opponent

Now for the really fun / challenging / possibly dumb part: after thinking how the combat mechanics should work I noticed that it might be cool to leave that to ChatGPT. So after some interactive experimentation where ChatGPT surprised me with thoughtful replies on what it would do I went ahead and constructed this prompt (and had it simplify by... guess who):  `You are in a turn-based RPG controlling multiple NPCs, while the human player controls their character. The game has various scenes with a grid layout. The player and NPCs take turns performing actions. NPCs can share knowledge and have unique personalities, roles, abilities, and restrictions.     Possible actions:     1. MOVE_CLOSER: Move one step towards the player if unoccupied.     2. MOVE_AWAY: Move one step away from the player if unoccupied.     3. DO_NOTHING: Remain idle.     4. TALK: Speak to the player if adjacent, with your chosen text. ...

First crappy dungeon painting done, now off to the real stuff

Bild
Okay, after getting stable diffusion to generate all kinds of stuff for me, I've got a first crappy-looking dungeon, with 90% of the code written by ChatGPT. But hey, it is a full dungeon level with weapons and armor and a NPC in it! And drawing stuff on top of other stuff! In the end, debugging was painful, damn Javascript. At some point some subclass returned not a DrawingObject(URL) but the URL itself. A strongly typed language would just have seen that. Oh well. Now for the fun part - getting ChatGPT to be the player's opponent in the game. But that's for next update.  

Sometimes ChatGPT is nearly creepy in its level of understanding

TL;DR:  when helping to write code, ChatGPT is well aware of the meaning of the class you are writing, and will e.g. implement isTraversable() for a wall to return false, for a floor to return true, because it knows what walls are, what you do with walls in an RPG etc. Today I wanted it to create simple classes for representing level entities like walls and floors. So I first asked it to create a DrawingObject that pretty much only represents an image URL, and then a LevelObject that knows how to be drawn with a DrawingObject, and has a method "isTraversable()" This is my prompt: note that I didn't say anything about the purpose of isTraversable() okay, now I need a couple of JS classes. First a simple class "LevelObject" that has a method isTraversable() that throws a "need to be implemented by subclasses" error like the one you did before, a method getDrawingObject() that returns null And it created the JS class. I then wanted it to change it slig...

Rendering on a canvas

Bild
Yesterday was a great day working with ChatGPT4. I am very happy to have invested those $20 into that plus license - availability and speed are amazing.  Now that I spent some time creating first, shabby versions of player, monsters, NPCs, trees, walls, stone floor, it's time to do a first simple rendering.  Nicely, ChatGPT remembers your conversation if you click on it, so I started over where I left a week ago and asked: can we continue this conversation? Now I have all the images ready to continue; I would like to first start with the code to draw on the Canvas. can you show me an example: assume I have to coordinates xmax and ymax, and I want to draw a grid of 0..xmax-1 by 0..ymax-1 . I have a class called Level with a method getDrawingObjectsAt(x,y) that returns a sorted list of DrawingObject objects that need to be drawn on this coordinate after each other. A DrawingObject has a method getImage() that returns an image URL pointing to a .png file. Can you show me the code...

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 ...