AI Coding Assistants

evakhoury2 pts0 comments

On AI Coding Assistants | Winston Cooke

Opening thoughts

Since switching to using AI coding assistants as a first class citizen in my development cycle last October, I haven't had a single eureka moment at my job despite previously having them on a weekly basis.<br>That's a scary proposition because those moments are clear signals of overcoming a difficult concept to learn something more deeply.<br>Nonetheless, there are real pressures to use those tools at work, and I believe that they do provide genuine value when used responsibly.

AI coding assistants are very impressive tools, yet I also find them utterly dreadful.<br>My favorite part about the development process is getting stuck with a problem, going for a walk or taking a bath, and then having that eureka moment where the solution to the problem leaps into my brain.<br>I previously discussed that exact feeling:

However, I ran into an issue, which was how do I determine the location of the screen as I move around the map? My first approach was to use the camera's current bounds. This involved calling for the camera's current left, right, top, and bottom positions whenever an entity needed to be spawned. This worked fine at first but led to some major performance issues once the game filled up with enemies spawning. The amount of calculations for determining the camera position and randomly choosing coordinates when spawning enemies every half-second adds up. But if I weren't moving around, the camera position would be unchanged, so why bother constantly recalculating its position?

A eureka moment regarding available spawn points came to me while I was in the shower. I could cache the camera's bounds.

I believe that coding assistants have stripped the preestablished learning path for a developer while on the job due to the temptations and pressures to ship more code at a faster rate.<br>Accordingly, I have been hesitant to use AI coding assistants outside of work because I wanted to ensure that I still had methods for learning in my personal time to make up for what was lost in my professional life.

What I have now realized is that I am capable of learning with them when I apply them to my personal projects.<br>It's tempting to reach for them as soon as I hit a stumbling block, but I have found that doing so prevents me from growing.<br>Their real utility is in assisting me with areas I already know well, and that's where they can be a proper productivity multiplier without atrophying my skills as a software engineer.

I first connected the dots after talking with the longest tenured developers at my company who had written a majority of the code.<br>They knew the shape of everything from the high-level architecture down to the minutiae of implementation details for some of the most critical and complex parts of the code.<br>For them, AI naturally extended their current skill set, and they had less room to grow compared to a developer earlier in their career.

After discovering that insight, I realized that revisiting my game, Plight of the Wizard, would be a strong use case for an AI coding assistant.<br>I wrote every line of code by hand for a game jam and then iterated on the code for months, so I know the entire project well.<br>Further, I was aware of what my limitations were at the time and had certain areas in mind that could use a proper review.

Improving performance in Plight of the Wizard with the help of an AI coding assistant

I wrote an article awhile back about how I improved performance in Plight of the Wizard.<br>Many of those performance improvements were related to the fact that it was my first game, and I was still learning the best practices for game development alongside learning Lua and the Playdate SDK.<br>However, I eventually hit a wall and couldn't achieve a stable 30 FPS.<br>I knew that it was possible to do that, but I found it increasingly difficult to solve the most problematic areas, even with profiling tools.<br>This was mainly due to my lack of experience in the domain.

Two weeks ago, I decided to revisit the game after a one-and-a-half year break to begin implementing the long list of features I had written down during that time.<br>However, I couldn't add any of those features without addressing the performance issues first.<br>The more features I added, the worse the performance would become, and the more code I wrote with unintentionally poor practices, the more the issues would permeate throughout my codebase.<br>The performance was my white whale, that I was going to use a coding assistant to tackle.

Planning the improvements

The first thing I ever did when creating a game for the Playdate was read the developer documentation and browse the provided example code.<br>It's the best method I have found for learning a new tool.<br>This is an area where an AI coding assistant shines because it is capable of loading the entire SDK for the Playdate into memory and becoming an incredibly fast and interactive browsing tool.

After providing the Playdate's SDK to my...

coding first performance game code assistants

Related Articles