Separate client/server prefabs

Options
Hello,

I'm currently trying to implement Bolt to my game, so far I've understand the basics, but I have two questions.

Until now I have separate client and server prefabs (the latter don't have any animations and/or audio) to save memory and performance.

How can I achieve this with bolt? Am I able to add the same entity state for both prefabs?

Is it possible to let the server set the unique bolt id?

Thanks!

Comments

  • stanchion
    Options
    I assume you are coming from uLink? There are no seperate prefabs for host and client in Bolt. You can do what you want by disabling animation, audio etc in the entity attach function. The unique entity id is randomly generated at runtime and cannot be set (could causes conflicts and desync)
  • silentneedle
    Options
    Yes, I come from ulink. So that also mean that it's required to use Bolt's Instantiation method, right?

    Phew, I thought this would be a little simpler. So that means you guys have for example one Character prefab with the bolt entity, character controller, motor, animator, audio, etc., etc. which you are disabling on the server with the entity attach override?
  • stanchion
    Options
    Yes, you can disable whatever you want on the host. If you can play as host or by yourself, I would have it check that you're playing in headless mode before disabling things. http://doc.photonengine.com/en-us/bolt/current/advanced-tutorials/headless-server
  • Yukichu
    Options
    Welcome silentneedle from the uLink wastelands!

    When I was doing uLink, I thought having separate prefabs for server/client was going to be great. It created a lot of confusion at times, issues, etc., but that's all personal preference.

    As for Bolt, you could either add components as needed depending on if server/client/proxy, or as Stanchion suggests disable what you don't need.

    My setup is a bit strange in that I have different projects for server/client, which Bolt doesn't officially support (but it works). On the clients, whether you are the client or not, I do a ton of different logic when the Entity is attached. I sent some information in the Attached token, including the player's name (since it should never change) and if it matches the client's name, you're the client, do all the client stuff, otherwise, do all the proxy stuff. Similar setup I'd think for server vs. client.

    I prefer adding as needed rather than disabling if not needed. Personal preference.
  • silentneedle
    Options
    Hey Yukichu,

    nice to see an old face again. :)

    It seems I need to code some workaround, as we use asset bundles to separate prefabs strictly from client/server, which worked very well so far. However, I think I'll just create some shared asset bundle with a very basic setup (probably only the bolt entity) and add the required stuff @runtime as you suggested. The only drawback I see here is that you're not able to set any pre-defines in the inspector, which was great for our designers.

    As for meta data, we've separated them completely from the unity workflow.

    I'm currently trying to implement bolt the same way you did, as I still require ulink for the lobby, zone spawning and p2p stuff.

    p.s. In the cheatsheet of bolt it looks like BoltNetwork.Instantiate isn't required to instantiate an prefab (#The heart of the BoltEngine programming model: The BoltEntity). It's noted that there are issues with this in 4.1.x. Has this been fixed already? Because we use object pooling to save some performance, I'm not sure if bolt does this too.