hello to all, to what i know, level streaming… is loading and unloading levels / portions of the map where the player is near to improve performance…
i was wondering, if a level is not loaded, and there are ai bots moving there / doing things there… would they function?
i mean, if the ai bot is going to point a to b, and the level unloads because the player goes somewhere farther… would the ai bot finish it’s task?..
i am trying to make something that has moving ai bots that i cant afford to disable, i need them to be always there…
and having level streaming, would really help performance, i was wondering about this thing… :o
i see, what if in the persistent level, all of my moving characters / ai are there…
so if some of those are going to a level that is streaming, then disabled, what would happen to the ai?..
That’s the least helpful thing you could have posted bruno…
I also need a solution to this. I need to be able to spawn and unspawn AI based on the level they are present in.
So if a player is in a level moving around, then for whatever reason that level unloads, the bots location needs to be stored in memory so that when that level streams back in, they are in the same position.
Keeping the AI in the persistent map would be fine, but if the level unloads, the AI will just fall to the kill Z. Also, if your world is bigger than the 20km maximum level limit, I imagine you would run into issues. AI being so far away from 0,0,0. This is why I think for large worlds with world position offset, it would be much more suitable to keep the AI’s position saved in the steamed in levels themselves.
Games usually spawn AI agents only when the level is loaded / has players in the area.
I don’t know what the mystery is in this… If the level isn’t there, kill the the agent and only spawn them within persistent levels.
Removing a level while there’s agents in there or having active agents while there’s no players around to interact with them (or no level to hold them) is bad decision and design;
@, that’s really what i was trying to achieve.
Having the bots/AI to be stored when the player is far, so when the player comes back,
it would create an illusion of AI has been doing something while the player is away.
trying to achieve it with level streaming so it could improve performance…
but, the same with you, i don’t know how to proceed… yet…
would appreciate if someone who have an insight on this to share idea / logic on it…
Although I have not messed with AI myself, you could probably make an array of characters of that particular level stream and store that in your persistent level just before the event is called to unload the level stream. Then once the level is loaded again you can use a “For EachLoop” and set the variables like health and position again.
I have recently come across this question myself whilst exploring the data streaming capabilities of UE4, I’m posting this in case somebody else comes across this thread one day.
For the specific scenario that you are describing, he provides the following two recommendations:
1 - Rather than unloading the level where your AI agents are working, turn off its visibility, as it seems that logically your game design still wants that level existant in memory (for the case that your AI agents are interacting with their environment whilst the player is somewhere else in the game).
2 - You could maintain a persistent collision base for the world, so that even if the streamed level the agents are traversing has been unloaded, you have the consistency that they won’t fall off the world, however, this does mean that their interactions are limited to movement only, as unloading the level they are contained in will destroy the objects they could interact with.
What I would personally do is simulate ai interactions in the persistent level, then, when the streamed level containing the ai is constructed, use the properties produced by the simulation to initialize the AI.