How to tell if Bolt Assets on a client and a server are compatible?

Hi,

Is there any way the client can figure out its Bolt Assets (including states, protocol buffers, Bolt settings and ...) are compatible with a server assets? For example is there a version number or something that I can put in the session properties so that the client only look for session with matching version number?

Look forward to hearing from you.

Regards,
Aydin

Comments

  • Hello @Aydin

    Yes, you have a few options of static versions: "BoltNetwork.CurrentVersion" and "BoltNetwork.Version".

    You can use a custom property on your session to filter different versions of the Bolt SDK, and you can also use your own build version, from your game, in order to filter different versions to connect to each other, but that is up to you.

    Here you can see how to set/get custom properties on the session: https://doc.photonengine.com/en-us/bolt/current/in-depth/photon-cloud

    --
    Ramon Melo
    Photon Bolt Team
  • Maybe I asked a wrong question so I'll try to explain the issue:

    I was mostly looking for some kind of signature (in the form of a hash code for example) which is created from the current state of Bolt Assets in the project; This way I can tell from the signature value if things has changed on the Bolt Assets or not.

    The issue I am trying to address here is that a change from my perspective might not be a breaking one (i.e. the server is backward compatible) but for some reason it leads to incompatibility on the Bolt Assets (I provided an example further down). It would be great if I could tell (even before I publish the binaries) if my Bolt Asset's "signature" has change so that I bump the version my server and clients in a way that shows that and also consider it in my session search. At the moment I have to test the game in order to see if the server is backward compatible or not then change the version.

    I might be wrong and Bolt Assets are more resilience to changes than what I think but I believe I've seen situations where compiling Bolt assets which looked the same lead to incompatibility between the server and client; It might have been because I had played with Bolt states a bit for some experiments which required Bolt compile and although I made sure that the Bolt states looked the same as pre-experiments at the end the compiled Bolt Assets were different.

    Is it possible that Bolt Assets that look like each other have different kind of Bolt binaries? If the answer is yes the I think the signature I mentioned would be very useful.

    Regards,
    Aydin
  • Hello @Aydin ,
    I was mostly looking for some kind of signature (in the form of a hash code for example) which is created from the current state of Bolt Assets in the project; This way I can tell from the signature value if things has changed on the Bolt Assets or not.

    We don't have any kind of hash in this sense. You would need to build one for your game.
    Is it possible that Bolt Assets that look like each other have different kind of Bolt binaries?

    Mostly the order/names of the Bolt Assets will define their final output.
    You also need to consider that Bolt will create an ordered list of Bolt Prefabs, which may also be different even if you don't touch the Bolt Assets but create/remove/rename a Bolt Entity Prefab.
    The same rule applies to Scene in the Build Settings, as they are managed by index not by name, changing its order will also change how Bolt handles them on each build.
    When compiling, Bolt will assign a unique ID for each Asset (commands, events, states, and objects), so any change to them may lead to a different assembly in the end.
    If the answer is yes the I think the signature I mentioned would be very useful.

    So, in summary, yes, even if you have the same Bolt Assets, depending on the rest of your project, you may end with different Bolt Assemblies.

    As just a quick script, maybe you can use something like this to get a hash from your build:
    public static int GetBuildHash()
    {
    	var assembly = GetBoltUserAssembly();
    
    	if (assembly != null)
    	{
    		return assembly.GetHashCode();
    	}
    
    	return 0;
    }
    private static Assembly GetBoltUserAssembly()
    {
    	foreach (var asm in AppDomain.CurrentDomain.GetAssemblies())
    	{
    		var name = asm.GetName().Name;
    		if (name.Equals("bolt.user"))
    		{
    			return asm;
    		}
    	}
    
    	return null;
    }
    

    --
    Ramon Melo
    Photon Bolt Team
Sign In or Register to comment.