A fun lil physics app/game! I’m learning Go through it. So, here’s what I did! I first tested a few different ways to display the objects, and found Ebitengine, which I decided to use! Then I make a struct to hold each particle’s data. I then made a system to accelerate them each frame until they reach the bottom of the screen. It sounds simple, but my lack of experience in Go made that quite a challenge! XD Anyway, after I did that, I managed to find a good value for gravity. Then I added some damping and ✨ bounce✨ Then I tried optimising it! I used Gemini AI to learn more about how the library draws objects, then saw in the docs how to position images! I then tried drawing a pixel art image, but - after consulting Gemini again, realised that it’s better to just dynamically render it at the beginning of the program running. (NO AI CODE!!!) After figuring out the options, I managed to get these little pre-rendered balls to work! And REALLY well! It now runs 250,000 objects (M2 MacBook Air) significantly faster than it previously ran 5,000! It’s not much progress for almost 2 hours, but I’m glad that I was able to do this all! (This is my first real Go project, so I’m happy :D)
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.