I’ve tried chatGPT but it often gave wrong info, but was somewhat useful. Now that I’m using Bing Chat AI to help with defold I’m getting great answers that really do help me out a lot. For example, I was struggling to get my high score saving using a modified code sample. So I just gave Bing the error and even used the code sample (unmodified) and it told me what my issue was!
I quickly realized I had to move the high score functions to the top of my script. In my script (which I didn’t even give to bing) they were at the bottom.
I hope this helps others as much as it has helped me.
That’s a Lua related problem more (scoping), so it’s strange Chat GPT wasn’t useful here
But it is interesting if Bing AI have free access to internet then, so it could check out for example current documentation of Defold?
Chat GPT has that strange limit, where it claims not to have access to current data, so it doesn’t know e.g. gui.get_tree introduced in 1.4.6 (July 2023), but it links to the documentation:
I definitely need some lua scoping training. I’ll need to find something on that so I can code more quickly and have less errors.
I really like defold and I made my first real game in about 1 week, but am spending way too much time tweaking to make it look good as I have issues with the finer points to make everything polished.
Right now I’m struggling on the timed game mode high score. reformatting the number to a text 00:00:00 is killing me. I can do it just fine but when I try to read it from the high score saved file it doesn’t like what I’m trying to do. I’m almost there though.
Always remember, that what you have in back end doesn’t need to be the exact same thing as in front end. Separate data (model) from view. For example save a high score as just a plain number in e.g. ms and then, only when you want to display this number in any format you would like to have, convert it just before displaying For operations (comparisons in this case probably) use just a plain number, but what you display to user might be then presented in any way you want it
Thank you and that is what I was doing. End up I had my local function to convert seconds to hours: min: seconds at the bottom of the script and not the top. Rookie mistakes.
It has knowledge specific for Defold game engine and Lua and it looks like it can utilise this knowledge better than generic GPT-4 and GPT-3.5 asked about the same questions, but I only played for few hours with it. I don’t know if this is working in a free version, but if you are checking out Pro like me - you can test it
I also made a similar bot. The answers are similar to yours. I think the variations come from how you fine tune it. For example, I updated mine to give me shorter answers and to only give code examples of updated code – not the full script.
Overall, it is nice to have… but I don’t think it’s a huge game changer. It can get carried away with updating the solutions it offers vs. coming up with a simpler solution.
Here’s a great example of how good bing is at helping me. I was beating my head against the wall trying to get my tower to track the enemy when it was in range. Finally I just put my code into bing and asked why it wasn’t working properly. The tracking was off. Here’s our conversation.
Wow this is cool Using the defold companion AI I got this suggestion (but it was hidden in commented code)
angle = angle - math.pi / 2
And bing end up with this as the solution:
angle =angle +math.pi/2
angle=angle+math.pi
I tested both and they are the same. So chatgpt with defold guro gave me a slightly better answer but it was commented out. If I didn’t know the answer I may have missed this.
All three answers suggest using the old msg.post(URL, “play_animation”, …) instead of the recommended new way of calling sprite.play_flipbook(). I suppose there are a lot of old examples still around…
With such problems - I believe it would be better if they would point out to the documentation
While there is indeed a possibility to send the message to sprite for it to play the animation I find it strange, when there is a direct call to do it:
I like that GPT suggests also to delete the objects after - but why with timers? It could be deleted when the animation of explosion is done in e.g. callback function on completion
Also - I would do it with trigger collisions only, as this is enough for such a use case - you don’t need any data about the collision except that it happened