My boss left early, so I decided to be a little naughty and set up the Sports2D package on my work laptop. My coworkers clearly support me.
Soooooo…… I vibe-coded my way to a successful integration of the Sports2D package with Unity. It’s now on my GitHub (private, for now) and features a fork of the Sports2D package as a submodule. Overall, it took less than an hour for me to get it working. I nearly the same amount of time figuring out how to set up my repo.
Its amazing how much I can learn from conversing with an LLM. I’ve always felt that learning the necessary terminology to properly describe a problem is key to solving it. So often, I find myself not able to adequately describe what exactly it is I’m trying to do, but LLMs now provide a handicap for those moments where my writer’s block rears its ugly head.
In my experience, LLMs do their best work at the very start of a project when context is narrow enough for them to have full scope of the project architecture. I made sure to prime Gemini with the Sports2D README and only asked it to create the barebones for integration with Unity. In true vibe-coder fashion, I have no clear idea of how the integration works, but here’s a basic summary:
A Python bridge script silently launches Sports2D and starts a TCP server on a specified port whenever the user enters play mode in Unity via an editor script. A custom callback function added to the Sports2D package sends data over to Unity after every processed frame while a listener script attached to an empty game object in Unity listens for data on a matching TCP port. Boom.
Honestly, I gained most of this understanding by looking at my repo’s README, which my LLM also conveniently generated for me.
Something I definitely overlooked (or willingly ignored) is the fact that this library is meant for 2D. What I mean by that is that depth is not tracked. Now, I do think that I can conjure up some clever workarounds for the lack of Z-data, but at this point, I want to focus on getting a basic line-renderer demo working. That way, I can publish the repo and feel good about contributing some more open-sourced code, even if it may be LLM-written garbage. Hey, it works. In all seriousness, I’ll definitely familiarize myself with the code before publishing.
By the way, I think I have to grab this:
Edit: COPPED!!
Tags: unity gamedev ai programming 2d networking