Bing Chat AI is amazing for helping with defold programming

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!

Here is what I asked Bing:

And this is what Bing told me:
image

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.

2 Likes

That’s a Lua related problem more (scoping), so it’s strange Chat GPT wasn’t useful here :smiley:

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:

Fun fact is, the link would be correct, if it would not add colon at the end: API reference (gui) (https://defold.com/ref/gui/#gui.get_tree:)

2 Likes

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.

You can check out the current build here: Kabocha Game by schlista (itch.io)

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.

2 Likes

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 :wink: 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

1 Like

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.

1 Like

I will hook it up to the topic - custom made GPT - Defold Guru:

https://chat.openai.com/g/g-WCKtd1UzF-defold-guru

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 :wink:

10 Likes

I can confirm it’s not available for the free version. You need to upgrade to Pro. :slight_smile:

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.

2 Likes

Would you mind sharing it? I would also like to test it if possible :wink:

Here you go.

https://chat.openai.com/g/g-9SJ9CXMqC-defold-companion

Let me know if you see any room for improvement!

2 Likes

Let me know how well it works. I may sign up for pro again if it is worth it.

Also what is the difference between the one you posted and the one RaymondDuke posted?

I never used a “companion” or “guru” in chatgpt.

Wow and ChatGPT has paused new customers :-(. I can’t even get plus right now if I wanted.

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.





1 Like

Well I finally got a ChatGPT plus account and out of the box it didn’t get this problem correct.

Now I’m going to try the other two ChatGPT helpers listed above.

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.

FWIW: defold GURU custom GPT didn’t solve it.

So far I’d say BING is the best with defold companion 2nd best (WITH THIS PROBLEM)

1 Like

using defold companion and defold guru vs. bing. Which do you think is best?



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…

3 Likes

With such problems - I believe it would be better if they would point out to the documentation :confused:

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:

sprite.play_flipbook("#sprite", hash("explosion"))

I like that GPT suggests also to delete the objects after - but why with timers? :smiley: It could be deleted when the animation of explosion is done in e.g. callback function on completion :wink:

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