Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Unity

457 views

Published on

Introduction to unity3d

Published in: Education
  • Be the first to comment

  • Be the first to like this

Unity

  1. 1. Alexandria University Faculty of Engineering Computer & Systems Engineering Dep.
  2. 2.  Game Development  Unity Interface  Basic Components  Control The Main Character  Game Design  Gameplay  Basic component  Enemy AI  Memory management  optimization  Game Development  Unity Interface  Basic Components  Control The Main Character  Game Design  Gameplay  Basic component  Enemy AI  Memory management  optimization
  3. 3.  The anatomy of a video game  game development process  Game Concepts and Game Play Instruction
  4. 4. A game usually simulates situations where players are supposed to overcome challenges and achieve the goals of the game. The user interacts with the game while playing it and follows the rules of the game. A game usually consists of:  The Rules  The Goals  The Challenges A game usually simulates situations where players are supposed to overcome challenges and achieve the goals of the game. The user interacts with the game while playing it and follows the rules of the game. A game usually consists of:  The Rules  The Goals  The Challenges
  5. 5. 2D Art :  Concept Art  Sprites  Texture Art  UI Artist 3D Art :  Modeling Concept Art  Wrapping & Texturing  Animation 2D Art :  Concept Art  Sprites  Texture Art  UI Artist 3D Art :  Modeling Concept Art  Wrapping & Texturing  Animation
  6. 6.  What is Unity ?  Why Unity  The interface  Execution Order of Event Functions
  7. 7.  A game engine is a software designed to help developing games. The tool incorporates most of the components required in a game such as rendering, scripting, audio, physics, networking and so on.  Companies often go on developing their own engine for their own games.  Unity is a powerful 3d game engine that will allow you to create professional games.  Unity is written in C and C++ but developing a game will be done using C# , java script and Boo.  Unity uses the professional Nvidia PhysX engine to reproduce all in-game physics.  A game engine is a software designed to help developing games. The tool incorporates most of the components required in a game such as rendering, scripting, audio, physics, networking and so on.  Companies often go on developing their own engine for their own games.  Unity is a powerful 3d game engine that will allow you to create professional games.  Unity is written in C and C++ but developing a game will be done using C# , java script and Boo.  Unity uses the professional Nvidia PhysX engine to reproduce all in-game physics.
  8. 8.  Unity plays equally brilliant on 10 global platforms: modern browsers, Android, iOS, Wii, Playstation 3, Xbox 360, Windows, Linux, Flash, and MacOs  Instead of spending your time and budget on independent development for each platform, Unity allows us to actually focus on making games.  Unity allows you to amaze gamers with brilliant full-HD quality and visual effects.  thousands of games powered by Unity  Unity plays equally brilliant on 10 global platforms: modern browsers, Android, iOS, Wii, Playstation 3, Xbox 360, Windows, Linux, Flash, and MacOs  Instead of spending your time and budget on independent development for each platform, Unity allows us to actually focus on making games.  Unity allows you to amaze gamers with brilliant full-HD quality and visual effects.  thousands of games powered by Unity
  9. 9. int main() { Initialize(); while (isRunning) { Process(); Update(); Render(); } ShutDown(); } int main() { Initialize(); while (isRunning) { Process(); Update(); Render(); } ShutDown(); }
  10. 10. There are a number of event functions that get executed in a predetermined order as a script executes. First Scene Load Awake() Before the first frame update Start() Update Order Update() LateUpdate() FixedUpdate() Rendering Culling There are a number of event functions that get executed in a predetermined order as a script executes. First Scene Load Awake() Before the first frame update Start() Update Order Update() LateUpdate() FixedUpdate() Rendering Culling
  11. 11.  Mecanim workflow  Asset preparation and import.  Humanoid character setup.  Bringing characters to life.  Mecanim workflow  Asset preparation and import.  Humanoid character setup.  Bringing characters to life.
  12. 12.  Asset Preparation  triangulated mesh.  Rigging  Skinning  Humanoid character setup  Export & Verify  Asset Preparation  triangulated mesh.  Rigging  Skinning  Humanoid character setup  Export & Verify
  13. 13.  Bringing characters to life:  Mecanim State Machines  Animation States  Animation Transitions  Animation Parameters  Bringing characters to life:  Mecanim State Machines  Animation States  Animation Transitions  Animation Parameters
  14. 14.  Design the game  Terrain edition  Adding Water and Skybox  Import Assets  Lightmapping and Fog  Design the game  Terrain edition  Adding Water and Skybox  Import Assets  Lightmapping and Fog
  15. 15.  Isolated islands  The design of The Island.  The blocks between two islands
  16. 16.  Sketching The Static Environment The dynamic Environment  Sketching The Static Environment The dynamic Environment
  17. 17.  Terrain edition Terrain edition
  18. 18. A skybox is a cubemap—a series of six textures placed inside a cube and rendered seamlessly to appear as a surrounding sky and horizon. This cubemap sits around the 3D world at all times, and much like the actual horizon, it is not an object the player can ever get to. The skybox is simply a cube wrapping the whole scene in.
  19. 19.  placing the game Elements or Models ( props ,Tress, Bridges , Rocks , Houses , static props , particles, Fences ) And Invisible Borders(Colliders ).
  20. 20.  Each Element Consist Of : Meshes ,Textures and Materials. Use a Single Skinned Mesh Renderer Use as Few Materials as Possible Use a small size Of textures
  21. 21.  Lightmapping is the method of baking, rendering to a texture file— the lighting that happens to be affecting a rendered 3D object. This can be done in modeling applications, but Unity also allows you to lightmap all of your lights and environment elements in one. • The horizon line might look a little sharp, we could extend the water to a point that it is far enough or we can blur the vision a little. For this purpose, we use the Fog.  Lightmapping is the method of baking, rendering to a texture file— the lighting that happens to be affecting a rendered 3D object. This can be done in modeling applications, but Unity also allows you to lightmap all of your lights and environment elements in one. • The horizon line might look a little sharp, we could extend the water to a point that it is far enough or we can blur the vision a little. For this purpose, we use the Fog.
  22. 22. The dynamic world don’t have an end The environment is formed by premade blocks that follow one another randomly until The main character reach to the required distance. These blocks are classified in different difficulties, and an algorithm decides the order of the blocks according to the difficulty.
  23. 23.  Each block consists of End point: This point is found at the end of each block to know in which position The Next block will be placed in The game world Collider at the Start: This invisible wall is placed at The start of each block and is triggered to call The function That will generate the next block to be placed as The next block when The main character collides with.
  24. 24. Create The sprite image Attached to a txt file to show for each component in the sprite image its position ( x,y ),width and height. Attach this image to a material
  25. 25. During Random Blocks  Player run as default  Avoid obstacles.  Challenge  Avoid falling in the sea During Random Blocks  Player run as default  Avoid obstacles.  Challenge  Avoid falling in the sea
  26. 26.  Block components:  Waypoints  Static obstacle  Movable obstacle  Collider at the start  End point  Block components:  Waypoints  Static obstacle  Movable obstacle  Collider at the start  End point
  27. 27.  Way Point:  Every way point has left & right way points and can set these way point = null if the way point not has the right or left way point .  Every way point has more than next way points.  Way Point:  Every way point has left & right way points and can set these way point = null if the way point not has the right or left way point .  Every way point has more than next way points.
  28. 28.  During the Island  Player movement  Friends’ role  Enemies’ role  Challenge  Escape from enemies  Time Hardness : Number of enemies and friends increase.  During the Island  Player movement  Friends’ role  Enemies’ role  Challenge  Escape from enemies  Time Hardness : Number of enemies and friends increase.
  29. 29.  During loading  Check the target textures.  Active the target objects  During loading  Check the target textures.  Active the target objects
  30. 30.  Save his friends  Hit the crate  Destroy the crate  Particles  Save his friends  Hit the crate  Destroy the crate  Particles
  31. 31.  Power ups  Increase the power of the player  Arrow  Active the arrow above the player  Power ups  Increase the power of the player  Arrow  Active the arrow above the player
  32. 32.  Player and Enemy  The player hit the enemy  The enemy hit the player  Player and Enemy  The player hit the enemy  The enemy hit the player
  33. 33.  Check The end of the level  Make collision with the end  All friends are free.  Check The end of the level  Make collision with the end  All friends are free.
  34. 34.  The Friends :  After the player free the friend ,The friend follows the player.  Look at the player.  The Friends :  After the player free the friend ,The friend follows the player.  Look at the player.
  35. 35.  The Enemy:  Find path implementation:  With navmesh  With waypoint  The Enemy:  Find path implementation:  With navmesh  With waypoint
  36. 36.  Find Path Implementation:  navmesh:  Apply navigation  way point :  How Enemy attacks the player  Find Path Implementation:  navmesh:  Apply navigation  way point :  How Enemy attacks the player
  37. 37.  Camera  Lighting  Meshes  Skybox  Colliders  Prefabs  Audio  Camera  Lighting  Meshes  Skybox  Colliders  Prefabs  Audio
  38. 38.  Cameras are the devices that capture and display the world to the player.  Layers and Culling mask.  Cameras are the devices that capture and display the world to the player.  Layers and Culling mask.
  39. 39.  Why we used lighting.  Directional lights ◦ Directional lights are used mainly in open places scenes for sun and moonlight.  Point lights ◦ The most common lights in computer games. ◦ Example :Light bulbs.  Spot lights ◦ Spot lights only shine in one direction, in a cone. ◦ perfect for flashlights.  Why we used lighting.  Directional lights ◦ Directional lights are used mainly in open places scenes for sun and moonlight.  Point lights ◦ The most common lights in computer games. ◦ Example :Light bulbs.  Spot lights ◦ Spot lights only shine in one direction, in a cone. ◦ perfect for flashlights.
  40. 40.  Meshes make up a large part of your 3D worlds.  Unity supports triangular or Quadrangle polygon meshes.  Vertices and Edges.  Types of meshes ◦ Mesh Filter ◦ Text Mesh  Mesh Renderer  Meshes make up a large part of your 3D worlds.  Unity supports triangular or Quadrangle polygon meshes.  Vertices and Edges.  Types of meshes ◦ Mesh Filter ◦ Text Mesh  Mesh Renderer
  41. 41.  Material.  Texture.  A Skybox is a 6-sided cube.  Blend.  Material.  Texture.  A Skybox is a 6-sided cube.  Blend.
  42. 42.  Collision and Rigidbody  Basic colliders ◦ Sphere Collider  ping pong balls and rockets ◦ Box Collider  for doors, walls, platforms, boxes ◦ Capsule Collider  Character Controller and unusual shapes.  Collision and Rigidbody  Basic colliders ◦ Sphere Collider  ping pong balls and rockets ◦ Box Collider  for doors, walls, platforms, boxes ◦ Capsule Collider  Character Controller and unusual shapes.
  43. 43.  A Prefab is a type of asset used for clone GameObject.  All Prefab instances are linked to the original Prefab.  Make any changes to the Prefab you will see the change applied to all instances.  A Prefab is a type of asset used for clone GameObject.  All Prefab instances are linked to the original Prefab.  Make any changes to the Prefab you will see the change applied to all instances.
  44. 44.  Audio Listener ◦ acts as a microphone-like device. ◦ Main Camera  Audio source ◦ Audio Clip  contain the audio data used by Audio Sources  Properties  3D Sound  Decompress on load  Compressed in memory ◦ Properties  Play On Awake  Loop  Priority  Audio Listener ◦ acts as a microphone-like device. ◦ Main Camera  Audio source ◦ Audio Clip  contain the audio data used by Audio Sources  Properties  3D Sound  Decompress on load  Compressed in memory ◦ Properties  Play On Awake  Loop  Priority
  45. 45.  Creating waypoints • AI Controller
  46. 46.  Visualization • Movement ― Ordered ― Random  Visualization • Movement ― Ordered ― Random
  47. 47.  Linear-Congruential Generators (LCG) Xn = (a * Xn-1) mod m where m is prime number a is constant number Xn-1 the random number of last iteration  Linear-Congruential Generators (LCG) Xn = (a * Xn-1) mod m where m is prime number a is constant number Xn-1 the random number of last iteration
  48. 48.  Away From Waypoint  How Get Direction  How Get Direction To Player  Properties of enemy ◦ Run ◦ Fire ◦ Walk ◦ Jump ◦ Think  Away From Waypoint  How Get Direction  How Get Direction To Player  Properties of enemy ◦ Run ◦ Fire ◦ Walk ◦ Jump ◦ Think
  49. 49.  Object Stored in Heap. ◦ Allocate and release automatically  Value and Reference Types ◦ Function call and data types.  Allocation and Garbage Collection ◦ Areas in heap. ◦ Block requesting ◦ Small heap with fast and frequent garbage collection ◦ Large heap with slow but infrequent garbage collection  Object Stored in Heap. ◦ Allocate and release automatically  Value and Reference Types ◦ Function call and data types.  Allocation and Garbage Collection ◦ Areas in heap. ◦ Block requesting ◦ Small heap with fast and frequent garbage collection ◦ Large heap with slow but infrequent garbage collection
  50. 50.  Avoid in coding  Lookups  Object pooling and Animations  Textures and optimized 3D models  Profiler  Avoid in coding  Lookups  Object pooling and Animations  Textures and optimized 3D models  Profiler
  51. 51. • Check condition • Triggers • Check condition • Triggers
  52. 52.  Example: Script AI ◦ Sleeping ◦ Limit the amount of call  Example: Script AI ◦ Sleeping ◦ Limit the amount of call
  53. 53. • Functions that give you access to other script or other object i.e Find method. • Time cost • Functions that give you access to other script or other object i.e Find method. • Time cost
  54. 54.  Object pooling ◦ Problem of destroy object ◦ Cost time ◦ Advantage  Animation ◦ Culling Mode to Based on Renderers  Object pooling ◦ Problem of destroy object ◦ Cost time ◦ Advantage  Animation ◦ Culling Mode to Based on Renderers
  55. 55.  Avoid large size  Time of render  Combine together objects that share same materials.  Avoid large size  Time of render  Combine together objects that share same materials.
  56. 56.  What is the profiler.  Process and time  Improve performance of code
  57. 57.  Example: Functions and scripts
  58. 58.  Example: Comparison

×