There is this few sentences in the docs about Level Blueprints:
"Each game can specify the default Level Blueprint class in the DefaultGame.ini config file. The Level Blueprints for all new maps will be created using this class allowing for game-specific additions and functionality. "
However, when I open that config file there is no such thing as Level Blueprint that I could change. Do I need to type in something manually? If so, what?
Any help would be appreciated, hope I will have better luck here than on AnswerHub.
Just open the project settings in the editor and go to Maps and Modes on the left, you can set the default editor map that loads as well as the game default level.
Well I was aware of that setting, so it seems like I misunderstood the whole thing, or I wasnât clear enough with my question. The settings in the Maps&Modes tab only allow me the set the default level of my game and the editor, which is not what Iâm currently after.
I thought that throught this I can set a Default Level Blueprint and every new Level Blueprint I create will inherit from this, keeping all the variables and functions of the default one, allowing me to add more funcionality for each level. Would this be possible?
Okay, that clears it up a bit, thanks for the heads up.
However I am not sure how I could implement my idea then. Basically I have a few maps/levels with 6 different spawpoints in each. I want to build a system that puts every player to a randomly selected spawpoint at the begining of each level. Do I implement it in the Game Mode then with setting up âXX Map Loadedâ Events for each map, and I connetct these events to the same system?
For spawn points i created custom blueprint that is BP_Spawner.
All it has is mesh that is visible only in editor and has no collision.
Then in game state at begin play i do âGet all actors of classâ (that is bp_spawner)
Get thier world locations , and randomly spawn players in one of them.
You also have player start actor, it works fine in singleplayer, but for multiplayer i think it needs session setup.
Thanks for the answer Nawrot, now I have a clear idea about the approach.
May I ask what parent class did you use for the Spawner? I guess a simple Actor will do the job, just want to be sure.
Also, if I implement my ârandom spawnpoint selection systemâ in the Game Mode, I just use a Level Loaded Event and connect each of my levels to the spawpoint system?
But can the game state run code for each streaming level or just the persistent level. The reason everybody is asking for level BP parenting is because we want to implement functionality to run on every one of our levels, streaming levels or not. Basic stuff that is absolutely necessary for most games. Why the limitation on level blueprints is an absolute mistery.
All that mess and limits are for two very simple reasons:
object oriented programming (to load and run child you need load and run parents code, and those chains may be really long)
and anything to run it needs to be loaded
Streamed levels are not guaranteed to be loaded, so there are limits of what can do what. And kicker is, due to that object oriented setup (and fact that something must be loaded first) You never know if other actors are loaded when you execute constructor or begin play.
And then on top of that all you have two different hardware systems, each with its own copy of engine. And then you are trying to replicate and load it all like it was commodore64 game.
I think best way to avoid all that mess is event driven setup. Evey actor in game is independent and listens to some events. Default settings can be loaded from data asstes. However I did not tried yet to code complicated game like that.
Have you tried this only in editor or also in standalone and then cooked games? Because i seen differences between actors loading order.
I battled your problem, and only real solution to be sure game will work in all forms, is to make single actor that loads first. Then build everything else assuming that everything else loads in random order. That and use data assets/tables for storing default values, instead of reading something from another class (that is loaded or not).
Thanks. I havenât tried cooked build with this yet. I thought the game should behave the same as you see in editor, otherwise this is insane: you do things one way, only to see they run in a different way, in cooked. Lol, might as well move to Unity and save myself the mental asylum bill.
Doesnât work in my case, I need to hand place many actors in the level.
Havenât thought about data tables, thanks for that.
Yes this is insane, editor âhelpsâ you (the developer) by keeping all things working together during development, but standalone/packaged game does not care. Also in editor most things are loaded when you open project, in game not so much.