What architectural setup should i be using?


I just started using UE4 and I am struggling with designing how to layout my code and what classes to use/what classes should be doing what. The basic idea i am going for is a 3rd Person Multiplayer Shooter where the map is a randomly generated maze that shifts and changes while you are playing the game. This will be a session based game much like Halo. I made the mistake of jumping right into the programming without thinking to much about where things should go and ran into a lot of issues when i started doing the multiplayer. I was having issues getting things to spawn and replicated correctly and i believe this is because i designed things poorly. Also the more i right the harder it is already getting to maintain and work with. So my current implementation that i am confused about is as follows:

I have a MazeCreator class that extends Actor (AMazeCreator).
I have a MazeTile class that extends Actor (AMazeTile)

AMazeCreator basically runs some algorithms and builds an NxM sized maze and then spawns multiple AMazeTile actors with the proper animation in order to render the maze. Then on a certain time interval recalculates the maze in the background and updates the animation state of all the AMazeTiles. This works great! I even added a little check to only render AMazeTiles that are within a certain range of the player to eliminate having all the tiles being rendered and ticked all the time.

The first problem came in when i introduced multiplayer and replication. My first thought was to just have the server generate the maze and then send the maze spec down to the clients and have each client deal with rendering the maze. This is where i ran into a lot of issues. Replicating the FTile ** that is used to hold the specs of the maze didn’t seem to work and just trying to spawn the tiles the client players dont seem to be able to spawn any actors.

The second problem was i personally feel like im going about this the wrong way and Im thinking that maybe I should make the AMazeCreator really just part of the GameMode. That way its only run on the server and then the GameMode keeps the state of the maze and spawns the actors and replicates the actors down to the client. This still doesn’t help with rendering and having hundreds of actors in play all at the same time but i think that can be fixed by disabling actors that are certain distances away from all players or something like that.

So now im ranting but basically this question is really an open discussion about what would be the best way to setup my classes for a game that requires the replication and managing of hundreds of actors and where should that spawning code live.