Hi,
i’ll try cover basic things, you should know i prefer blueprints to C++, but core idea the same:
-
base building block is level (map) asset, it define various parts such as: 3D terrain of your level (for both case, static world and partially dynamic up to fully generated piece by piece at runtime), so maps can separate how your game works, you can make universal maps that work both in single and multiplayer, also you have to know that “Main Menu” actually usually just a level to handle base menu navigation to all other activities in the game and at same time provide some light background, from 1 flat image up to fully 3D dynamic composition, from this point you can your project settings by default to “Main Menu level” in this place https://yadi.sk/i/4TeIM3xRiFpn6, al note that each level have own “level blueprint”, it’s a special place for default loading logic
-
more likely every object as blueprint can have “event begin play” to let you controll what should happen after object was created, it remain same for levels in their level blueprints, so when level loaded from this event you can handle what should happen next depending on level and game mode preferences, note that same level can work fine for different game modes and single/multiplayer if properly set
-
good idea is make your own player controller blueprint/class for handling most logic flow like mouse and keyboard clicks, this is right place to store all data related to player and not properties related to instance of your units like their HP, armour, speed - such should be stored in actor based blueprints/classes and in player controller should be stored things like player’s current resources, relaitionship with other players, choosed start race, place, units, role, this blueprint/class is also a place from where you want create menu widgets and HUD, to access them later after creation don’t forget store widget/hud reference into variable, so later you can simply use “get player controller” in blueprints (don’t know analog in C++) and get access to widget/hud
-
since you asked about RTS between actual playing level and main menu level also should be lobby level where host can specify game settings and player can connect
-
single player and multiplayer setup doesn’t differ really too much after proper multiplayer setup, single player will work like playing on host player alone (but without network activity when single player), here’s how achieve multiplayer setup - it’s just set of basic properties on right things, list below:
-% variable replication - it’s just a drop down menu when any variable selected in any blueprint editor (don’t know how setup it from C++, it’s up to you to find) and here are 2 types, just “replication” and “rep notify”, they’re the same, except “rep notify” have a specific function for each variable with such property and fire it on each client when this variable get replicated to allow manual flow control when things changed (for example you can use rep notify to file manual flow control when player offer ally to another)
-% actor blueprints replication and relevancy - replication just share actor’s inner properties (like position, rotation, material on mesh and so on) and not variables such blueprints can have, because each variable have separate replication property; relevancy is used to control flow in case when one player doesn’t know what happen to objects too far from him (probably it can be used to manage “fog of war” and hide units from player until his unis close enough on server to see them, you may heard about “maphacks” for RTS genre, so this hack usualy possible due wrong replication setup in other engines)
networking example on actor replication and relevancy from epics (and not only this topic) can be found here launcher->learn (scroll down to “Engine Feature Samples”, because there’re just docs link on top)->content example (click it and inside click download)->library (after download complete press “create project” on content example); after opening this project open level called “networking” from file menu (here are also other levels for other topics)
-% custom events - this is special type of events that can have several replication properie (only one type per custom event), to create one in blueprints i usually simply right click and select “add custom event”, how create it in C++ up to you to find, the propety in blueprints lay on left side in detail panel and called “Replicates”, it can have one value:
not replicated - this one fires only locally on each client and server;
run on server - this one used by clietns to ask server execute something (remote procedural call);
multicast - replicate this even from server to everyone else;
run on owning client - replicate this even from the server to owning client
their visual functionality can be seen in networking example of content example project;
-% function - “switch has authorty” it’s also various part of multiplayer setup, this function controll flow of execution and prevent doing things on clients when action must be performed by server only, can be used to implement one function which differently work on client and server
p.s. if you didn’t got idea on something various, try ask again after reading this, because your understanding may change and note i described common knowledges to properly setup multiplayer and some other thing, how you would implement final multiplayer/game up to you, same result can be achieved in different ways using this