I’m currently working on a co-op game where players can play multiple missions and campaigns, each with their own unique maps, objectives, and enemy setups. There’s also alot amount of player freedom when it comes to loadouts (weapons, equipment, etc)
Right now, the only way I can think of to handle missions is to create a place for each one. The problem is this is super inefficient. It’ll just be really hard to add or maintain stuff. I was wondering if it was possible to have all missions and campaigns (and their associated assets, scripts, etc) to be packed into a single place to keep it clean and way easier to manage.
Is it possible to do something like this efficiently without things like performance issues? And how would you make it so that the game knows what mission the lobby chose?
You can use packages. Which is an object the you can update in one place, then it will update all places.
I do think having it all in one place is better. Just put everything in replicated storage, then pull out what you need for a mission.
(I’m pretty sure this is what doors does.)
Oh so I’m assuming players in the lobby pick a mission, then get sent to a different place that is supposed to handle loading that mission. Well you can store all of the maps in replicated storage and just put the one you need in workspace when the players join. And you can pass the mission that the lobby chose by including it in the TeleportOptions of the party leader via TeleportOptions:SetTeleportData and then retrieving it via Player:GetJoinData or TeleportService:GetLocalPlayerTeleportData. You can also use MemoryStoreService or MessagingService to pass data to other servers, that would be overkill though; also the latter might not even be applicable here.
Once you successfully pass the name of the mission the players chose to the target server, just load in the map and start the mission from there.
1 Like
This can work, but I just need some clarification. Won’t the hundreds of unneeded mission assets in replicated storage impact performance? If it does, can you prevent it by just simply deleting them? It sounds kinda dumb but I’m just wondering
yea you can just delete them if you want. You can also instead store them in server storage and now it will only impact the server a bit. They aren’t in workspace, so they do not need memory for rendering or physics, just existing. The client won’t be impacted at all since the data isn’t even replicated. If you want you can delete them but that wouldn’t really need to be done, unless you have an astronomical amount of assets, so many that the server can’t store them, but I doubt that.
1 Like