Project Bella

Week 10!!!

Some of the feedback I received on last week's build indicated that the player doesn't really have to interact with any of the AIs, and so doesn't get the full experience of playing a game full of intelligent agents. This was something I was anyways going to focus on this week, as one of my ultimate goals with the agents is to get them to chase other agents and the player away from their own nests/sabotage other players. I decided it would be too complicated to have the agents learn both to bring food back to their nests AND engage in aggressive behavior, so I decided to focus on the one that's more impressive and fun for the player: training aggressive behavior.

But this had to be done in a way that's engaging for the player and really forces the players to compete with each other. The issue with the food balls is that they respawn upon consumption, and you can't really "take" them from another player once they've been consumed. I swapped pieces of ice in for pieces of food. Now the players have to push ice slabs to their nests, at which point the slab will snap to whatever side of the nest they hit, and stay there unless an aggressive agent bumps into it and dislodges it. In this way, even when a player has "claimed" an ice slab (attached it to their nest), another player can come along and dislodge it. They can also intercept one another's ice slabs which, from playing this as a single-player game enough times, would be hilariously frustrating.

The issue with this system was that if an ice slab in a chain of ice slabs was dislodged, then all subsequent ice slabs should also be dislodged. To handle this properly, I needed to have every ice slab hold onto a list of all other ice slabs touching it, and the nest itself holds onto a list of every single ice slab in the network. Whenever an ice slab is dislodged from the network, the nest performs a BFS and dislodges any ice slabs that are no longer in the network.

Upon testing out this system, I was delighted to encounter a bunch of stack overflow errors when I tried to dislodge an ice slab. This wasn't caused by an error in the BFS itself, which at this point in my life would be disgraceful, but by an infinite loop of calling the BFS. Once that was fixed, the only errors I encountered were null reference errors from an ice slab immediately connecting to the nest upon spawning into the scene, or an ice slab trying to loop over its list of ice slabs even though it had just been cleared, and frankly neither of these have any consequences code- or game-wise so I don't really care about them.

I've only trained agents a tiny bit to gauge whether or not I've set up the rewards and environment right (I have not, but I know how to quickly fix it for next week). Although I realize this means I didn't make any progress on the build for this week, I don't think this is an issue because the difficulties of changing the player models and moving the game out of the ML-Agents Unity SDK project and into a new project were all handled last week. This means the project is set up, I just need to stick the right models into the agents and build it.

For next week, I'll train the agents to work in this new environment (building nests from ice slabs), and move them into the final project.