I've been collecting a few of the more interesting ways I've broken my snake program so far:

- I forgot to replace the arithmetic operators on my Vector types (now an alias of a Long), causing an overflow error and making the snake sever its head. (1/3)


- I wrote some code to keep track of chunk updates and reuse old data to avoid light-tracing on each frame, and used the wrong position value to index them with. (2/3)

This caused *no updates* to occur, drawing light maps on top of each other and creating this horrible mess:

Show thread

- I forgot to include a comma when adding arguments to a function, accidentally subtracting two numbers and making random parts of the background disappear. (3/3)

(It's nice having direct visual feedback for all my mistakes - makes these bugs a lot more interesting to find!)

Show thread

So it turns out programming is kinda hard! (lol)

In good news, though, all these mistakes have actually paid off, and my snake game can now run at about 30fps (that's twice what I had before!) - as long as I avoid any big light sources.

Sign in to participate in the conversation

A group of individual developers and enthusiasts with a focus on independent services, software, and technology.