Project Overview

LAST UPDATED: August 21, 2015

An overview of how the Mega-Risk works and what all of the parts and folders do. It's kind of messy at the moment, but not too bad.

## Folder Structure

The only two folders that matter in the project folder are the *Content* and  *Config* folders. The configs are edited occasionally, but the Content folder is where everything that is not code is stored.

Within the Content folder, there are four sub-folders: Blueprints, Maps, Mesh, and StarterContent. The names of each should tell what they contain. StarterContent is filled with a bunch of default assets from Unreal. Do not do add or remove anything to this folder and don't upload it to any source control.

### Blueprints

This folder holds any and all Blueprints. Nothing else should be in this folder (although I think I left a material in the UMG folder). The UMG folder is where all UMG widgets and HUD-related stuff should go. AI contains all AI-related Blueprints, and Effects is the temporary home of all particle effects.

### Mesh

Nothing is put on the top level of this folder. Everything is put into sub-folders. The 'Other' folder will be renamed, repurposed, or removed when and if the project is reorganized.

The maps folder contains all levels.

## Infrastructure Blueprints

The majority of the code rests upon the shoulders of the infrastructural blueprints, these being practically anything beginning with 'custom'. Custom\_Controller, CustomPlayerState, etc.

### Custom\_Controller

This is our PlayerController Blueprint. It handles all player interactions, including keyboard/mouse input or UI-related functions. It contains a variable for nearly every UI widget that appears on screen, which can be useful for reading the data from certain widgets in other variables.

### Custom\_Pawn

Mega-Risk has only a flying camera, not a humanoid character. Custom\_Pawn is our flying camera. It also contains functionality for zooming, which doesn't work as planned right now. Not much should go in here - all player data is stored in PlayerState.

### CustomGameState

Since Mega-Risk is intended to be a multiplayer game, the majority of game-wide data is stored in the GameState. This Blueprint stores the active player, the territory card deck, and also deals with turn switching and calling disaster cards.

### CustomInstance

All data that needs to be stored in between the main menu and the levels must be stored in the Instance. It's currently devoid of any code but contains a few variables.

### CustomPlayerState

All player data is stored here. This includes an array of owned territories, the number of territory cards (the cards themselves are held in the inventory widget), and the state the player is currently in. The Player State also holds events related to turn transitions and territory cards.

### MyGame (GameMode)

The GameMode is currently not used for anything but storing the default infrastructure blueprints. It will most likely be used more when multiplayer gets developed.

AI
--

The AI is fairly simple and contains only a couple of Blueprints: The AI Controller, the AI Pawn, The Behavior Tree, a function for the tree to call, and a weird Blackboard thing that's required by UE4 and seems to hold data but nobody's really sure why it's necessary.

### CustomAI\_Controller

Holds and updates the owned territories as well as enables/disables behavior tree depending on whether or not a player occupies its team (which for some reason is in the pawn...).

### AI\_BehaviorTree

A logic tree that is like the AI's 'brain'. It currently only runs the Invade function Blueprint.

### Invade

Basically, the AI. This blueprint holds a single event that is responsible for the AI invading another territory and then ending its turn after one attack. It's kind of sloppy, but it works.

## Other Blueprints

### Territory

The territory Blueprint is a big, beautiful mess. It contains all of the stuff related to checking whether or not to highlight the territory when the mouse hovers over it as well as whether or not the player should be able to select it. It also holds the code that spawns the Territory Buttons UI and invading of other territories.

#### Invasion

The invasion function is a bit weird in that it is actually called by the territory that is *being* invaded. How this works is that when a player selects a territory, that territory is assinged to the player's Selected variable. This variable is then used as the invading territory in the function.

The function itself calls the Full Roll function from the Invasion function library (which is another huge, knotted mess), subtracts the losses from each territory, and, depending on the results, may change the defending territory's team and spawn the troop movement widget.

## Maps

There are currently two maps in Mega-Risk, Main Menu and Proto1. The former serves as a hub from which players will connect to other sessions and join levels.

### MainMenu

This map contains no objects at all - it is entirely blank. The level Blueprint, however, calls the Custom\_Controller's Main Menu Event, which spawns a Main Menu widget. So, basically, this level is simply a place for the main menu to spawn.

### Proto1

The map. This is where the game is played. The map used is the 'classic' Mega-Risk board designed by Hank. Currently, for simplicity's sake, the map treats each of the original continents as a seperate territory. The map will later be divided into all of the original territories.