After corresponding with ChatGPT, I realized that my work flow of duplicating, renaming, and recreating all my scene files whenever I wanted to save a backup of my scene was stupid and wasteful when considering the fact that I use version control. From now on, I’ll keep my project clean, my commits accurate, and as always, this dev log up to date!

On that note, I duplicated my EnergyBall-V2 repo and created a new one for my V3 version. I say V3 because implementing metaballs is such a significant enhancement that I consider it worthy of a version number. I got started on the porting of my metaballs code, adding a field to the player constructor for the metaball index. The way I’m mapping this thing out, I’ll instantiate the scene with 6 metaballs (which I’ll consider the max player limit). Each metaball will start off screen and with a radius of 0. Once a player is initialized, it’ll get assigned an index in the metaball list. I keep track of which indices are occupied by players using another list of integers. Here’s the basic pseudocode:

void AssignPlayerIndex(player) {
	for (i=0;i<maxMetaballs;i++) {
		if (!activeMetaballIndices.contains(i)) {
			player.MetaballIndex = i;
			activeMetaballIndices.add(i);
		}
	}
}

The next step is to update the metaball radius and position data according to the player data. I may not even need to implement player scaling with the metaballs algorithm in place, since the merging of nearby bodies leads to an increase in mass. We’ll see, but simpler is always better when it comes to performance!


Tags: gamedev unity vfx metaballs scripting