Trying SDL2 in C with help from AI Programming

So I wanted to try out how much AI technology has advanced since ChatGPT 3. I had it write a C program using SDL2. Surprisingly it did quite well. I used ChatGPT before to create an OpenGL app, so this time I tried CoPilot. 


Actually, it started as a PyGame created by CoPilot AI. It was converted by AI from Python to C using SDL2. It's been through about eight iterations, and it's a nice casual game. The Python version played without issue on Windows 11, MacOS, and Linux. Thus far the SDL2 version has been successfully compiled and tested on MacOS and Linux.

One thing that really surprised me with the C version is that the code provided by AI compiled without issue! I had the same surprise back with ChatGPT v3 when I had it create an OpenGL program in C of three triangles bouncing around the screen--it created the code and the code compiled successfully! I even asked ChatGPT how to configure Visual Studio to compile the OpenGL code, and it provided the correct steps to do so. I thought it was quite remarkable. 

This instance of a game is a basic game with a main menu. The idea is that you, the player, control a spaceship, and the goal is to avoid collision with UFOs flying around the screen. The longer you survive the higher your score. Occasionally a health packet appears that increases your health when collected. 

Although AI can create code fairly well, it is still a good idea, I think, to know how to code. The code that AI created, although small and short, was well organized. 

In a later iteration I had the AI create code such that the enemy UFOs were processed in a separate thread, thus introducing multithreaded code and processing to the game. Quite surprising! 

In a future iteration network client and server apps will be added to enable multiplayer action to the game. Code for this has already been written, but it hasn't been merged with the existing game yet. That is the current task at hand.


Comments

Popular posts from this blog

Commodore OS Vision 2 in Hyper-V

My new Amiga A600GS Arrives from AmigaKit

AmigaOS Aros clone on Icaros Desktop version 2.2.5