Documentation:
- Bolt 101-102:
- When modify the font size of the button text, the center alignment of the text is lost. Code to change font size: [Bolt 102]
- private GUIStyle customButton = new GUIStyle(); // *** create a new variable
- void OnGUI()
- {
- GUILayout.BeginArea(new Rect(10, 10, Screen.width - 100, Screen.height - 50));
- customButton.fontSize = 30; // *** change the font size
- customButton.normal.textColor = Color.blue;
- customButton.hover.textColor = Color.blue;
- if (GUILayout.Button("Start Server", customButton, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)))
- {
- // START SERVER
- BoltLauncher.StartServer();
- }
- if (GUILayout.Button("Start Client", customButton, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)))
- {
- // START CLIENT
- BoltLauncher.StartClient();
- }
- GUILayout.EndArea();
- }
- Line 42 of Menu.cs needs to be updated: [Bolt 102]
- sceneToLoad: "Quad"
- Network - Server vs. Client vs. Connection: [Bolt 102]
- Server: A server is the connection that is hosting the game.
- Client: A client is normally anyone who is connected to the game who is not considered to be the Server. In short every remote connection from the Server is a Client.
- Connection: Within Bolt a connection is considered to be a link to another Client/Server over the network.
- Bolt 103:
- Bolt vs. Unity: [Bolt 103]
- Bolt.EntityBehaviour<T> class inherits from MonoBehaviour.
- Unity: Start(), Bolt: Attached(); Unity: Update(), Bolt: SimulateOwner().
- BoltNetwork.FrameDeltaTime property wraps the Unity Time.fixedDeltaTime property,
- Entity - Owner vs. Controller vs. Proxy: [Bolt 103]
- Owner: The creator of the Entity is the Owner. Bolt considers the one that Instantiates the object (through BoltNetwork.Instantiate()) to be the Owner of the created BoltEntity.
- Controller: An Entity that is controlled by either the server or a remote player. Both the Server and a Client can gain control of a BoltEntity. In most scenarios the Server will be the Owner so one will often read the Server is taking control and other clients are assigned control.
- Proxy: An Entity that is basically a dummy that is not locally controlled, he is only a replicated puppet. A BoltEntity is considered a Proxy in your connection/game if you're not the Owner or Controller.
- Movement Control by Arrows: [Bolt 103]
- if (Input.GetKey(KeyCode.UpArrow)) { movement.z += 1; }
- if (Input.GetKey(KeyCode.DownArrow)) { movement.z -= 1; }
- if (Input.GetKey(KeyCode.LeftArrow)) { movement.x -= 1; }
- if (Input.GetKey(KeyCode.RightArrow)) { movement.x += 1; }
- Bolt Tutorial 103 App: Execution file for Mac (Quad_103).
- Bolt 104:
- Global Senders and Entity Senders: [Bolt 104]
- An event in Bolt can be sent in two different ways: Globally or to a specific Entity.
- A global event will be received in the classes which inherits from Bolt.GlobalEventListener and can be sent freely without the need to have an actual Bolt Entity as the target.
- An entity event will be received only on the scripts which the entity is sent to and that inherit from Bolt.EntityEventListener.
- Create Events and Assign Properties: [Bolt 104]
- In Bolt you use EventName.Create(); to create a new event, you then assign the properties you want and call eventObject.Send(); to send it on its way.
- Change font size of displayed messages: [Bolt 104]
- public class NetworkCallbacks : GlobalEventListener
- {
- private GUIStyle customButton = new GUIStyle(); // *** create a new variable
- List<string> logMessages = new List<string>();
- void OnGUI()
- {
- customButton.fontSize = 20; // *** change the font size
- customButton.normal.textColor = Color.white;
- customButton.hover.textColor = Color.white;
- // only display max the 5 latest log messages
- int maxMessages = Mathf.Min(5, logMessages.Count);
- GUILayout.BeginArea(new Rect(Screen.width / 2 - 200, Screen.height - 100, 500, 200), GUI.skin.box);
- for (int i = 0; i < maxMessages; ++i)
- {
- GUILayout.Label(logMessages[i], customButton);
- }
- GUILayout.EndArea();
- }
- ......
- Inside a Bolt class (e.g., class CubeBehaviour), the order of the methods count! [Bolt 104]
- Bolt Tutorial 104 App: Execution file for Mac (Quad_104).
- Bolt 105:
- Objects and Arrays: [Bolt 105]
- Bolt supports built-in replication of complex types called Objects and Arrays.
- Objects are defined in the Bolt Assets window and can be used as the type for an Array or Object property on a state or another object.
- Objects gives you an easy mechanism to encapsulate a group of properties and allows you to implement complex hierarchical data in Bolt that is easily re-usable across different Bolt states.
- Bolt Tutorial 105 App: Execution file for Mac (Quad_105).
- Bolt 106:
- Download and import Robot package: [Bolt 106]
- From https://www.dropbox.com/s/zd9s77bv3u9wlxl/robot_sample.unitypackage?dl=1.
- Choose Assets in the Project window, and Ctrl-click > Import Package > Custom Package.
- Mecanim (State Wide): [Bolt 106]
- Using Animator Methods: If you are adding Bolt to a game that already exists and that's using the standard mecanim way of setting parameters on the animation controller it is best to leave this at the default and use the normal mecanim methods like animator.SetFloat and animator.SetBool to change the animator values.
- Using Bolt Properties: If you are building a new game with Bolt, use the Bolt state properties.
- Mixed Mode (WARNING): Some properties are set to Using Animator Methods and some are set to Using Bolt Properties. It is easy to cause confusion.
- Disable the Unused Parameters: [Bolt 106]
- Reason: Disable network replication for the Shot and AimWeight parameters, as these are controlled by curves inside of the animations and not directly by the user.
- Disable:
- Remove them.
- Set the Mecanim setting to Using Animator Methods and then Replication to Local for Each Player. This means that Bolt will read out the values from the curves and expose them in properties for you, but it will not send anything over the network.
- Setting Parameters of Bolt Entity for Robot: [Bolt 106]
- IPriorityCalculator Query - Use Global
- IEntityReplicationFilter Query - Use Global
- Remove 4 extra scripts at the beginning to get rid of errors.
- Bolt Tutorial 106 App: Execution file for Mac (Quad_106).



