A while ago I started working on a first person shooter, and I soon realized that I had no grasp on the UE4 framework and network replication and my progress came to a grinding halt. I’ve been thinking about making a Risk clone, as I already know how to set up all of the logic for Risk (aside from framework/replication) and I think it would provide a good opportunity to learn how to structure data and properly use UE4’s framework.
The following is my assumption of how the framework would be set up in the context of Risk:
GameMode - Handles all of the game logic, such as assigning territories to the players, handling turn logic, dice rolls, etc. All done server side.
GameState - Keeps track of number of turns taken, cards available to be drawn, etc.
GameInstance - Not sure where this would be useful.
Playerstate - Stores each player’s cards and territories owned.
Pawn - Is essentially just the camera that looks down at the board. Receives mouse events from the controller and calls custom events in the GameMode, which would then be checked server side for validity.
PlayerController - Handles the mouse input.
I figure the best way to set up the actual board would be to create a territory actor which can be placed in the level and represents the location of each territory for use by the HUD. The territory actor has a few public variables such as name, mesh, adjacent territories, etc., which can be modified in the Default Panel. In 3ds Max, I’ve got all of the territory meshes created in a single scene and are each exported out from this scene separately. From the Default panel of each territory, I select the appropriate mesh. In the Construction Script, I assign the selected mesh to the mesh component and set its location to 0,0,0. Works out nicely.
Under this assumption of how the framework should be set up, I’ve set up the logic inside the GameMode blueprint to assign territories to all of the players in the following manner:
The Assignable Territories array is populated in another function using Get All Actors of Class. The Add Territory event simply takes the actor input and adds it to a local array variable inside the PlayerState class. Am I sort of on the right track here?