Replicating a Procedurally Generated Map

Hi. Basically I’m making a tile system, using a grid and Instanced Static Meshes. The tile system works fine in single player, however when I do this in Multiplayer, this doesn’t replicate onto the client. I have attached an example of what is happening below. I just want to replicate the overall tiles and ISMs from here to all the players, but its a problem if the Procedurally generated map just isn’t there. Any support would be appreciated

Also, to clarify, the actor that generates the tiles is called BP_BasicGridSystem, and is placed into the level as a seperate actor, I set it to replicates but I’m sure its not as easy as that, and an RPC or generating a separate map for the client isn’t working either. Once again, I would appreciate any help.

So Good news and bad news. Good news is that the problem is with the ISMs. Instanced static meshes do not replicate. Bad news is that I have no idea how to set up my code to make it work for clients… Do I give clients their own version of this blueprint that replicates? I know for sure that the seed will be the same for everyone, but at the end of the day, the solution isn’t easy.

Hey im currently working on a random dungeon generator, which i feel is similar, so ill share my knowledge (Im not 100% sure with everything).
The way im doing it right now is having a blueprint that decides the placements of my rooms and hallways that is running only on the server (using authority switch right after the begin play node), and at the end it spawns actors with these rooms also only on server, and these blueprints are set to replicates, which also shows them on the clients (And also set to always relevant because there is default max relpication distance).
This works, but is probably not the best way to do it, as replicating something like floor feels not good.
A different thing i tried was running the first bp on server and then spawning the rooms separately on all clients using a rep notify custom struct variable (If im correct, when this variable is set, it will update on all of the clients and a function will play on all of the clients)(i used rep notify, because i read that using custom events set to multi-cast in begin play is bad).
This did work in a sense, that it spawned the correct rooms and hallways, but it broke when a client was trying to walk on them. From my research the movement replication in unreal sends to server the name (id or whatever) of the object the client is standing on, and because all of them were spawned separately on different clients, they are not “linked” together and the movement wont be replicated correctly. By default only the things, that u put into the level before pressing play and blueprints set to replicate are “linked”. (I think, im not sure about that, and also i didnt find a way to link them manualy).
And then there is level streaming. I didnt try that yet, but i found a tutorial on yt:

I plan on trying this when i get the time.
If you find any usefull information, let me know;).

Yo, sorry I didn’t manage to respond earlier, I actually found a solution, Turns out my code was slightly wrong. I was using a Vector2D named GridSize to alter the map’s height. Now what I did wrong was, I had this saved in the game mode and it pulls it from the gamemode by casting to it, but as you know, casting doesn’t work on that as the gamemode is server-based, so I saved it on the game-state, replicated it and then did a run on server to pull the gridsize and that worked, now that was half the problem, cuz the tiles were spawning now but each map was different, so to fix that, I created a seed on the gamestate and did the same thing, this pretty much fixed my issue, but yeah sorry I can’t help you as my characters don’t actually walk on the tiles, They are more for selection, I’ll show the end product once I’m finished in a few months, as it started out as a basic college project a week or so ago, and now I’m planning on turning this into a fully fledged game using only blueprints.

1 Like