Shared Code Base For Multiplace Games

As a Roblox developer, it is currently too hard to share code between places in multiplace games.

I would like to be able build a multiplace game in which each place is just a different map/level of the same game. For example, the starter place could be the starter map, then place 1 could be a desert map, place 2 could be a forest map, etc. So in any place that you are in, you are essentially playing the exact same game.

In this scenario, the starting placing and all other places would share the same game code, so that the same game runs in every place.

If Roblox is able to address your issue, how would it improve your game and/or your development experience?

There are ways to do this currently, but they are tedious and prone to error. To most common technique seems to be to save your starter place as a model, and then have all the other places load that model in. But it gets tricky, since all the assets need to be loaded before you can load the characters, and do other things.

Instead, we need a much easier system to share code. Maybe something as simple as a checkbox in the place that says: “Use code from starting place”. Or perhaps you can think of a better way for multiple places to share a common code base.

If such a system was available, it would be far easier to build larger game worlds in which multiple places expand the game world.

10 Likes

There is a feature called Universe scripts on the road map for this year. That might be what you’re looking for.

2 Likes

Yes, I saw that and submitted a documentation request, since there is no detailed description of what it does.

You can currently port all your Scripts to ModuleScripts, save them as models and use a single script to simply load in the ModuleScripts from the site, using their asset IDs. Alternatively, you can use the LinkedSource property of Scripts and LocalScripts - right-click on one to save it as a new LinkedSource (which I believe does transfer between places in a game), and then you can set any other Script/LocalScript to fetch that.

I think the universe scripts feature is meant more for matchmaking and meta-stuff, i.e. stuff you’d want to handle outside of a place for whatever reason.

Packages would also help as well.

1 Like

Yes, but this method is somewhat tedious and prone to error. Every time you change one of the scripts, you have to export it to a model, and remember to overwrite the proper existing asset ID. Doing this over and over, every time a game update is needed becomes tedious and error prone.

I am thinking there should be an easier way to do this. It is a pretty fundamental use case in that different game levels need to share the same code base.

1 Like

LinkedSource solves your issue.

You can update models there’s no need to make a new one every time

2 Likes

LinkedSources are good, but I think a better solution is to have a shared ‘instance’ base. This will allow things such as GUIs, decals, scripts, models, instances and their descendants to be shared across places instead of just certain asset types.

The last time I used LinkedSources, they were also rather buggy, and just feel risky to use in general.

4 Likes

Its not released yet. So there really is no documentation to be made until its ready for testing/production.

1 Like

I do not recommend using LinkedSources.

1 Like

LinkedSources are fine as long as you have local backups.

1 Like