From 7db2fef5ab67084c1bb26c570f7689e75fa01e92 Mon Sep 17 00:00:00 2001 From: mickymadfree Date: Mon, 18 Sep 2017 20:13:37 +0000 Subject: [PATCH 1/9] Update 01-GettingStarted.md --- text/01-GettingStarted.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/text/01-GettingStarted.md b/text/01-GettingStarted.md index 5ba65ed..4167010 100644 --- a/text/01-GettingStarted.md +++ b/text/01-GettingStarted.md @@ -64,7 +64,7 @@ Alas, with the collapse of the Internet bubble and some other unfortunate circum ### Blender Rises Located in beautiful Amsterdam, the Blender Foundation now oversees the development, distribution, and marketing of Blender. But because of the open source nature of the software, its development has been driven largely by volunteer contributors from across the world. -The Blender Foundation also created the Blender Institute, an animation and game studio that focuses on movie and game development using Blender. The Institute produced the movies _Elephants Dream_, _Big Buck Bunny_, _Sintel_, _Tears of Steel_, Cosmos Laundromat and the game _Yo, Frankie!_ These projects serve two main goals: The production process is an opportunity to improve Blender in a real studio environment, and the end result also serves as an advertisement for the software itself. +The Blender Foundation also created the Blender Institute, an animation and game studio that focuses on movie and game development using Blender. The Institute produced the movies _Elephants Dream_, _Big Buck Bunny_, _Sintel_, _Tears of Steel_, _Cosmos Laundromat_ and the game _Yo, Frankie!_ These projects serve two main goals: The production process is an opportunity to improve Blender in a real studio environment, and the end result also serves as an advertisement for the software itself. ![Top: Elephants Dream, Big Buck Bunny, Yo, Frankie!, Bottom: Sintel, Tears of Steel, Cosmos Laundromat](../figures/Chapter1/Fig01-02.jpg) @@ -128,12 +128,13 @@ The knowledge in this section is universal and applies to all other 3D applicati ### Coordinate System The three axes illustrated + We live in a three-dimensional world that has width, height, and depth. So to represent anything that resembles real life as a virtual world inside a computer, we need to think and work in three dimensions. The most common system used is called the Cartesian coordinate system, where the three dimensions are represented by X, Y, and Z, laid out as intersecting planes. Where the three axes meet is called the _origin_. You can think of the origin as the center of your digital universe. A single position in space is represented by a set of numbers that corresponds to its position from the origin: thus (2, -4, 8) is a point in space that is 2 units from the origin along the X axis, 4 units from the origin along the -Y axis, and 8 units up in the Z direction. ### Points, Edges, Triangles, and Meshes -Although we can define a position in space using the XYZ coordinates, a single point (or a "vertex," as it's more commonly known in computer graphics) is not terribly useful; after all, you can't see a dot that is infinitesimally small. But you can join this vertex with another vertex to form a line (also known as an "edge"). An edge by itself still wouldn't be very visible, so you create another vertex and join all three vertices together with lines and fill in the middle. Suddenly, something far more interesting is created[md]a triangle (also known as a "face")! By linking multiple faces together, you can create any shape, the result of which is called a "mesh" or "model." Figure below shows how a mesh can be broken down into faces, then edges, and ultimately, as vertices. +Although we can define a position in space using the XYZ coordinates, a single point (or a "vertex," as it's more commonly known in computer graphics) is not terribly useful; after all, you can't see a dot that is infinitesimally small. But you can join this vertex with another vertex to form a line (also known as an "edge"). An edge by itself still wouldn't be very visible, so you create another vertex and join all three vertices together with lines and fill in the middle. Suddenly, something far more interesting is created[md]?a triangle (also known as a "face")! By linking multiple faces together, you can create any shape, the result of which is called a "mesh" or "model." Figure below shows how a mesh can be broken down into faces, then edges, and ultimately, as vertices. ![Teapot, cube, face, edge and vertex.](../figures/Chapter1/Fig01-06.jpg) From a01edc67eb0e7d78969bd4039c8cb7709fc44bdf Mon Sep 17 00:00:00 2001 From: mickymadfree Date: Mon, 18 Sep 2017 21:53:49 +0000 Subject: [PATCH 2/9] Update 02-FirstGame.md --- text/02-FirstGame.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/text/02-FirstGame.md b/text/02-FirstGame.md index 7934815..8c53a02 100644 --- a/text/02-FirstGame.md +++ b/text/02-FirstGame.md @@ -105,7 +105,7 @@ For appending part of another blender file click on File > Append (Shift + F1). >- You can use thumbnails to find some datablock types easier. Before using this feature, use File > Data Previews commands to generate thumbnails for datablocks (like materials, textures, ...). >Shape keys animation. -The difference between linking and appending is what happens after you bring the new data into your file. If you append a file - let's call it _library_-the new elements will keep no reference to the original library file. You can literally delete the library file, and it will not result in any changes in your work file. That also means that any change you do in your library file will not be synced back into your working file. +The difference between linking and appending is what happens after you bring the new data into your file. If you append a file - let's call it _library_ - the new elements will keep no reference to the original library file. You can literally delete the library file, and it will not result in any changes in your work file. That also means that any change you do in your library file will not be synced back into your working file. If you want to keep the files in sync (and you do most of the time), you then need to set "Link" while importing the library file. By doing this, you will not be able to edit the file in your working Blender file. Instead, you need to go back to your library file, change it, save it, and then open the working file again. @@ -115,9 +115,9 @@ You don't simply dump the whole Blender file inside yours. Instead, you can navi ## How to Use the Chapter Files -On the Book files, you can find the complete game(exercise) in the folder Book/Chapter02/game/_final/. +On the Book files, you can find the complete game(exercise) in the folder Book/Chapter02/game\_final/. -For simplicity's sake, we will use Blender relative path syntax to refer to the files inside this folder. In this case // refers to the base folder and //interface/score.blend stands for Book/Chapter02/game/_final/interface/score.blend. +For simplicity's sake, we will use Blender relative path syntax to refer to the files inside this folder. In this case // refers to the base folder and //interface/score.blend stands for Book/Chapter02/game\_final/interface/score.blend. To play the game inside Blender, open the file game.blend. This file is only a part of the game and depends on the external files that are organized as: @@ -133,13 +133,13 @@ To play the game inside Blender, open the file game.blend. This file is only a p To follow the progress of the instruction steps, we have other folders. Copy the whole folder onto your computer to work from there. These are the folders we will be using: -- **Book/Chapter02/game\_my** -The semi-empty folder structure to be filled as you advance in the chapter. +- **Book/Chapter02/game_my** - The semi-empty folder structure to be filled as you advance in the chapter. -- **Book/Chapter02/game\_progress** -The same folder structure but filled with files of different snapshots. Every file is named after the original name plus a progress number-for example, game.1.blend, game.1.blend, //assets/shark.8.blend. To use them, you need to rename the file to the original name and copy to the right folder in "game\_my" folder. +- **Book/Chapter02/game_progress** - The same folder structure but filled with files of different snapshots. Every file is named after the original name plus a progress number-for example, game.1.blend, game.2.blend, //assets/shark.8.blend. To use them, you need to rename the file to the original name and copy to the right folder in "game_my" folder. -- **Book/Chapter02/game\_final** -The final as of the end of this exercise; use for reference. +- **Book/Chapter02/game_final** - The final as of the end of this exercise; use for reference. -- **Book/Chaper02/references** -Files to support the making of the game. +- **Book/Chaper02/references** - Files to support the making of the game. For the rest of the chapter, we will refer to the files from your //game\_my/ top folder. @@ -152,7 +152,7 @@ We will model the outline of the shark based on reference images. To set up your 1. Split your 3D view into four views (Ctrl+Alt+Q). -2. Open the 3D view Properties panel (N)-remember that the mouse needs to be over the 3D view in order to call the commands for it. +2. Open the 3D view Properties panel (N) - remember that the mouse needs to be over the 3D view in order to call the commands for it. 3. In the bottom of the panel, you will see the Background Images option. Turn it on. From a48f4d19821613193fd07531fa1585db478852f6 Mon Sep 17 00:00:00 2001 From: mickymadfree Date: Sun, 8 Oct 2017 00:27:38 +0000 Subject: [PATCH 3/9] Update 02-FirstGame.md --- text/02-FirstGame.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/text/02-FirstGame.md b/text/02-FirstGame.md index 8c53a02..cc3120f 100644 --- a/text/02-FirstGame.md +++ b/text/02-FirstGame.md @@ -192,7 +192,7 @@ With the arcs selected, you can grab them and move around (G). When necessary, y ![3D View header(Blender Foundation)](../figures/Chapter2/Fig02-07.png "3D View header") -At this point, you can start exploring the top view as well. For quickly switching to top view, use NumPad7 or toggle quad view on and off. Sometimes you need to transform the geometry only in one axis. In Figure 2.8, you can use the handler to pull if you want to move an edge in a specific axis. You can also use the keyboard for that. To restrict the transformation, press X, Y, or Z after the command and slide in the specified axis. Shift+X, Y, or Z works in the opposite way. It locks the transformation for the opposite axis (so you can only move/scale/rotate in a plane). This is really useful-we use G with Shift+Z all the time. +At this point, you can start exploring the top view as well. For quickly switching to top view, use NumPad7 or toggle quad view on and off. Sometimes you need to transform the geometry only in one axis. In Figure 2.8, you can use the handler to pull if you want to move an edge in a specific axis. You can also use the keyboard for that. To restrict the transformation, press X, Y, or Z after the command and slide in the specified axis. Shift+X, Y, or Z works in the opposite way. It locks the transformation for the opposite axis (so you can only move/scale/rotate in a plane). This is really useful - we use G with Shift+Z all the time. ![Locked axis transformation(Blender Foundation-Art Cengage Learning)](../figures/Chapter2/Fig02-08.png "Locked axis transformation") @@ -217,9 +217,9 @@ Additionally, an advanced resource is to add custom Transform Orientations. This Because the Mirror Modifier has both "Merge" and "Clipping" options turned on, the extrude will not simply be constrained to the normal (the axis perpendicular to the face) initially. Instead, the extruded face will be locked to the normal, but half of it will be locked in with the mirror plane. Therefore, it will behave as if locked vertically (Z axis). -To save time with the modeling, we will add a head from the built-in meshes in Blender. While in the Edit mode, go to the Add Mesh menu (Shift+A) and choose Monkey. You will need to scale (S), rotate (R), and grab (G) it to make it match the reference image. And they match perfectly-what a happy coincidence. +To save time with the modeling, we will add a head from the built-in meshes in Blender. While in the Edit mode, go to the Add Mesh menu (Shift+A) and choose Monkey. You will need to scale (S), rotate (R), and grab (G) it to make it match the reference image. And they match perfectly - what a happy coincidence. -You will need to remove some faces from the neck to connect it with the top part of the body. To delete faces, use the X key. This will bring up the menu shown in Figure 2.11-pick your option wisely. To connect vertices and edges, use the F key. (They need to be selected, and no more than what can fit in a face.) +You will need to remove some faces from the neck to connect it with the top part of the body. To delete faces, use the X key. This will bring up the menu shown in Figure 2.11 - pick your option wisely. To connect vertices and edges, use the F key. (They need to be selected, and no more than what can fit in a face.) ![Delete menu(Blender Foundation)](../figures/Chapter2/Fig02-11.png "Delete menu") @@ -238,11 +238,11 @@ Before we start, go to the Modifiers panel and apply the Mirror Modifier. If you To start creating a UV texture, you need to switch to Edit mode and call the UV Mapping menu (U). This menu has different mapping options. We will be using the first one, Unwrap, which is a semi-automatic way to calculate the optimal stretching for the 2D texture. The result can be seen and edited in the UV/Image Editor. -In the Editor menu, click Image > New, and in the pop-up menu, set UV Test Grid and confirm. This will produce a sample image where you can check in the 3D model as to how stretched the map image (texture) will be, once it is re-projected onto the shark model. If you look at Figure 2.13, you should spot a problem with the default unwrapping: the image on the side of the shark is too stretched and does not have enough resolution. While the shark tail has a high resolution, that doesn't correspond to its need (the tail is small after all)-the smaller the squares of the UV test grid, the higher the pixel-per-face ratio. +In the Editor menu, click Image > New, and in the pop-up menu, set UV Test Grid and confirm. This will produce a sample image where you can check in the 3D model as to how stretched the map image (texture) will be, once it is re-projected onto the shark model. If you look at Figure 2.13, you should spot a problem with the default unwrapping: the image on the side of the shark is too stretched and does not have enough resolution. While the shark tail has a high resolution, that doesn't correspond to its need (the tail is small after all) - the smaller the squares of the UV test grid, the higher the pixel-per-face ratio. ![Bad default unwrapping(Cengage Learning)](../figures/Chapter2/Fig02-13.png "Bad default unwrapping") -To solve this problem, go to the 3D view and select the edge loop that splits the side-swimmer from the body. With this "ring" selected, go to the Edge menu (Ctrl+E) and select Mark Seam. Now redo the UV Mapping  Unwrapping, and you will have a more distributed stretching along the mesh. This can be seen in Figure 2.14 and in the file //assets/shark.5.blend. +To solve this problem, go to the 3D view and select the edge loop that splits the side-swimmer from the body. With this "ring" selected, go to the Edge menu (Ctrl+E) and select Mark Seam. Now redo the UV Mapping > Unwrapping, and you will have a more distributed stretching along the mesh. This can be seen in Figure 2.14 and in the file //assets/shark.5.blend. ![Final UV mapping(Blender Foundation-Cengage Learning)](../figures/Chapter2/Fig02-14.png "Final UV mapping") @@ -268,7 +268,7 @@ In order to make the shark swim, we need an armature with bones. Similar to real The base file is here: //assets/shark.6.blend -The first thing to do is to add an Armature object (Shift+AArmature). It's important to have the armature center at the "center of mass" of the shark, which happens to be the right place for the shark mesh origin as well. (In our case, it's in the center of the scene at coordinates [0,0,0]). To make sure you got this right, in the 3D view look at the big dot representing the center of the shark or try to rotate it using its center as pivot. If the center is slightly above the side-swimmers and centralized in the short side of the shark, you are good to go. Otherwise, you need to reset its origin with the Shift+Ctrl+Alt+C option: +The first thing to do is to add an Armature object (Shift+A > Armature). It's important to have the armature center at the "center of mass" of the shark, which happens to be the right place for the shark mesh origin as well. (In our case, it's in the center of the scene at coordinates [0,0,0]). To make sure you got this right, in the 3D view look at the big dot representing the center of the shark or try to rotate it using its center as pivot. If the center is slightly above the side-swimmers and centralized in the short side of the shark, you are good to go. Otherwise, you need to reset its origin with the Shift+Ctrl+Alt+C option: 1. Move the 3D cursor to the approximate location (or to skip the next step, put it in [0,0,0] or use Shift+C). @@ -277,9 +277,9 @@ The first thing to do is to add an Armature object (Shift+AArmature). It's im 3. Set Origin > Origin to 3D cursor. -With the 3D cursor in the center of the object, add the armature (Shift+A). In the Edit mode of the armature, select this bone (A or RMB on it) and move it [nd]1 unit in Z. Now the tail of the bone is in the center. The tail is the small extremity of the bone, opposite to its head. This will be our root bone, the one bone that controls all the others. +With the 3D cursor in the center of the object, add the armature (Shift+A). In the Edit mode of the armature, select this bone (A or RMB on it) and move it -1 unit in Z. Now the tail of the bone is in the center. The tail is the small extremity of the bone, opposite to its head. This will be our root bone, the one bone that controls all the others. -With the 3D cursor still in the center, add a new bone (Shift+A). Select this bone tail and move (G) it until it matches the mouth location, as you can see in Figure 2.15. Now select this bone and the root bone and parent them without linking them (Ctrl+P  Keep Offset). This way the bone can still move freely, although it is parented to the root bone. +With the 3D cursor still in the center, add a new bone (Shift+A). Select this bone tail and move (G) it until it matches the mouth location, as you can see in Figure 2.15. Now select this bone and the root bone and parent them without linking them (Ctrl+P > Keep Offset). This way the bone can still move freely, although it is parented to the root bone. ![Bone editing(Blender Foundation-Art Cengage Learning)](../figures/Chapter2/Fig02-15.png "Bone editing") @@ -289,14 +289,14 @@ Back to the root bone: select its tail and extrude it (E). This is another way o Before animating the shark, we need to link the armature with the mesh. This is done with the Set Parent To operator: -In the Object mode, select the shark mesh and then the shark armature and Ctrl+P  Armature Deform  With Automatic Weights. This will try to automatically set the influence of each bone in the mesh. For fine-tuning, select the armature, set it to Pose Mode, and then select the mesh and set it to Weight Paint mode. Now you can select the bones individually and paint their influence over the vertices as shown in Figure 2.17. +In the Object mode, select the shark mesh and then the shark armature and Ctrl+P > Armature Deform > With Automatic Weights. This will try to automatically set the influence of each bone in the mesh. For fine-tuning, select the armature, set it to Pose Mode, and then select the mesh and set it to Weight Paint mode. Now you can select the bones individually and paint their influence over the vertices as shown in Figure 2.17. ![Weight painting(Blender Foundation-Art Cengage Learning)](../figures/Chapter2/Fig02-17.png "Weight painting") >**X-Ray and Auto-Normalize** > ->With the armature selected, go to the Properties Data panel and set X-Ray on in the armature display-this will make the bones always be visible. Also, while weight painting, you can set Auto Normalize in the Tool panel-this ensures that all bone-deforming vertex groups don't add up to 1.0 while weight painting. +>With the armature selected, go to the Properties Data panel and set X-Ray on in the armature display - this will make the bones always be visible. Also, while weight painting, you can set Auto Normalize in the Tool panel - this ensures that all bone-deforming vertex groups don't add up to 1.0 while weight painting. To test the bone weighting, move the bones around (in the Pose not Edit Mode) and see if the mesh goes with it. The file is ready for animation and can be found here: //assets/shark.8.blend. @@ -321,7 +321,7 @@ We will create a swimming cycle-an animation where the first and the last poses 3. Change to the Pose mode. -Rotate the tailbone 50 degrees clockwise in the Z axis. Rotate the head bone 5 degrees counter-clockwise in the same axis. Select all bones (A) and insert a keyframe (ILocRot). This will be our pose for the first frame. The current file is at //assets/shark.9.blend and is shown in Figure 2.18. +Rotate the tailbone 50 degrees clockwise in the Z axis. Rotate the head bone 5 degrees counter-clockwise in the same axis. Select all bones (A) and insert a keyframe (I > LocRot). This will be our pose for the first frame. The current file is at //assets/shark.9.blend and is shown in Figure 2.18. ![Initial pose(Blender Foundation-Art Cengage Learning)](../figures/Chapter2/Fig02-18.png "Initial pose") @@ -354,7 +354,7 @@ The middle pose of the animation cycle should be opposite to the initial (and fi >**Bones Mirroring** > ->If your rigs have bones bifurcating from the main bone chain, there is a special way to make them mirror. By default, Blender will try to paste the pose of the same bone mirrored relative to the Y axis. Sometimes, however, you want to swap the transformations between two bones-a left and right. The classic example is walking animations when you need to animate only half of the strides. +>If your rigs have bones bifurcating from the main bone chain, there is a special way to make them mirror. By default, Blender will try to paste the pose of the same bone mirrored relative to the Y axis. Sometimes, however, you want to swap the transformations between two bones - a left and right. The classic example is walking animations when you need to animate only half of the strides. >To have Blender interpret the bones as two sides of the same bone, you need to name them L (for left bones) and R (for right bones). This way, the bone Swimmer.001.L will be treated as the pair of Swimmer.001.R, and their poses will be swapped and mirrored when using the Pose Flip Paste option. To learn more about this, refer to the walking cycle tutorial in the Chapter 4. @@ -383,7 +383,7 @@ The shark will always be swimming. Thus, we will be playing the swimming animati 1. Change your screen from animation to game logic. -2. In the Logic Editor, add an Always sensor (Shift+ASensorAlways). +2. In the Logic Editor, add an Always sensor (Shift+A > Sensor > Always). 3. Add an Action actuator and connect it with the sensor. @@ -415,7 +415,7 @@ This simple setup allows the shark to swim freely away from the camera. To have 2. Add a Camera actuator and connect it with the sensor. -3. In the Camera actuator, set SharkArmature as object, height 5.0, axis [nd]Y, min 5.0, max 20.0, damping 0.10. +3. In the Camera actuator, set SharkArmature as object, height 5.0, axis -Y, min 5.0, max 20.0, damping 0.10. This camera will be behind the shark, always trying to stay inside the specified distance (from 5 to 20 Blender units). The damping will set how fast you want the camera to adjust to the new position while the shark swims away. @@ -434,7 +434,7 @@ You need to bring the shark model into this file. Start by linking in the SharkM It's important to save your file first; otherwise, the Relative Path option will have no effect. Linking keeps your shark file as an external asset. Any changes you make in the shark.blend file will be transferred over to the game.blend file, once you save it. That also means you cannot make changes in the asset objects through the game.blend file. If you linked before you saved the file, no worries. You can change all the file paths going to the menu File > External Data > Make All Paths Absolute. -The camera doesn't need to be linked. In fact, it's better to keep it as a local object, given that you will certainly adjust its parameters later. To append (not link) the camera, use the menu File  Append and use the default options to import the camera. This will be the main camera for the game. Select the camera and in the 3D View header, choose View > Cameras > Set Active Object as Camera. If everything went right, you can now play your game, and it should behave just as in the shark.blend file. +The camera doesn't need to be linked. In fact, it's better to keep it as a local object, given that you will certainly adjust its parameters later. To append (not link) the camera, use the menu File > Append and use the default options to import the camera. This will be the main camera for the game. Select the camera and in the 3D View header, choose View > Cameras > Set Active Object as Camera. If everything went right, you can now play your game, and it should behave just as in the shark.blend file. Good news. The SeaBed was already prepared and is ready for the game (and in your game\_my asset folder). Repeat the linking steps once again for the SeaBed group inside the //level/seabed.blend. You now have the shark, the camera, and the set prepared for the game. The progress shown in Figure 2.24 can be checked at //game.2.blend. From 7e0489a7eb0fbcbc153c7e983059de6f99239796 Mon Sep 17 00:00:00 2001 From: mickymadfree Date: Sun, 8 Oct 2017 18:38:28 +0000 Subject: [PATCH 4/9] Update 02-FirstGame.md --- text/02-FirstGame.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/text/02-FirstGame.md b/text/02-FirstGame.md index cc3120f..af87cc9 100644 --- a/text/02-FirstGame.md +++ b/text/02-FirstGame.md @@ -517,7 +517,7 @@ And so will the shark. Once the shark receives a message, it can act accordingly 1. Select the SharkMesh object. -2. Add a keyframe to the size (IScaling). +2. Add a keyframe to the size (I > Scaling). 3. Go to frame 100, scale up the shark, and repeat the previous step. @@ -563,7 +563,7 @@ The game is over when you run out of time, which is part of the second set of ev This scene will be imported without changes into your game file. Once again, the linking system of Blender allow you to keep components separated and synced. Open //game.4.blend and link (not append) the "Score" scene from the //interface/score.blend file. Although the scene is now in the Blender file, you still need to load it into the game: -1. Add an empty object (Shift+AEmpty). +1. Add an empty object (Shift+A > Empty). 2. Select the object and open the Logic Editor. @@ -592,7 +592,7 @@ A game is not complete without sound effects. There are three sounds under // so There is a catch here. You are sending the GameOver message not once but continuously. That would make the GameOver sound play in loop, which you don't want. You can fix this in the score.blend scene file (by sending the message only once). Or else you can do it here, as follows: -You need a Boolean game property that tells you what the status of the game is: when gameover is False the game is running; if gameover is True the game is over. When you receive a message with the subject "GameOver," you need to change the value of this property. You do this by connecting the Message sensor with a new Property actuator -Mode: Assign, Property: "gameover," Value: True. +You need a Boolean game property that tells you what the status of the game is: when gameover is False the game is running; if gameover is True the game is over. When you receive a message with the subject "GameOver," you need to change the value of this property. You do this by connecting the Message sensor with a new Property actuator - Mode: Assign, Property: "gameover," Value: True. Next you add a Property sensor named GameIsNotOver to detect if the game is running (if the gameover game property is True or False). Set Evaluation Type to Equal, property to "gameover," and Value as False. From 49a0bddd7310edef9cb7854f8ff2af453c89381d Mon Sep 17 00:00:00 2001 From: mickymadfree Date: Sun, 8 Oct 2017 18:46:50 +0000 Subject: [PATCH 5/9] Update 02-FirstGame.md --- text/02-FirstGame.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/text/02-FirstGame.md b/text/02-FirstGame.md index af87cc9..23fda66 100644 --- a/text/02-FirstGame.md +++ b/text/02-FirstGame.md @@ -133,11 +133,11 @@ To play the game inside Blender, open the file game.blend. This file is only a p To follow the progress of the instruction steps, we have other folders. Copy the whole folder onto your computer to work from there. These are the folders we will be using: -- **Book/Chapter02/game_my** - The semi-empty folder structure to be filled as you advance in the chapter. +- **Book/Chapter02/game\_my** - The semi-empty folder structure to be filled as you advance in the chapter. -- **Book/Chapter02/game_progress** - The same folder structure but filled with files of different snapshots. Every file is named after the original name plus a progress number-for example, game.1.blend, game.2.blend, //assets/shark.8.blend. To use them, you need to rename the file to the original name and copy to the right folder in "game_my" folder. +- **Book/Chapter02/game\_progress** - The same folder structure but filled with files of different snapshots. Every file is named after the original name plus a progress number-for example, game.1.blend, game.2.blend, //assets/shark.8.blend. To use them, you need to rename the file to the original name and copy to the right folder in "game_my" folder. -- **Book/Chapter02/game_final** - The final as of the end of this exercise; use for reference. +- **Book/Chapter02/game\_final** - The final as of the end of this exercise; use for reference. - **Book/Chaper02/references** - Files to support the making of the game. From d810858da7d55b19348d5cfdbe7e20c56ff60bcb Mon Sep 17 00:00:00 2001 From: mickymadfree Date: Sun, 8 Oct 2017 18:53:06 +0000 Subject: [PATCH 6/9] Update 01-GettingStarted.md --- text/01-GettingStarted.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/text/01-GettingStarted.md b/text/01-GettingStarted.md index 4167010..6275fd8 100644 --- a/text/01-GettingStarted.md +++ b/text/01-GettingStarted.md @@ -134,7 +134,7 @@ We live in a three-dimensional world that has width, height, and depth. So to re ### Points, Edges, Triangles, and Meshes -Although we can define a position in space using the XYZ coordinates, a single point (or a "vertex," as it's more commonly known in computer graphics) is not terribly useful; after all, you can't see a dot that is infinitesimally small. But you can join this vertex with another vertex to form a line (also known as an "edge"). An edge by itself still wouldn't be very visible, so you create another vertex and join all three vertices together with lines and fill in the middle. Suddenly, something far more interesting is created[md]?a triangle (also known as a "face")! By linking multiple faces together, you can create any shape, the result of which is called a "mesh" or "model." Figure below shows how a mesh can be broken down into faces, then edges, and ultimately, as vertices. +Although we can define a position in space using the XYZ coordinates, a single point (or a "vertex," as it's more commonly known in computer graphics) is not terribly useful; after all, you can't see a dot that is infinitesimally small. But you can join this vertex with another vertex to form a line (also known as an "edge"). An edge by itself still wouldn't be very visible, so you create another vertex and join all three vertices together with lines and fill in the middle. Suddenly, something far more interesting is created a triangle (also known as a "face")! By linking multiple faces together, you can create any shape, the result of which is called a "mesh" or "model." Figure below shows how a mesh can be broken down into faces, then edges, and ultimately, as vertices. ![Teapot, cube, face, edge and vertex.](../figures/Chapter1/Fig01-06.jpg) @@ -200,7 +200,7 @@ Think of lighting as more than something that makes your scene visible. Good lig Camera objects -When you are creating a 3D scene, you are looking at the virtual world from an omniscient view. In this mode, you can view and edit the world from any angle[md]just like a movie director walking around a set in order to adjust things. Once the game starts, the player must view the game through a predetermined camera. Note that a predetermined camera does not mean the camera is fixed; almost all games have a camera that reacts to a player's input. In an action game, the camera tends to follow the character from behind; in a strategy game, the camera might be hovering high above, looking down; in a platformer, the camera is usually looking at the scene from the side. +When you are creating a 3D scene, you are looking at the virtual world from an omniscient view. In this mode, you can view and edit the world from any angle, just like a movie director walking around a set in order to adjust things. Once the game starts, the player must view the game through a predetermined camera. Note that a predetermined camera does not mean the camera is fixed; almost all games have a camera that reacts to a player's input. In an action game, the camera tends to follow the character from behind; in a strategy game, the camera might be hovering high above, looking down; in a platformer, the camera is usually looking at the scene from the side. A camera is also treated as a regular object in Blender, so you can manipulate its location and orientation just as you can with any other object. @@ -247,7 +247,7 @@ A game engine is made up of many distinct components: - **Rendering Engine** : Turns the 3D scene you've built (including models, lights, and camera) into an image to be displayed onscreen. - **Physics** : Handles collisions and physical simulations of objects. -- **Logic/Scripting** : The brain behind a game[md]it reacts to the user input, makes decisions, and keeps track of what's going on in the game. +- **Logic/Scripting** : The brain behind a game, it reacts to the user input, makes decisions, and keeps track of what's going on in the game. - **Sound** : Produces the audio events. The above list is not meant to be exhaustive, but it should give you an idea of what a game engine does. The Blender game engine gives you a lot of control over each of these components, which you will learn one by one in later chapters. From 1d55dcb0b4f4f0a5e2c5e7232365814a9f2dc760 Mon Sep 17 00:00:00 2001 From: mickymadfree Date: Sun, 8 Oct 2017 18:57:11 +0000 Subject: [PATCH 7/9] Update 02-FirstGame.md --- text/02-FirstGame.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/02-FirstGame.md b/text/02-FirstGame.md index 23fda66..48814b3 100644 --- a/text/02-FirstGame.md +++ b/text/02-FirstGame.md @@ -135,7 +135,7 @@ To follow the progress of the instruction steps, we have other folders. Copy the - **Book/Chapter02/game\_my** - The semi-empty folder structure to be filled as you advance in the chapter. -- **Book/Chapter02/game\_progress** - The same folder structure but filled with files of different snapshots. Every file is named after the original name plus a progress number-for example, game.1.blend, game.2.blend, //assets/shark.8.blend. To use them, you need to rename the file to the original name and copy to the right folder in "game_my" folder. +- **Book/Chapter02/game\_progress** - The same folder structure but filled with files of different snapshots. Every file is named after the original name plus a progress number-for example, game.1.blend, game.2.blend, //assets/shark.8.blend. To use them, you need to rename the file to the original name and copy to the right folder in "game\_my" folder. - **Book/Chapter02/game\_final** - The final as of the end of this exercise; use for reference. From 4cf725542262e888af828357f8bf7fc0faeeba18 Mon Sep 17 00:00:00 2001 From: mickymadfree Date: Sat, 2 Dec 2017 15:37:42 +0000 Subject: [PATCH 8/9] Update 03-LogicBricks.md --- text/03-LogicBricks.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/text/03-LogicBricks.md b/text/03-LogicBricks.md index 6119ead..1c8dad6 100644 --- a/text/03-LogicBricks.md +++ b/text/03-LogicBricks.md @@ -78,7 +78,7 @@ What makes a game different than a movie? Let's see. In both you can find yourself buried in a comfortable seat eating junk food and alienated from the world. And funny 3D goggles are not exclusive to either. But what about interactivity? In a game you can control a player and interact with the virtual (or real!) world and the game elements. The story can be dynamically created in front of your eyes. -Therefore, as a director and content creator you will play different roles in a movie or a game. In a movie, for example, you have to direct the flow of the story, but for a game, you have to direct how the player controls and experiences this flow. Those are the times of super computers to Watson, IBM's Jeopardy "intelligent" machine. More than ever, it's time to narrow the gap between what technology can deliver and what the public can experiment with and assimilate as part of their own nature. As Kevin Flynn praised in _Tron_ and _Tron Legacy_the Disney game-related movie and prequel _all the power to the user_. +Therefore, as a director and content creator you will play different roles in a movie or a game. In a movie, for example, you have to direct the flow of the story, but for a game, you have to direct how the player controls and experiences this flow. Those are the times of super computers to Watson, IBM's Jeopardy "intelligent" machine. More than ever, it's time to narrow the gap between what technology can deliver and what the public can experiment with and assimilate as part of their own nature. As Kevin Flynn praised in _Tron_ and _Tron Legacy_ the Disney game-related movie and prequel _all the power to the user_. Traditionally, to design your game interaction in the past, you would have needed coding expertise and a highly technical background. If, as a creative artist, any words such as _technical, code,_ or _programming_ scare you, Have confidence! "Pure artists" are still scared with code. The idea here is not that they will no longer be afraid of it. Instead, with the BGE they will not have to face their fears. Logic Bricks are an alternative to hardcore coding, known to be "artists friendly" more. Logic Bricks is here to rescue you. Logic Bricks is a visual set of tools responsible for integrating the game components together. By using Logic Bricks, you can determine what to do after a mouse click, when to play an animation, how to move your character, and so on, as shown in Figure 3.1. @@ -168,7 +168,7 @@ Every Logic Brick has a connector used to link it with other Logic Bricks. Senso > >Try to link a sensor directly with an actuator on the same object. Blender will automatically create an And controller and link it between them. -You don't need to keep the logics self-contained in single objects. When you select more than one object at the same time, you will see all of them in the Logic Editor. That feature allows you to connect a sensor from one object to the controller of another one and again to the actuator of yet another object. This is one of the key elements for group instancing[md]an advanced way of sharing Logic Bricks, which is covered at the end of this chapter. +You don't need to keep the logics self-contained in single objects. When you select more than one object at the same time, you will see all of them in the Logic Editor. That feature allows you to connect a sensor from one object to the controller of another one and again to the actuator of yet another object. This is one of the key elements for group instancing, an advanced way of sharing Logic Bricks, which is covered at the end of this chapter. >**Message System** > @@ -203,7 +203,7 @@ Above the list of an object controller, you can see a small but important plus i > >When you play the game, the active states of a controller are the ones in the bottom row shown in Figure 3.6, known as _initial states._ The states present in the top row, namely visible states, are a tool to help you visualize different states without messing with the Initial States set. They are reset to the Initial States every time you reopen your file. -The States interface works like the layer system in Blender[md]click to select one state and Shift+click to select more than one. As for the Blender layers, states have no individual names for the time being. +The States interface works like the layer system in Blender, click to select one state and Shift+click to select more than one. As for the Blender layers, states have no individual names for the time being. ### Properties @@ -336,7 +336,7 @@ This sensor is often used with collision proxies, which are invisible low-poly m >**Use It Moderately** > ->Together with the other Physics sensors, this sensor is considered to be expensive computation-wise, so use it reasonably and use physics proxies whenever possible[md]a topic discussed in the Chapter 6 and Chapter 8, "Workflow and Optimization." +>Together with the other Physics sensors, this sensor is considered to be expensive computation-wise, so use it reasonably and use physics proxies whenever possible, a topic discussed in the Chapter 6 and Chapter 8, "Workflow and Optimization." #### Near @@ -392,7 +392,7 @@ The Message sensor receives a message sent from a Message actuator or from a Pyt >**Extra Message Information** > ->>The extra information available in the message (subject, body) can be accessed only by a Python controller. +>The extra information available in the message (subject, body) can be accessed only by a Python controller. #### Property @@ -435,13 +435,13 @@ Similar to the sensors, each controller carries a unique set of information, reg When you have one single sensor that has to call an actuator, there is not much to worry about. In this case, a simple And controller will make it work. If instead you need to activate the actuator only when the sensor is False, you can use the Invert option to keep using the same Add controller. Too simple? Let's complicate it a bit then. What if you have two sensors and only one of them needs to be True? You could create two And controllers linked to the same actuator. It's not elegant, but it would work. ->**How Many Times Can You Activate an Actuator? +>**How Many Times Can You Activate an Actuator?** > >If you think that the setup above would call the actuator twice, then have fun testing it. An actuator is activated only once per frame, regardless of the number of controllers calling it. But what if you wanted to use only one controller to handle those two sensors? In this case, it would be the Or controller, created specifically for that. That's not all, though. Either for convenience or for more advanced control, you could simplify your controllers by using the other Boolean controllers. Together with And and Or, those are the other logic switches to use when combining multiple sensors and their outcomes. -- **And** : True if _all_the sensors are True. False if _any_ of the sensors is False. +- **And** : True if _all_ the sensors are True. False if _any_ of the sensors is False. - **Or** : True if _any_ of the sensors is True. False if _all_ the sensors are False @@ -489,13 +489,13 @@ For the Controller Expression, you will only use the lonely value when dealing w - **Boolean** : True, False -- **Number** : 5, [ms]7, 3.5, 40, 3.5[md]integers and floats, positive, negative, and even zero. +- **Number** : 5, -7, 3.5, 40, 3.5 - integers and floats, positive, negative, and even zero. -- **String** : "text"[md]always around quotation marks. +- **String** : "text" - always around quotation marks. -- **Property** : propertyName[md]gives the property value. +- **Property** : propertyName - gives the property value. -- **Sensor** : sensorName[md]gives True or False according to the sensor status. +- **Sensor** : sensorName - gives True or False according to the sensor status. A single value is not exactly an expression. Let's move on and see what kind of expressions and operations we can make when combining them together: @@ -504,7 +504,7 @@ A single value is not exactly an expression. Let's move on and see what kind of > >In order to use a sensor name, the sensor has to be linked to the Expression controller. Sensors can't be used in the expressions for the Property sensor and the Property actuator. -#### Comparison Tests +#### Comparison Tests If instead of testing a single variable, you need to compare two values, there are five different comparison tests you can use. The test can be between a variable (property or sensor) and a value, two values, or two variables: @@ -520,7 +520,7 @@ If instead of testing a single variable, you need to compare two values, there a The result of a comparison test will always be a Boolean. If you need to return a value other than True or False, then what you are looking for is: -**Condition Statement** : IF (frame < 0, [ms]1, 0) +**Condition Statement** : IF (frame < 0, -1, 0) The syntax is: IF (Condition, ValueWhenTrue, ValueWhenFalse). If you use the above expression as a value for the Add mode in a Property actuator, it will decrease the counter (for example, frame) if the value is greater than zero. @@ -608,9 +608,9 @@ You can also have the same property present in multiple actions and use individu >**Short Actions in the Long Run** > ->Before the animation system redesign in Blender, it was only possible to have multiple actions for armatures and shape keys. Therefore, for any other animated action, people would create one really long action with different animations in different frame ranges. This still works well, but it's hard to manage if you ever need to change the length of one of the animations[md]you would have to update the start and end of all the actuators that were playing the other subanimations. You may find yourself still using this technique in order to organize your file; however, sometimes a long action can be easier to manage than multiple small ones. +>Before the animation system redesign in Blender, it was only possible to have multiple actions for armatures and shape keys. Therefore, for any other animated action, people would create one really long action with different animations in different frame ranges. This still works well, but it's hard to manage if you ever need to change the length of one of the animations - you would have to update the start and end of all the actuators that were playing the other subanimations. You may find yourself still using this technique in order to organize your file; however, sometimes a long action can be easier to manage than multiple small ones. -The actuator will let you pick an action, set the frame range, and configure how you want to play it (see Figure 3.26). If you are planning to reuse this actuator[md]for example, for linked/shared Logic Bricks[md]you can leave the action blank and set it through the Python API during the game engine. In Chapter 4, "Animation," we will use this actuator in a series of tutorials. +The actuator will let you pick an action, set the frame range, and configure how you want to play it (see Figure 3.26). If you are planning to reuse this actuator (for example, for linked/shared Logic Bricks) you can leave the action blank and set it through the Python API during the game engine. In Chapter 4, "Animation," we will use this actuator in a series of tutorials. ![Action actuator](../figures/Chapter3/Fig03-26.png "Action actuator") @@ -618,7 +618,7 @@ The actuator will let you pick an action, set the frame range, and configure how Some of the animations you create in Blender can be used in the game engine. The same result you see in the viewport when you play them back with Alt+A, you can also get in the game engine. That includes armature poses, shape keys, and some of the properties of object, material, light, and camera as following: -- **Pose** : Any recorded sequence in an Armature object can be played. It's common to have different animated cycles[md]walking, running, jumping, tired walking, taking a break[md]and to alternate between them during an event. When using multiple action actuators, you may have an action currently playing when you start a new one. To make the transition smoothly, you can set the Blend In and Priority to respectively blend the animations for a certain number of frames and to play the new animation on top of the old one. +- **Pose** : Any recorded sequence in an Armature object can be played. It's common to have different animated cycles (walking, running, jumping, tired walking, taking a break) and to alternate between them during an event. When using multiple action actuators, you may have an action currently playing when you start a new one. To make the transition smoothly, you can set the Blend In and Priority to respectively blend the animations for a certain number of frames and to play the new animation on top of the old one. - **Shape Keys** : Similar to poses, you can play the shape key actions created in the DopeSheet Editor with control over the blending, priority, frames, and so on. There is even a Continue option common to both that allows you to start the animation when you left the last time you activated it. Remember that you don't play the individual shape keys but rather the action that stores their influence on each other over time. @@ -632,7 +632,7 @@ Some of the animations you create in Blender can be used in the game engine. The ##### What Cannot Be Animated -Unfortunately, not everything we can animate inside Blender can be animated in the game engine. More specifically, the following elements can't be animated with the Action actuator:Drivers, Scene, World, remaining Object, Material, Camera, and Light properties. +Unfortunately, not everything we can animate inside Blender can be animated in the game engine. More specifically, the following elements can't be animated with the Action actuator: Drivers, Scene, World, remaining Object, Material, Camera, and Light properties. Be aware that this may change in the near future. And some of these settings behave differently, depending on the render mode (GLSL, MultiTexture). From 594bf197eebb714f8146952b20646f8000f61517 Mon Sep 17 00:00:00 2001 From: mickymadfree Date: Sun, 3 Dec 2017 09:57:46 +0000 Subject: [PATCH 9/9] Update 03-LogicBricks.md --- text/03-LogicBricks.md | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/text/03-LogicBricks.md b/text/03-LogicBricks.md index 1c8dad6..57af648 100644 --- a/text/03-LogicBricks.md +++ b/text/03-LogicBricks.md @@ -52,8 +52,8 @@ - [Constraint](#Constraint) - [Location Constraint](#Location_Constraint) - [Distance](#Distance) - - [Orientation Constraint](#Orientation_Constraint) - - [Force Field Constraint](#Force_Field_Constraint) + - [Orientation Constraint](#Orientation_Constraint) + - [Force Field Constraint](#Force_Field_Constraint) - [Edit Object](#Edit_Object) - [Message](#Message) - [Motion](#Motion) @@ -749,13 +749,13 @@ The Distance Constraint option compares and controls the distance between your o > >This actuator will be active as soon as it is triggered and will remain active until it receives a negative signal or can no longer find a surface (for example, the floor) in the given range. If you want to keep your actuator active even when it doesn't find a surface to be constrained to, you can turn on the Persistency **(PER)** option. If Time is greater than zero, it will set the maximum activation period of the actuator. -#### Orientation Constraint +##### Orientation Constraint Instead of affecting your object's position, the Orientation Constraint option will restrict its rotation on individual axes (see Figure 3.33). It aligns the specified axis with the reference direction. For example, if you want to make your bop bag stay straight, you can use Z as Direction and 0, 0, 1 as the Referencedirection. As with the other Constraint Actuator options, you can set Min and Max angles, Damping frames, and the Time. ![Constraint actuator – Orientation](../figures/Chapter3/Fig03-33.png "Constraint actuator – Orientation") -#### Force Field Constraint +##### Force Field Constraint The Force Field Constraint simulates a spring field underneath your object (see Figure 3.34). The effect is similar to hovering above water or simple buoyancy. Force fields can also be set with the Physics settings in the Material Panel (see Chapter 6 for details). @@ -779,7 +779,7 @@ There are a few actuators that feel as if they could be split into individual on ![Edit Object actuator](../figures/Chapter3/Fig03-35.png "Edit Object actuator") -- **AddObject** : If you have objects in one of the non-visible layers, you can add them into the game with this option. The added object will be at the position and with the orientation of the object controlling the actuator. The scale, however, will be a combination of both objects. Other than that, the new object is pretty much autonomous[md]actually game property and logic bricks in the new object will be as good as if the object existed since frame one. The only exception is the Timer game properties that start counting only when the object gets added. You can add multiple instances of the same object, and any of them will behave as an independent duplicated copy of it. +- **AddObject** : If you have objects in one of the non-visible layers, you can add them into the game with this option. The added object will be at the position and with the orientation of the object controlling the actuator. The scale, however, will be a combination of both objects. Other than that, the new object is pretty much autonomous, actually game property and logic bricks in the new object will be as good as if the object existed since frame one. The only exception is the Timer game properties that start counting only when the object gets added. You can add multiple instances of the same object, and any of them will behave as an independent duplicated copy of it. Through the options in the interface, you can change the initial linear and angular velocity of the object and its life duration. @@ -789,7 +789,7 @@ Through the options in the interface, you can change the initial linear and angu - **EndObject** : Take a deep look at your game object. Now turn away and say bye! Not only will your object be removed from the game, but also any child object parented to it. -- **ReplaceMesh** : If your object is not an Armature, a Camera, an Empty, a Lamp, or a Text, it does have a mesh attached to it. And if it has a mesh, it can have it switched into a different one. There are two options here: to replace the graphic mesh[md]the one you see rendered[md]or to replace the physical mesh[md]the one used for physics interactions, viewed with Show Physics Visualization. +- **ReplaceMesh** : If your object is not an Armature, a Camera, an Empty, a Lamp, or a Text, it does have a mesh attached to it. And if it has a mesh, it can have it switched into a different one. There are two options here: to replace the graphic mesh (the one you see rendered) or to replace the physical mesh (the one used for physics interactions, viewed with Show Physics Visualization). >**But Isn't This Slow? Not Really** > @@ -807,7 +807,7 @@ There are different ways to coordinate actions between different objects. As pre ![Message actuator](../figures/Chapter3/Fig03-36.png "Message actuator") -If you don't know which object to send the message to (or want to send it to more than one), you can broadcast it instead. For that you simply have to omit the To parameter. A Message Sensor[md]the other part of the story[md]can filter messages by their Subject. The Body can only be retrieved by a Python script, and it is commonly left blank when you only want to trigger an event, not to pass a value. The Body can be either a text or the value of a property. +If you don't know which object to send the message to (or want to send it to more than one), you can broadcast it instead. For that you simply have to omit the To parameter. A Message Sensor (the other part of the story) can filter messages by their Subject. The Body can only be retrieved by a Python script, and it is commonly left blank when you only want to trigger an event, not to pass a value. The Body can be either a text or the value of a property. > **The Real Thing About Real-Time Is That It Has a Delay** > @@ -815,9 +815,9 @@ If you don't know which object to send the message to (or want to send it to mor #### Motion -_"My body move, move, my body …move!"_[md]hippo dance/pickup line (one of the best moments of DreamWorks' _Madagascar 2_). +_"My body move, move, my body …move!"_ - hippo dance/pickup line (one of the best moments of DreamWorks' _Madagascar 2_). -It moves, but it does it in distinct ways. For example, an animated character will use an actuator to control the bones and a Motion actuator to control the general movement of the object into the scene[md]its orientation and position. So unless the game character is doing a windmill exercise, your walking cycle will need this actuator. As a matter of fact, any object[md]with or without an action assigned to it[md]may need to rotate and move around. Therefore, this is one of the most important actuators and vastly used for a game. Let's take a deep look at the two available methods: Simple Motion and Servo Control. +It moves, but it does it in distinct ways. For example, an animated character will use an actuator to control the bones and a Motion actuator to control the general movement of the object into the scene - its orientation and position. So unless the game character is doing a windmill exercise, your walking cycle will need this actuator. As a matter of fact, any object (with or without an action assigned to it) may need to rotate and move around. Therefore, this is one of the most important actuators and vastly used for a game. Let's take a deep look at the two available methods: Simple Motion and Servo Control. >**Rotate It Just a Bit** > @@ -843,7 +843,7 @@ When your object is a dynamic one, you will see new options in the actuator (see This is a more complex and complete method for controlling your object's linear movement. The Servo Control option enables you to control speed with force. It will apply a variable force in order to reach the target specified speed. It can be used to simulate the most varied effects, such as friction, flying, sliding, and so on. -The Servo Control can (and should) be used for any object, regardless of its dynamic/physic properties (see Figure 3.39). It replaces both Location and Linear Velocity from the Simple Motion option. The produced result is a more fluid and continuous movement for your object. This also doesn't affect the behavior of collision and other physics interactions[md]as opposed to using Location in the Simple Motion. The latter makes the object do "jumps into space," ignoring whatever is between its original and final position. +The Servo Control can (and should) be used for any object, regardless of its dynamic/physic properties (see Figure 3.39). It replaces both Location and Linear Velocity from the Simple Motion option. The produced result is a more fluid and continuous movement for your object. This also doesn't affect the behavior of collision and other physics interactions - as opposed to using Location in the Simple Motion. The latter makes the object do "jumps into space," ignoring whatever is between its original and final position. ![Motion actuator - Servo Control](../figures/Chapter3/Fig03-39.png "Motion actuator - Servo Control") @@ -856,7 +856,7 @@ The Servo Control can (and should) be used for any object, regardless of its dyn >**Advanced Motion Control** > >**PID Servo Control System** : The following options help you to control the responsiveness and the reaction of your movement. In simple English, this is known as a "control loopback mechanism," and it is a constant evaluation procedure that shapes the characteristics of your movement. ->This is a generic (non-Blender specific) system; for more information, look at external references such as:http://en.wikipedia.org/wiki/PID\_controller +>This is a generic (non-Blender specific) system; for more information, look at external references such as: http://en.wikipedia.org/wiki/PID_controller - **Proportional Coefficient** : You don't need to change this parameter unless you know what you are doing. It will adjust itself to be 60 times the IntegralCoefficient, so if you want a different value, remember to update it after making any adjustments there. @@ -909,7 +909,7 @@ There are a few ways of changing your game properties. You can change them throu #### Random -Controlled randomness is one of the keys for a decent AI (artificial intelligence). As you can see in Figure 3.43, the Random actuator has 10 options to generate pseudo-random numbers. They are divided by types[md]Boolean, integer, and float[md]and they use a seed for consistent results over time. A seed allows an algorithm to generate the same random numbers every time you start the interaction. +Controlled randomness is one of the keys for a decent AI (artificial intelligence). As you can see in Figure 3.43, the Random actuator has 10 options to generate pseudo-random numbers. They are divided by types (Boolean, integer, and float) and they use a seed for consistent results over time. A seed allows an algorithm to generate the same random numbers every time you start the interaction. ![Random actuator](../figures/Chapter3/Fig03-43.png "Random actuator") @@ -917,7 +917,7 @@ The generated number is stored in a game property indicated in the Property fiel #### Sound -Soundtracks and sound effects[md]the possibilities are endless and definitively a key aspect of your game. You will use this Sound actuator when you play a "click" sound for the UI (see Figure 3.44). You will also use it to announce steps from surrounding enemies. In fact, the opening music, the main track, and the credit sounds all are musical[md]music, music, and music. You may love music, but if they all play together at the same time, you get the cacophonic experience of an indie garage band. On the other hand, to sync the events of your game with its sounds, you can use these options: Play, Volume, Pitch, and 3D Sound. +Soundtracks and sound effects - the possibilities are endless and definitively a key aspect of your game. You will use this Sound actuator when you play a "click" sound for the UI (see Figure 3.44). You will also use it to announce steps from surrounding enemies. In fact, the opening music, the main track, and the credit sounds all are musical - music, music, and music. You may love music, but if they all play together at the same time, you get the cacophonic experience of an indie garage band. On the other hand, to sync the events of your game with its sounds, you can use these options: Play, Volume, Pitch, and 3D Sound. ![Sound actuator](../figures/Chapter3/Fig03-44.png "Sound actuator") @@ -949,7 +949,7 @@ In the Physics buttons, you can choose the initial visibility of your object and #### Scene -While most of the actuators act on top of the object, the following actuators[md]Scene, Filter 2D, and the Game actuator[md]work globally, either per scene or per game. +While most of the actuators act on top of the object, the following actuators - Scene, Filter 2D, and the Game actuator - work globally, either per scene or per game. Multiple scenes are a common way to make a user interface (overlay scene), handle different levels (although that can be accomplished with multiple blender files as well), or even preload your game assets in the memory (adding scenes and suspending them before effectively switching between scenes). See Figure 3.47. @@ -1007,7 +1007,7 @@ It's still important to be aware of the Pass Number, just as for the other filte - **Motion Blur** : In a video camera, fast objects appear to be blurred the faster they go. It's quite a popular effect and even in real-time rendering, it can be simulated in an artistic way (a euphemism for a trade-off between quality and performance with tons of compromise). -This filter has its own option to be enabled and disabled. As you can see in Figure 3.50, there is no Pass Number there. The reason is that Motion Blur is always computed before the other filters. Therefore, it will run prior to the first of your filters. You can set the Value to adjust the sensitivity and general effect of the blur[md]small values will produce very little blur. +This filter has its own option to be enabled and disabled. As you can see in Figure 3.50, there is no Pass Number there. The reason is that Motion Blur is always computed before the other filters. Therefore, it will run prior to the first of your filters. You can set the Value to adjust the sensitivity and general effect of the blur, small values will produce very little blur. ![Filter 2D actuator - Motion Blur](../figures/Chapter3/Fig03-50.png "Filter 2D actuator - Motion Blur") @@ -1045,7 +1045,7 @@ Load and Save bge.logic.globalDict is only relevant if you are using Python scri ## State Machine -_"Why did the controller cross the road?[md]to get to the next state."_ +_"Why did the controller cross the road? - to get to the next state."_ A state is a conjunct of actions to be performed by a game character. In our case, it's a set of sensors, controllers, and actuators that together represent a subset of the possible behavior the character will present. Let's say it in a simple way. @@ -1053,23 +1053,23 @@ Pretend we are creating a triathlon sport game. The triathlete will be able to s ![Initial settings of the triathlon state system](../figures/Chapter3/Fig03-52.png "Initial settings of the triathlon state system") -Although all the controllers and actuators are visible, the state 1 (Swim) is the only one that is part of the initial states. Therefore, any controllers from other states (for example, Bike and Run) will be disabled when the game starts. Indeed, sensors and actuators will only be active if the controller they are linked to are currently active. In our pseudo Logic Bricks, the actuator set to make the player float[md]a Location Constraint Actuator[md]will be disabled automatically once the state one (for example, Swim) is demoted. +Although all the controllers and actuators are visible, the state 1 (Swim) is the only one that is part of the initial states. Therefore, any controllers from other states (for example, Bike and Run) will be disabled when the game starts. Indeed, sensors and actuators will only be active if the controller they are linked to are currently active. In our pseudo Logic Bricks, the actuator set to make the player float (a Location Constraint Actuator) will be disabled automatically once the state one (for example, Swim) is demoted. This is the simplest way of using states. It's not the only one, though. In more complex systems, the states don't need to be exclusive and will work more as individual components that you can turn on and off accordingly. One of the important aspects of this system is that from a controller of any state, you can completely rearrange the status of all the other states, turning them on or off. >**Artificial Intelligence and the State Machine** > ->In the artificial intelligence literature, there are multiple techniques to deal with artificial behavior. The State Machine implementation in Blender is flexible enough to be used with your design, whatever you pick. Two of the most popular systems[md]Finite State Machine and Behavior Tree[md]can be implemented with the current features and the other variations might as well. The State system can also be accessed through the Python interface for a pure programming control. +>In the artificial intelligence literature, there are multiple techniques to deal with artificial behavior. The State Machine implementation in Blender is flexible enough to be used with your design, whatever you pick. Two of the most popular systems (Finite State Machine and Behavior Tree) can be implemented with the current features and the other variations might as well. The State system can also be accessed through the Python interface for a pure programming control. ## Sharing and Group Instancing -The game engine centralizes the logic components at the object level. This is at the same time a curse and a blessing. On the positive side of things, you can set up each object as a unique, independent participant of your game. The down side comes when you need to reproduce a behavior, and when the last thing you need is unique objects. Sure, you can copy over Logic Bricks and properties, but this is hard to maintain and doesn't scale well for more complex files. Note that we are not talking about duplicated objects[md]those indeed share the same Logic Brick. We are looking at game objects that have different individual components but need to share part of each other's functionality. We need a compromise between both systems, and this is possible with group instancing and Logic Bricks cross-linking. +The game engine centralizes the logic components at the object level. This is at the same time a curse and a blessing. On the positive side of things, you can set up each object as a unique, independent participant of your game. The down side comes when you need to reproduce a behavior, and when the last thing you need is unique objects. Sure, you can copy over Logic Bricks and properties, but this is hard to maintain and doesn't scale well for more complex files. Note that we are not talking about duplicated objects - those indeed share the same Logic Brick. We are looking at game objects that have different individual components but need to share part of each other's functionality. We need a compromise between both systems, and this is possible with group instancing and Logic Bricks cross-linking. -Group instancing support in the game engine was added for the project Yo Frankie[md]a game demo project organized and developed by the Blender Foundation in 2008. For this particular project, they had to share the Logic Bricks between the NPC enemies (sheeps, rats, etc.) and a different set of Logic Bricks for the two main playable characters (Frankie and Momo). +Group instancing support in the game engine was added for the project Yo Frankie - a game demo project organized and developed by the Blender Foundation in 2008. For this particular project, they had to share the Logic Bricks between the NPC enemies (sheeps, rats, etc.) and a different set of Logic Bricks for the two main playable characters (Frankie and Momo). >**To Read More…** > ->To read about their specific implementation you can look at Campbell Barton's chapter in _The Blender GameKit, 2nd_Edition_: http://wiki.blender.org/index.php/Doc:2.4/Books/GameKit\_2/12.Yo\_Frankie!#Logic\_Sharing. +>To read about their specific implementation you can look at Campbell Barton's chapter in _The Blender GameKit, 2nd_Edition_: http://wiki.blender.org/index.php/Doc:2.4/Books/GameKit_2/12.Yo_Frankie!#Logic_Sharing. The first and simplest usage of this feature is to replicate the same set of objects multiple times. Open the file _\Book\Chapter3\group\_instancing\_logic\_1.blend_. As you can see in Figure 3.53, here we have 10 copies of a system compound of balls and fountains. The balls will constantly roll inside the fountain and every once in a while the ball will get more of an impulse at the bottom of the fountain.