conversations.from: human
conversations.value: What could be a title for a book about Magazine, Multimedia, Producer with the genre: Computers & Technology, Programming Languages?
conversations.from: assistant
conversations.value: A title for this book could be 'Beginning Java 8 Games Development'
conversations.from: human
conversations.value: What is the first four paragraphs for this book?
conversations.from: assistant
conversations.value: Beginning Java 8 Games Development
  The downside to streaming digital audio is that if a user's connection (or the audio data server) goes down, your digital audio file may not always be present for your end users to play and listen to, using your game application! The reliability and availability of digital audio data are a key factor to be considered on the other side of this streaming-versus-captive trade-off. The same would apply to digital video assets as well.
  Again, as with digital video, one of the primary concepts in regard to streaming your digital audio is the bit rate of the digital audio data. As you learned in the previous section, the bit rate is defined during the compression process. Digital audio files that need to support lower bit-rate bandwidth are going to have more compression applied to the audio data, which will result in lower quality. These will stream (play back) more smoothly across a greater number of devices, because fewer bits can be quickly transferred as well as processed more easily.
  There are considerably more digital audio codecs in JavaFX than digital video codecs, as there is only one video codec, MPEG-4 H.264 AVC. Android audio support includes.MP3 (MPEG-3) files, Windows WAVE (Pulse Code Modulation [PCM] audio).WAV files,.MP4 (or.M4A) MPEG-4 AAC (Advanced Audio Coding) audio, and Apple's AIFF (PCM) file format. The most common format supported by JavaFX (and thus Java 8) is the popular.MP3 digital audio file format. Most of you are familiar with MP3 digital audio files, owing to music download web sites, such as Napster or Soundcloud, and most of us collect songs in this format to use on MP3 players and in CD-ROM- or DVD-ROM-based music collections. The MP3 digital audio file format is popular because it has a fairly good compression-to-quality ratio and is widely supported.
  MP3 is an acceptable format to use in a Java 8 application, so long as you get the highest quality level possible out of it, using an optimal encoding work process. It is important to note that, like JPEG (used for images), MP3 is a lossy audio file format, in which some of the audio data (and thus quality) are thrown away during your compression process and cannot be recovered.
conversations.from: human
conversations.value: What is five more paragraphs?
conversations.from: assistant
conversations.value: Now I am going to start going right down the variable declaration lines of code at the top of the InvinciBagel.java class starting with the Boolean variables that we made private (which were public static), and see which of these variables I can make private instead of package protected static (which StackPane and HBox are currently), or which are package protected, and can be made private. A private variable "encapsulates" that variable's data inside of the class (object) itself; in this case, this would be the InvinciBagel.java code that we're currently refining. A package protected variable encapsulates the data inside of the package; in this case that would be the invincibagel package. The new Java statement for declaring the StackPane object named root, which is a root element of the Scene Graph, to be a private member of the InvinciBagel.java class (only), would be accomplished using the following code, shown in Figure 12-10.
  Change the declaration statement for the StackPane object named root from a static modifier to private
  The next static variable down in the declarations at the top of the class is static HBox buttonContainer; and I am also going to change this variable declaration to be a private variable, using the following Java statement:
  Let's make sure that the Java statements inside of the.createSplashScreenNodes() method can still "see" or reference this buttonContainer HBox object, which as you can see in Figure 12-11, they can. I also clicked on the HBox object in NetBeans so that it showed me the object references throughout my code (this is a really useful feature that you should use to visualize how objects relate between different Java 8 programming statements inside of your code). This selected object highlighting is shown in your code inside of NetBeans 8 by using a yellow field highlighting color.
  I had originally declared these fields static because I had read on the Internet, on several of the Java coding sites, that this is an "optimization trick," which allows the JVM to set aside fixed areas of memory, and make the code run more optimally. I have decided to make the objects for my game as encapsulated as possible first, here during the development process, and then look at optimization later on, if and when it becomes necessary.
conversations.from: human
conversations.value: What is the last four paragraphs?
conversations.from: assistant
conversations.value: Add an if-else structure after the bulletType, randomLocation, and iBagelLocation to locate by bulletType
  Since physics calculations tend to use fractional numbers rather than integers, we need to pull the randomOffset out of the compound integer declaration and make it a double randomOffset; declaration, as seen in Figure 17-59. Also, you'll need to declare double variables for bulletGravity and cheeseGravity, and set them equal to 0.2 and 0.1 values.
  What we want to do is to add a bulletGravity (or cheeseGravity) factor to the randomOffset (Y location) on each frame, so we get a slight "tailing off" effect on the shot. This will simulate gravity pulling the Projectile down to Earth. We will put this inside of the if(bulletOffset >= bulletRange) counter loop so that gravity factor is only applied when the projectile is visible flying across the screen. The Java code that incorporates bulletGravity and cheeseGravity adjustments to the Projectile object's trajectories can be seen in Figure 17-60, and should look like the following code:
  Adding physics simulation of gravity to the Projectile object's trajectory in the.shootProjectile() method