Game Creation with the Unity Game Engine/Game3 XtremeCurling

= Game 3 : Loui Roui 's Xtreme Curling Championship Simulator 2K14 = As part of the elective subject " Xbox programming " was the based on the XNA Xtreme simulator game " Loui Roui 's Xtreme Curling Championship Simulator 2K14 " which can be controlled using the QWERTY keyboard as well as with the Xbox controller.

The idea for the game
The basic idea was based on programming a realistic simulation of a curling competition. Intended to increase the fun factor will be deposited with different sounds the game, which should underline the mood. Furthermore, it was important for us to use a realistic physics. These calculations have been worked out in advance to the collision behavior of two curling stones around this to use in later steps. Both speed and impact angle were being key factors.

To further enhance the game we already agreed we start to incorporate multiple camera angles on the curling field.



Programming
As a programming platform, we opt for the XNA Framework 3.1. The required 3D model are modeled in Blender 2.69, and then incorporated in. Fbx format in the XNA Framework. Since all team members work at different places in the code, the code was using organized by GitHub. The Git Extension program enabled the versioning of the different program versions and organizes the assembly of code changes.

Right at the beginning, a 3D model of a curling stone was created in Blender which is an important part of the game later. Already on the second day of the first week course could progress to the governance of the stone as well as the integration of 3D elements can be achieved.

As the week has been continuously working on the scope of the game and on the actual gameplay. The current program version includes the following features :

Realistic behavior of the stone :
In order to obtain a realistic behavior of the stone had different criteria are taken into account :


 * Speed ​​loss of curling stone
 * Collision detection
 * Physically correct propagation of two stones in collision
 * Power transmission / transfer speed to hit stone

Control
The stone can be influenced before throwing in three different parameters. Operation is possible both a QWERTY keyboard as well as the Xbox gamepad.


 *  ' Throw - strength ', which is controlled using a Powerbar . This may , at the right moment to stop using the spacebar or the "A" button on the Xbox controller . The stone is then cast at this speed.
 *  ' Orientation ', the direction in which the stone will be thrown . The direction is controlled by an arrow which may vary by 40 degrees.
 *  ' Stone - position ', at the beginning of the match. This can be changed using the Control Pad to right and left.

3D Models
To make the game environment act as possible plastically various three-dimensional elements were installed. The following elements were modeled in Blender:
 * Curling rock
 * ice
 * Guidance Arrow
 * Curling Arena

Gaming experience :
In order to improve the game experience for both graphical, acoustic and physical elements was installed.

The player is represented by two home screens welcomes the game studio, so our development team , and the game imagine. On the second, the two said the player has the option either to start the game as well as look up the controller operation.

{ | Class = " wikitable " ! control
 * [ [File: Controls XC.png | thumb | Control of the game ] ]
 * }
 * }

During the game, the match is accompanied by different sounds depending on the situation. Furthermore, the Xbox gamepad vibrate when a collision between two curling stones.

Individual services == ==

Sebastian Gritzbach === ===

What's .fbx
The format. Fbx is actually a format of Autodesk, 3D objects can be saved with the. It is also the format that XNA uses to implentieren to 3D Models. They are stored in binary or ASCII data. In the second case, the objects can be edited in retrospect, even by text editor. Textures are not stored in. Fbx files and must always accompany with the model.

How do I create .fbx
The create of. Fbx files with Blender is (in itself ) is quite simple. It creates a 3D model and exports it via  ' File> Export > Autodesk FBX ( . Fbx ) "  . It is true but some things to consider :

Modeling
One should note the Modeling as few polygons to produce, since this can lead to performance problems later. Also, one must note that each face has a normal. For example, if one of a cube Deletes an area, the insides are not shown, since this does not offer means normal. Now you can either manually add subsequently normal or passed by " Solidify Modifer " the faces of a certain thickness. This has a second advantage : do you recognize faces from the side, otherwise they sometimes are too narrow and can not be shown. When texturing you should always use rectangular textures whose height / width (in pixels ) are always powers of 2. In addition, UV maps should always be used. Since the automatic Texuturier possibilities of Blender are not applied appropriately. The format of the Texutren can use JPGs, PNGs or BMPs , and it often leads to problems with PNGs. You also have to pay attention to the Kompremierverfahren, especially in JPGs , as these can cause problems later. Best to let the standard procedure of Bildbearbeitungsprogammes set.

Export
Before exporting, you should consider some things. You should see where the center of the object is located. This is also the point of reference will be used later for the position. In addition, the dimension in Blender also be used later. However, one must first " use " all translations. For example, if the object is scaled and rotated, these values ​​are indeed changing in Blender , but can cause problems later and confusions in the Positonierung. Therefore you should all translations ( Loc, Rot , Scale) by pressing "Ctrl + A" to apply , so its value is 1.0.

Import
In the project you have to take the final. Fbx and the corresponding textures in the content part of the project. Often the path of the texture in the. Fbx must be changed. For this you open the. Fbx with a text editor and change the path to fit in the "Relative File Name".

Use it in the project
Need to use the model the following steps are executed.

1. Create Variable for the model Model myModel ;

2. Loading the model ( in the LoadContet ). In this case, the file is located in Content.Models and is called " theFBX ".

myModel = new Floor ( Content.Load  ( "Models \ \ theFBX " ), 0, 0 , 0);

3. Draw the Model.

// Copy any parent transforms. Matrix[] transforms = new Matrix[myModel.Bones.Count]; myModel.CopyAbsoluteBoneTransformsTo(transforms);

// Draw the model. A model can have multiple meshes, so loop. foreach (ModelMesh mesh in myModel.Meshes) {               // This is where the mesh orientation is set, as well // as our camera and projection. foreach (BasicEffect effect in mesh.Effects) {                   effect.EnableDefaultLighting; effect.DirectionalLight0.DiffuseColor = new Vector3(3.0f, 3.0f, 3.0f); //Bright Light effect.DirectionalLight0.SpecularColor = new Vector3(0.0f, 1.0f, 0.0f); //Blue Specular Light effect.World = transforms[mesh.ParentBone.Index] * Matrix.CreateRotationY(myModelRotation) //Sets the Rotation * Matrix.CreateTranslation(myModelPos) //Sets the Position * Matrix.CreateScale(myModelScale);    //Sets a Scalation effect.View = Matrix.CreateLookAt(cameraPosition, //Sets the Position of the Camera and the Point where it is look                       cameraLookAt, Vector3.Up); effect.Projection = Matrix.CreatePerspectiveFieldOfView(                       MathHelper.ToRadians(45.0f), m_aspectRatio,                        1.0f, 10000.0f); }               // Draw the mesh, using the effects set above. mesh.Draw;

Keyboard
The class  Keyboard  represents in XNA the keyboard. This keyboard enables queries. By   GetState method of the current status can be queried.

KeyboardState keyboard state ; keyboard state = Keyboard.GetState ;

Often only simple if  loops are needed to perform a certain action by a keyboard shortcut. For example, an object can be moved by these queries :

if ( keyboardState.IsKeyDown ( Keys.Left ) ) { X.moveLeft ; }

if ( keyboardState.IsKeyDown ( Keys.Right ) ) { X.moveRight );}

Gamepad
Alternatively, the control on a gamepad is possible (Xbox 360 controller). This is represented by the class  GamePadState .

GamePadState gamepad state ;

Since up to four controllers can be connected simultaneously, it is necessary to select  about  PlayerIndex the respective controller. In this case we choose controller  One .

gamepad state = GamePad.GetState ( PlayerIndex.One );

For checking the connection, the  IsConnected  feature is available.

gamePadState.IsConnected

If a connection is successfully established, the controller buttons and knobs can be controlled as keystrokes. In the example, the key  A  is selected.

gamePadState.Buttons.A

Was pressed to check if a key is still a comparison necessary. This is indicated by   ButtonState.Pressed possible.

gamePadState.Buttons.A == ButtonState.Pressed

Since not only keys but also triggers etc. available on the Xbox controller, there are a few other features. To select, for example, the  dPad  (left ), the following call is necessary :

gamePadState.DPad.Left

In parallel, calling the shoulders or other keys is possible. For example:

gamePadState.Buttons.LeftShoulder gamePadState.Buttons.Back

At the Thumbsticks the behavior is a little different. These are bewegungsempflindlich. Depending on which is moved with the intensity and direction of a joystick, different values ​​will be in the form of a vector is returned (value range 0-1 ).

In addition, a vibration of the controller is possible, in contrast to the keyboard controller. By setting two float values, the two motors can be controlled in the controller, while the intensity can be adjusted. ( Values ​​between 0 and 1). To the vibration of the controller again To be issued is merely setting the values ​​to 0.0f, 0.0f  necessary.

GamePad.SetVibration ( PlayerIndex.One, 0.3f , 0.3f );

Play audio files
To use audio effects in the program, the following using directive is necessary :

using Microsoft.Xna.Framework.Media ;

All sound effects are represented by the class  Sound Effect . To add a sound, a new object of the class is created. In this example, a "hit" for a hit of a curling stone is needed.

Sound Effect soundHit ;

In the   LoadContent method, all sound effects are loaded. In this case, the sound file in XNA Explorer is located in the Sounds folder of the directory content.  " 01_Hit "  here is the file name without the extension (preferably the data format. Wav formats ).

soundHit = Content.Load  ( "Sounds \ \ 01_Hit ");

To be able to play the audio file soundHit now, only the following command is required :

soundHit.Play ;

Play audio files in a loop
To play an audio file in a loop is an object of class   SoundEffectInstance necessary. After setting the boolean value  True  at soundHitLoop the file after calling the  Play method is played in a continuous loop.

SoundEffectInstance soundHitLoop ; soundHitLoop = soundHitLoop.CreateInstance ; soundHitLoop.IsLooped = true; soundHitLoop.Play ;

Start Screen / Endscreen
Scene Management ===== ===== Normally, a scene management is essential. Due to the already complex code management was, however, no need for a special scene. To provide, however, a start and a Endscreen the players at his disposal , all the necessary multimedia data have been loaded into the game and controlled by keyboard or gamepad input. The fact that the order of objects in C # are crucial in the Draw method, the start screen of all other objects could be placed so as to be directly at the start of the game visible.

Start Screen - Animation
The animation at the beginning of the game was an original high-resolution GIF animation. Since only during the development of the problem occurred which is not supported by this file format has been resorted to the embedding of a video. After a few failed attempts (problems after the import due to an incorrect video format, a compression wrong or missing audio tracks ) the issue was resolved ultimately by the import into Windows Movie Maker and a subsequent. Wmv export.

For video formats, the class video and video player, as well as the media using directive is necessary.

using Microsoft.Xna.Framework.Media ;

Video vid ; Video Player vidplayer ;

Here is the video a texture assigned, as well as a  Rectangle  generated to fit to the screen :

Texture2D vidTexture ; Rectangle vidRectangle ;

Then the vidplayer is initialized :

vidplayer = new VideoPlayer ;

And then in the  LoadContent method will be loaded (the file name of the video: "Start Screen" ). This video can then be modified in  Rectangle  (X, Y coordinates of the pixel at the top left, width , height).

vid = Content.Load  ( "Start Screen" ); vidRectangle = new Rectangle ( GraphicsDevice.Viewport.X, GraphicsDevice.Viewport.Y , GraphicsDevice.Viewport.Width , GraphicsDevice.Viewport.Height );

The following function is the start of the video is now available:

vidplayer.Play ( vid );

But not only starting, but also other functions such as stopping are possible: vidplayer.Stop ;

Links
Official website of Microsoft XNA, information on functions, video formats etc. http://msdn.microsoft.com/en-us/library/bb200104.aspx Overview of all important functions around XNA (including explanation ) http://www.xnamag.de/index.php Tutorials and information about XNA http://www.xnadevelopment.com/tutorials.shtml Yotubue Tutorials by Code Made Easy https://www.youtube.com/watch?v=exqk0lH7-xc&list=PLDC1A9D5C3F8ED318

Patrick calf === === Philip Lienert === ===

The project my task was to make it all the graphical elements of the game. All graphics were created in Photoshop and then built using the XNA framework to the respective right place in the code. The Start screen includes an animation which was also created in Photoshop, then saved in Premiere Pro with sound and has been incorporated into the game.

The design should thereby be created, especially among modern frame points. Nevertheless, it should not be left to the Extreme - factor except eight. The logo of our development studios should be kept simplicity as possible, so that it can impress as easily as possible. This simplicity was the motto which is why I have created a largely monochrome logo.

A completely different approach to design, I went in the actual design of the game. Here the focus was clearly on an extreme and eye-catching design. The logo should jump directly to the start screen appear Des eye. The reason for this design was that we want to enhance the relatively inconspicuous sport of curling through the design extreme. The Splatterbrushes in the background of the logo are more eye-catching.

Furthermore, I have been looking after the team entry listed above, which will summarize the project in a few words.

The following is an excerpt of the work :

{ | Class = " wikitable " ! Logo of the development studio ! Start Screen ! Control ! Curling Field
 * [ [File: First page.png | thumb | development Studio ] ] | | [ [File: Startscreen.gif | thumb | Home Screen] ] | | [ [File: Controls XC.png | thumb | Control of the game ] ] | | [ [File: Curling Feld.jpg | thumb | first version of curling field ] ]
 * }
 * }