Creating a Multiplayer Minimap - Ryan Brown


This week, I was tasked with creating a minimap that could display a level, be centered on the owning clients character location, rotate the player’s indicator in relation to the direction their camera was looking, then add indicators with similar functionality for other players in the session. To more clearly identify these indicators, I also went ahead and added color coding to the first four player controllers in the session. It was not fun, but it was satisfying.

We wanted this minimap for the purpose of easily keeping track of information in highly chaotic moments of gameplay. Eventually this minimap’s functionality will expand to also show mission objective locations on large levels, but in terms of its current functionality, it could still be critical to helping players survive. For example, if one player is separated from his teammates and overrun by enemies, he could glance to his minimap to quickly see the location of his team and attempt to regroup with them for support in defeating the horde of enemies following him.

 

To create this minimap, I took a somewhat multifaceted approach, keeping multiplayer in mind from the start. The first attempt had me attaching a second camera to the player character and a sprite above their head that was only visible for that camera. This was a bad idea for multiple reasons. For one: this would likely cause performance issues later, as this was basically rendering the scene twice for every player. And two: linking the minimap directly to the character meant it was no longer specific to each client, so any new client logging in would override every other’s minimap view, making the new client the center of everyone’s map.

Instead, I landed on an approach that used a screenshot of the entire level and zoomed into the owning client’s character location for each player. That way, each player’s screen has a minimap focused on themselves. Then, I created a component to attach to points of interest – in this case, player characters – and a corresponding widget that tracks the location of the component’s owner and appears on the minimap in relation to that location. A few more tedious things like changing to assigned player colors and tracking rotation of each player’s camera on the minimap were their own challenges, especially with networking. In short: colors are assigned in the game mode and will change through a delegate whenever the game mode’s list of Player Controllers is updated. For rotation tracking, it had to be tracked through the character and multicast to all clients for that info to be updated on the minimap.

Leave a comment

Log in with itch.io to leave a comment.