Easier way to display custom post meta?

In situations like this sometimes it’s easier to get all the data up front and then build the output.

First get the link and rating, then check if the link is empty. If the link isn’t empty append it to the rating. Lastly, print the rating to the page.

<?php
$review_link = esc_html( get_post_meta( get_the_ID(), 'game_review_link', true ) ); 
$game_rating = esc_html( get_post_meta( get_the_ID(), 'game_rating', true ) );
if ( ! empty( $review_link ) ) {
    $game_rating = '<a href="' . $review_link . '">' . $game_rating . '</a>';
}
?>

<div class="rating-<?php echo esc_html( get_post_meta( get_the_ID(), 'game_rating', true ) ); ?>">
    <?php echo $game_rating; ?>
</div>