Week 3 of Google Summer of Code is done! This week I focused on continuing the faction code, making it so that players could choose their team (red or black) at the start of the game and, upon selection, get teleported to their team's base.

I'd already started some of the faction code last week, though due to the fact that I had some odd issues with my workspace I wasn't able to get this fully completed and tested. Once I started trying to work out my new code, I realized things weren't going to be as straightforward as I thought they'd be.

First off, I was having some issues with the Dialog module in terms of pressing dialog buttons to cause certain actions to fire. There were some issues figuring out how to fire multiple actions in dialog, with the dialog buttons not causing the desired action and leaving me unsure of why--if it had to do with the action not being fired by the dialog button, or something else along the line that wasn't working.

I decided to switch over to having a system of teleporters instead, a red and black one placed on the platform which the player could activate to join that team and teleport to that team's base (based on this forum post). I added teleporters to the rasterization of the floating platform, and changed up the NPC's dialog to reflect this (instructing the player to activate the appropriate teleporter to start).



Pick your side!

The teleporter system was giving me some trouble at first--it appeared to not be firing on activate in the same way as the dialog system was acting up! I realized, though, that I was missing a @RegisterSystem(RegisterMode.AUTHORITY)at the beginning of the TeleporterSystem class, which cleared that problem up.

The teleporter system works when a teleporter is activated, the system takes the player (EntityRef player = event.getInstigator();) and sets their LASTeam component to the same as the teleporter they are activating. It then sends a teleport event causing the player to teleport to their team's base (right now these are hardcoded coordinates close to the flag). They can pick up the enemy's flag, but not their own.

Another interesting thing I learned along the way was regarding testing--I'd built a UI structure to check the player's team, but thanks to a tip I learned I can just use dumpEntities in the console to check the team component of the player.

I was hoping to get the win detection and scoring UI set up this week, and while I've started on some of that code it's not ready yet. I'm hoping next meeting to solidify the best way to determine win condition (entering a region? collision with friendly base?) and to start testing out how to access what's in a player's inventory. The main game loop is almost there, and soon to come will be guns--which I think will be the most difficult of what I've tackled so far, but also super rewarding once it comes together.