How to network a large map with 4000+ movable objects using Photon Unity Networking?

I was wondering if anyone here knows how I could go about networking a fairly large map with several thousand movable objects using Photon Unity Networking. The standard approach to networking a movable GameObject with Photon is to add a Photon View component to it, enabling you to send RPCs to move it. Unfortunately, I can’t add a Photon View component to each GameObject because, as far as I know, Photon limits you to a maximum of 1000 ViewIDs.

(Even if I could have more ViewIDs, simply adding a Photon View to thousands of movable objects doesn’t sound very efficient.)

Each object moves when it is hit by a ray, and so I’ve experimented with dynamically adding a Photon View component to each object when it is hit by a ray so I can send an RPC to move it, then destroy the Photon View component once it has moved. This, however, doesn’t seam to work.

The map isn’t very large, and it is possible for a player to see all of the movable objects at once, so I can’t disable things that are far from the player, for example. I presume that something like a multiplayer Minecraft clone would run into a similar problem, because it would need to somehow network thousands of dynamic blocks.

Perhaps someone with more experience in this area can shed some light on my situation. Any help would be much appreciated. Thanks for your time.

The concrete solution depends a bit on what exactly you need for your game.

Like you said, the simple approach with a script on each block isn’t very effective. They all run all the time to check if they got moved and each sends it’s info independent from the others.

Instead, you should turn this around: monitor what you hit. Come up with a way to identify each block and handle all the states of them in one script.

It sounds like you basically trigger a move and then are done with that block?

You can have a “map” for all blocks and when something is hit, you send that block’s ID, so any client can move it.

If players can join while the game is running already, you need to send them the current state (in best case, send only to the new player).

A minecraft-like game is using chunks of blocks to sync. A group of X tiles belong to one dtataset with coordinates. Per chunk, you would send a set of bytes to know which tile has which material.