Search Unity

Photon Bolt

Discussion in 'Assets and Asset Store' started by ThePhotons, Dec 16, 2015.

  1. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    @RF008 there will be info on this very soon
     
  2. chasepettit

    chasepettit

    Joined:
    Oct 23, 2012
    Posts:
    42
    I'm considering purchasing Photon Bolt, but I'm a little unclear on this BoltPrefabs class. Can you not load prefabs from Resources or AssetBundles to use as an entity? If BoltPrefabs is just a static class storing a reference to every prefab, isn't that pretty inefficient in terms of memory use (in cases where a game may only use a portion at any given time)?

    It may be possible for me to just keep a set of skeleton prefabs that store just the essential components and load other elements of the prefabs from AssetBundles, but I'm just wondering if that's the expected or standard workflow. For instance, maybe having a Bolt prefab that represents a weapon, but loading the actual weapon mesh, textures, etc. from an AssetBundle.
     
    Last edited: Feb 27, 2017
  3. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    BoltPrefabs is not necessary to use, you can just implement IPrefabPool and handle it yourself.
     
  4. chasepettit

    chasepettit

    Joined:
    Oct 23, 2012
    Posts:
    42
    Ah. Thanks for the clarification.
     
  5. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    John-G and wahyuway like this.
  6. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Any matchmaking examples?
     
  7. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
  8. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    So I have to import both PUN and Bolt, just to access PUN's matchmaking? Am I understanding right?
     
  9. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    Nope, Photon Bolt comes with Photon Cloud integration. Search for the "PhotonMenu" scene in the package and see the readme next to it.
     
  10. Armands

    Armands

    Joined:
    Sep 29, 2012
    Posts:
    4
    You should add demo/limited version for Bolt like Forge did it. To test before buying it.
     
  11. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    Sounds like a great idea
     
    wood333 and hopeful like this.
  12. ivendar

    ivendar

    Joined:
    Feb 18, 2010
    Posts:
    242
    Hello :)

    I would like to request some more and actual tutorials and examples. For example I'm trying to find a good solution to change the position of a child object from a BoltEntity. In my case a sword being drawn and put from weaponslot1 to weaponhand and I can't really find any good examples about this. Have tried to ask in Bolt forums already but only got the tutorials linked I already know and which don't seem finished. But I don't think having to put each weapon on the character two times (2 slots as said) would be a good solution. Also creating a Entity for each weapon doesn't sound that good but it's better than having 150 objects on a character at the end because you can imagine what happens if you have 15 swords for example and each 2 times. Then axes, clubs and so on.. Examples only seem to work good for fps or very limited amounts of weapons. So any examples about a good way to solve such problems would be great.

    Also I got a bug from this example trying to transfer the username as IProtocoltoken

    https://doc.photonengine.com/en/bolt/current/reference/iprotocoltoken

    Line 27 is bugged for me and I got error that the userToken cannot be converted to IProtocolToken.

    BoltNetwork.Accept( endPoint, new LocalUserToken(userToken, System.DateTime.UtcNow.ToString()) );

    Is someone here who is willed to help a bit maybe ? What I have working at the moment is animations and connection without username.


    Bye
     
  13. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    For weapons you should make state callbacks that update the weapons present on the Player entity prefab. Entities should not have parents so multiple entities for this is not a good idea.

    Did you register the token?
     
  14. ivendar

    ivendar

    Joined:
    Feb 18, 2010
    Posts:
    242
    By updating you talk about deactivating one weapon and activating another in the other slot ? Or is there any way to use only one weapon object and somehow update the parenting info ? Cause I would like to prevent to have each weapon on the player all the time x2, even if disabled, exactly I want to have no weapon objects on the player at all if none are used and Instantiate them once I equip. If that's possible of course. However I really want to limit the usage of ressources as much as possible as the weapon is attached to empty object at bone and thus moved by animations . Having to create each weapon 2 times I end up having hundreds of objects on each player which I hope to prevent.

    About the connection yes I followed the example I linked to before. Registered at line 18 see first screenshot. Propably I might have missed something somewhere else maybe, but I can't seem to find out what it is. Attached some screens. Basically I can tell for sure it does check for the name if I just do
    instead because if the Inputfield is left empty it refuses the connection and it connects if some text is put in.

    But then it does not transfer the token as console shows Token:NULL
    And if trying to create the local token like in example it gives errror that convert of LocalUserToken to Bolt.IProtocolToken is not possible.

    Yeah would be great if someone could create some up to date tutorials series maybe. Or if someone reads this who wants to help and teach me a bit that would be nice.
    bolt-convert-bug.JPG
    bolt-usertoken.JPG
    bolt-start-client.JPG
    game-console-token.JPG
     
  15. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    You do not need to have every possible weapon present on the prefab, you can just instantiate the ones missing and call SetParent on the ones you want to move.

    Can you email your project with the token issue to support@boltengine.com ?
     
  16. ivendar

    ivendar

    Joined:
    Feb 18, 2010
    Posts:
    242
    Do I need to create a state including transform replication for BoltPrefab like I do for the player entity, so the weapons can use setparent or can it be left empty and will work as well ? What's the limit on the number of BoltPrefabs btw. ?

    I'm afraid my project folder is 13.2 GB atm and I have serveral 3rd party animations, a few models and playmaker included, which I use for the menu and movement. However nothing Bolt specific in those as all I do is mecanim parameter replication and SendMessage to do the button clicks which then fire the appropriate parts inside the scripts. I could send you the scripts I posted, do a Skype Screentransfer or Teamviewer Meeting so you can take a look if you like. It's just 6 small scripts and as said I followed the tutorial I linked and atm that scripts are nearly a 100% copy. Only difference is that I do the button click from playmaker but that part works and I don't refuse Dave as username but an empty username.

    Also I have not changed any of the other scripts included from Bolt.
     
  17. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    No, you can just have an integer for each weapon slot and on the callback update the prefab as I mentioned before. Do you mean limit of state properties?

    If you can make a new project with Bolt with this issue that'd be great.
     
  18. SiliconDroid

    SiliconDroid

    Joined:
    Feb 20, 2017
    Posts:
    302
    I looked at the bolt docs and couldn't find info regarding recent cloud relay/matchmaking integration. No worries, I realize docs are the last thing to be done after all battle hardening, otherwise you're just making loads of extra work as things change, been there!

    So... I'm writing a fairly simple client driven FPS game, my ideal solution would be networking that works pretty much as PUN already does with the added bonus of direct P2P connections, so in effect although I only have 100CCU for cloud relays I might have another couple hundred CCUs making P2P connections where ever possible.

    [Q1]
    Is the above basically how bolt now works, i.e. 100CCU in cloud account translates to >100CCU players thanks to P2P?

    [Q2]
    Do I need to host my own Zeus to enable P2P or will the cloud matchmaker do that for me now?

    [Q3]
    Are all operation modes fully connected: can 2 people in same house join game, their interconnect will be LAN and they are also playing with others on internet via cloud relay and/or P2P?
     
  19. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    Doc is here https://doc.photonengine.com/en-us/bolt/current/in-depth/photon-cloud

    1) I don't follow, every user that uses the cloud punchthrough and relay counts towards CCU.

    2) You do not need to do any hosting for Zeus

    3) Client do not connect to each other, they only talk to the host. The best connection is always attempted with punchthrough, but if that fails then it falls back to relay.
     
    Last edited: Apr 25, 2017
  20. SiliconDroid

    SiliconDroid

    Joined:
    Feb 20, 2017
    Posts:
    302
    OK, thanks for the info, yes I've seen that doc already. I'm basically wondering what max CCU I can achieve with Bolt in photon cloud mode.

    so to clarify my understanding:

    PUN+ and Bolt(when using photon cloud) both enable 100CCU max?

    The benefit that Bolt gives over PUN+ is reduced cloud bandwidth use as some P2P clients will only need to hit up the relay with keepAlives, being able to transfer game data via the host users connection?
     
  21. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    Both PUN and Bolt offer a 100 CCU 5 year license, beyond that there are plans for higher CCU.

    With PUN you will always use relay, while Bolt will usually connect directly using punchthrough.
     
    SiliconDroid likes this.
  22. MrG

    MrG

    Joined:
    Oct 6, 2012
    Posts:
    368
    I'm looking at buying Inventory Pro and Quest System Pro for use with Bolt in a multiplayer game, neither of which have networking built in, so would anyone be able to share some input as to whether I can make these assets work in an authoritative mode? Clearly there would be a SQL database on the server side to store everything and persist player state between sessions in their account. My question is more about getting ever-changing server data to the clients in real time on demand.
     
  23. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    I have made fully authoritative games with inventory but don't use those assets or SQL. You can use a state to sync the data from the host to the clients, and events for client to server action like moving or dropping an item.
     
    hopeful likes this.
  24. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    277
    When I press the Home button(not the Debug info/tab key) while working my way through the tutorial, it shows a window with info about the first entity the server has spawned. How do I make this window go away? Can I make it change entities? When I have this window open on the client, in the "Frame Info" there is a Diff value that says (Should be < 0) but it's always increasing until I switch to the server and move its cube. Is this normal? What does this mean? Is there more documentation about this window and the data it's displaying?
     
  25. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    Press home again with your cursor away from other entities. Yes you can just press home over another entity to change. The "diff value" is part of the "low level" part of Bolt and you can ignore it.
     
  26. ivendar

    ivendar

    Joined:
    Feb 18, 2010
    Posts:
    242
    I apologize for delay but I thought it would make sense to update everything to last version first and try again. I did so but problem not gone. Have created a new project with same error. Cause of size limit for email attachment I've uploaded it to pw secured webspace. Included the info in send mail to Boltsupport as requested.

    Unity version 5.6.0f3 (64bit)
    Bolt version 1.0.0.4 Debug

    Also is there need to use a CCU license later on or is that an optional service and people can still use Zeus or direct connection ?

    Thank you
     
    Last edited: May 4, 2017
  27. ivendar

    ivendar

    Joined:
    Feb 18, 2010
    Posts:
    242
    Is there maybe a user here who can help ? The support told me that my script is wrong which is actually their tutorial script. Now they updated the tutorial a bit but this line gives out a new error.

    Code (csharp):
    1. public class LocalUserToken : IProtocolToken {
     
  28. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    Will email you when doc is updated, it has some problems and could be more clear.
     
  29. ivendar

    ivendar

    Joined:
    Feb 18, 2010
    Posts:
    242
    I fixed that error message now by doing
    Code (csharp):
    1.  
    2. public class LocalUserToken : IProtocolToken {
    3.     public string username;
    4.     public string connectionTime;
    5.  
    6.     public LocalUserToken ( UserToken userToken, string connectionTime ) {
    7.         this.username = userToken.username;
    8.         this.connectionTime = connectionTime;
    9.     }
    10.  
    11.     public void Write ( UdpPacket packet ) {
    12.         packet.WriteString (username);
    13.     }
    14.  
    15.     public void Read ( UdpPacket packet ) {
    16.         username = packet.ReadString ();
    17.     }
    18. }
    19.  
    but if starting a game and entering a username the console still shows TOKEN: NULL

    Thank you, I think some updated tutorials that show a working example would be a great help.
     
    hopeful likes this.
  30. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,684
    Ugh. This was my concern. Coming back to Bolt after deciding to wait for the 1.0 release, I was wondering if the tutorials were up to date.

    Hopefully this gets priority treatment. Broken tutorials are an unpassable barrier for those of us trying to learn how to use it.
     
  31. ivendar

    ivendar

    Joined:
    Feb 18, 2010
    Posts:
    242
    Getting mecanim animations and the like working using Bolt is possible without bigger problems so the first tutorials work for sure but you have to watch steps as it easily happens to overlook to restart when installing or doing the compile step. So make sure to compile every time you change something.

    But those tokens people need for health, playername and the like yeah there I have problems. Up to date tutorials would be a great help for sure. If people got problems maybe it's also a good idea to talk to each other and share ideas and solutions.
     
  32. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,684
    Bolt has a long history of broken tutorials. It's tiresome. In the past this was due to the rapid pace of development and the basic workings changing as the plugin was developed. But we should be past that now that we're at v1.0.

    Either Bolt is stable enough to make a working tutorial, or it isn't.
     
    ivendar likes this.
  33. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    Bolt is stable and the docs are up to date besides the in depth tokens one referenced earlier. I plan on marking them with "tested on version 1.x" and "updated on this date" to make it more clear how up to date they are.
     
    hopeful likes this.
  34. ivendar

    ivendar

    Joined:
    Feb 18, 2010
    Posts:
    242
    Would be great if there could be a example with username check and saving+loading some data depending on it. Maybe location or health. Overall more tutorials showing something working would be good. Also can you give any ETA for the update on tutorials ? Unfortunately as it's now I'm stuck with the username problem.

    I also have another question regarding animations. Right now I use the mecanim replication which works fine. But I use some trigger parameter for starting swimming from Any State in the animator. But if a player joins while a player already swims of course that trigger isn't active / firing anymore and the player joining won't see any swimming animations for the players already in water. Also I cannot use the bool which is always active for swimming from Any State. So is there a good way to transfer the current active animation and transfer that to the joining player one time only ?
     
  35. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    The reference doc for Tokens is now updated.

    Your idea for an example with usernames and saving/loading may be good for a sample in the upcoming Bolt Sample pack here https://trello.com/b/1hELo6C9/bolt-sample-pack

    I would use a bool for swimming, it will only be sent once as states only send data when it changes.
     
    hopeful likes this.
  36. ivendar

    ivendar

    Joined:
    Feb 18, 2010
    Posts:
    242
    Wow those scripts have grown big in the example. Thanks for updating and taking a look.

    Well it's more kind of a mecanim problem if using a bool from Any State because then it's stuck at the start of the animation always as it would constantly repeat the connection. Could prevent that from Any State using 2 bools one firing short after the other to prevent connecting again but that would only allow to use a bool for the players already there and not really fix the problem as a trigger works too for players already connected. But not for players joining later. Of course direct connections from one State to another don't have that problem I'm aware of that so that might be the workaround. But it would also mean I would have to link tons of States to the Falling and Swimming if there is no other way to solve it for Any State. So that would be a cool extra feature for Bolt I guess to be able to read and send the current active animation as well as the parameters.

    And for the weapon animations it would still do the draw weapon animations first even if the weapon was already drawn by the player. Or is there maybe another trick I've missed ?

    Hm that trello site is confusing to me. Voting site for ideas only ? Not found any helpful tutorials or examples there yet. Or is an account needed maybe which I won't prefer as a solution then ? I would prefer tutorials as they are now plus maybe Youtube.
     
  37. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    Specifics of your mecanim setup such as drawing weapons will have to be handled by you, all Bolt can do is sync the properties across the network.

    The Trello has the list of upcoming samples, for example if you want a sample with saving and loading based off usernames you can post there. There is no tutorial for that at the moment.
     
  38. ivendar

    ivendar

    Joined:
    Feb 18, 2010
    Posts:
    242
    Yeah of course I have to do the mecanim setup myself and I did. But using Any State works for Singleplayer as well as for already connected players so my mecanim setup itself is correct. But if I cannot use a standard Unity feature as mecanim trigger parameter the way it behaves normally for reconnecting players with Bolt it's also kind of a Bolt problem as well or better said a feature desirable to be added. Or we could say Bolt is missing a feature to use 25% of mecanim parameters correctly for reconnecting users. Same goes for the weapon drawing example and same would be for people using combo attacks or anything else even if using bools. So no it's not just a problem of my mecanim setup but a request making sense for future versions to also be able to sync the current active state on connecting so people don't have desynced animations for a short time after joining. So yeah it's ok if not possible the way people are used to it but it would be good to also tell what's a good way to solve that kind of problems if you know one.

    So all I do is requesting support on how Bolt users are supposed to sync their players animations correctly if players reconnect while using a standard mecanim behavior. Right now for me it seems I have no way to make sure it's synced correctly from start on and will only start to sync animations correct after a short period of time once animations changed again.

    Also are you sure that tutorial works now ? For me it's still Token:NULL and not refusing connection when it should.
     
    Last edited: May 10, 2017
  39. ivendar

    ivendar

    Joined:
    Feb 18, 2010
    Posts:
    242
    Well if other people have a similar problem here's my solution for the Any State swimming using a bool. Create a separate layer for the swimming where you won't need to go from Any State to swimming but from a State without animation. So it won't fire all the time even if you have a bool and you won't need to connect every other animation to the swimming everywhere. However this propably still won't fix the issue if you use combo attacks or do a weapon drawing animation or something like that. There's still a delay always if best and nothing worse happens which I might not have thought about yet.

    Also this is a good example what I would have liked to see as support answer. Some workaround idea how to solve a propably common problem for reconnecting players. Well. I would be happy to get into contact with other people who try to get Bolt running properly so we can share ideas and knowledge to fix problems, as for the token problem I can't find a solution it seems, so maybe someone else knows.
     
  40. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    If you have a specific issue with a "mecanim delay" of some sort send a repro to support.

    The new version of the token doc has been tested top to bottom, and a working version of the example from the doc has been emailed to you.
     
  41. ivendar

    ivendar

    Joined:
    Feb 18, 2010
    Posts:
    242
    Ok. Checked everything again and found the problem. This was the change you did to fix the token problem I might have missed because before it was Read - ReadString and Write - WriteString and now it's:

    Code (csharp):
    1.  
    2.  public void Read(UdpPacket packet)
    3.     {
    4.         packet.WriteString(username);
    5.         packet.WriteString(connectionTime);
    6.     }
    7.  
    8.     public void Write(UdpPacket packet)
    9.     {
    10.         username = packet.ReadString();
    11.         connectionTime = packet.ReadString();
    12.     }
    It's now refusing a connection if Username is Dave so it seems to work. The Token:NULL info is still in console but seems to just show that the Network Entity which is spawned for the player doesn't have a token attached while it spawns and tokens are registered. At least I understand it that way.

    Also there's no sense to send a repro because everything is written here already and easy to replicate and if Bolt has no other way than using parameters to determine the active animation state there's only a workaround possible like I already did for the swimming trigger problem and a Mecanim Animator for Bolt has to be created a bit different than for a Singleplayer game for sure. As said you just need to create something like bool sword and on true going into a draw sword and after finish into weapon ready animation. Player then stays in weapon ready and if a new player reconnects next to that player he will first see the drawing animation as well even if the weapon was already drawn. So that's a delay which would happen and only for a player connecting after another player aleady changed animation state. But I won't do a repro with that as it's waste of time as you tell me I would have to change my mecanim animator either and yeah I propably would have to add a second bool check to solve that problems which I will do. It's not really comfortable like in standard Unity mecanim animator but at least it's a workaround.

    More and better tutorials still a good idea I think.
     
    Last edited: May 11, 2017
  42. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    Every mecanim setup is unique, some developers have sent me very strange issued that are caused purely by just the way they set it up. In the case of wanting to avoid a transition, you can either setup your mecanim to only do that animation if a specific variable is met in addition to the normal one, or make a state callback that calls Animator.Play().
     
  43. ivendar

    ivendar

    Joined:
    Feb 18, 2010
    Posts:
    242
    Well it's not really a strange setup as it works fine for Singleplayer and players already there and follows a way many tutorials teach. It's just with the players connecting later. But yeah there's propably serveral ways of doing animator transitions so another might work better as you mentioned and I will try.
     
  44. ivendar

    ivendar

    Joined:
    Feb 18, 2010
    Posts:
    242
    Got another question about
    https://doc.photonengine.com/en-us/bolt/current/reference/state-replication

    I found the joystick symbol but if I click it nothing happens and it's still greyed out. Does this need anything else to be set to work ?

    Actually what I need it to do is spawning the entity as a server, giving control to a connection and then replicate the animator parameters the controller sets over the network. Is that possible with the standard mecanim parameters and Bolt or does Controller always need to be Owner as well ? Or does it just have to do with the mentioned joystick symbol. Tutorials old on this as well so some newer info appreciated. What's happening right now is controller works for server and replicates but not for clients having only control but not ownership. All my controller does is to set the mecanim parameters.
     
  45. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    You can just select the replication setting you want.

    Replication never happens from nonowner to owner, see the tutorial for an example of spawning entities as server, assigning control, mecanim, etc.
     
  46. ivendar

    ivendar

    Joined:
    Feb 18, 2010
    Posts:
    242
    Ok thanks for the info. But you would still need to activate that joystick symbol to be able to send to the controller too or is that info old and thus wrong (was version 0.4+) ? Because I cannot click it to be active.
     
  47. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    I assume it means to "enable the joystick" by selecting the corresponding replication mode.
     
  48. romatallinn

    romatallinn

    Joined:
    Dec 26, 2015
    Posts:
    161
    I read the official tutorials and there is such structure:
    Code (CSharp):
    1. state.parameter = value;
    Where state is Bolt state. However, all parameters are get only. So this does not work.

    The player is instantiated by server. Thus, server is owner of all players, but it gives the control to the clients (system is from advanced tutorials).

    I need to assign the state values (which is derived from the animator's methods) by controller (client) and read by owner (server).

    I have read the tutorials, but I still do not completely understand how to handle this.

    Code (CSharp):
    1.     public override void SimulateController ()
    2.     {
    3.         float key = Input.GetKeyDown (KeyCode.P) ? 1.0f : 0f;
    4.         animator.SetFloat ("speed", key); // I want to assign value by controller (client)
    5.          
    6.     }
    7.  
    8.     public override void SimulateOwner ()
    9.     {
    10.         if(state.speed != 0)
    11.             BoltConsole.Write (state.speed.ToString()); // I want to read value by owner (server)
    12.  
    13.     }
     
    Last edited: Jun 2, 2017
  49. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    If you are "server auth" you need to use commands to send your input from client to server. Otherwise your clients should own their own players.
     
  50. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,684
    @Stanchion - A small note about the Bolt advanced tutorial ... I guess at some point after docs were written it went into its own namespace, so the code examples (like on p. 2) ought to be updated to reflect this (otherwise they compile with errors).