Description.rtf 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. {\rtf1\ansi\deff0\nouicompat{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
  2. {\*\generator Riched20 10.0.10586}\viewkind4\uc1
  3. \pard\sa200\sl276\slmult1\b\f0\fs44\lang9 Tetris 3D\fs22\par
  4. \par
  5. \fs36 Description \fs22\par
  6. \b0\lang1033 This is a 3d Tetris game in threejs. There is an orbital camera around the center and a cubic area in which different shaped blocks drop and occupy sub cubic areas. When a layer is fully occupied then the layer's blocks disappear and the left one re-arrange properly.\par
  7. \b\fs36 Game Structure\fs22\par
  8. \i The structures of the game: \par
  9. \b0\i0\tab - GameBox\par
  10. \tab\tab The area in which the game takes place. Consists of several `Layers`.\par
  11. \tab - Layer\par
  12. \tab\tab A 2D array of quantum cubic area.\par
  13. \tab - Quanto\par
  14. \tab\tab Smallest cubic area everything is made of.\par
  15. \tab - Shape \par
  16. \tab\tab Abstract class to extend and create some dropable blocks. Properties are an array of positions(definition of block), position, rotation and a material.\lang9\par
  17. \b\i Object Logic\b0\i0\par
  18. \tab\ul Quanto\par
  19. \ulnone\tab Quanto is a class that has only a threejs node as a property and some helper variables like occupied flag.\par
  20. \tab\ul Shapes\par
  21. \ulnone\tab There will be several shapes and their information is stored as an array of positions relative to their origin and relative to their position and rotation. According to the information a partial graph scene will be created for the block with the correct position and rotation. Shape has no logic but precomputing while used mainly as a structure for data storage.\par
  22. \tab\ul Layers\par
  23. \ulnone\tab Layers consists of a 2D array of \i Quanto\i0 which are unoccupied in the beginning. These \i Quantos \i0 can be occupied by a shape.\par
  24. \tab\ul GameBox\par
  25. \ulnone\tab GameBox is the main class of the game that performs all the logic. It has the progress function that moves the game one step like in normal tetris, traversing the array of \i Layers\i0 down to \i\lang1033 Quantos \i0 and rearranging appropriately. In every progress call the scene is manipulated by this class. \par
  26. \par
  27. \b\lang9 Class Diagram\par
  28. \ul\b0 Quanto\par
  29. \ulnone - node : ThreeJS Entity\par
  30. - occupied : bool\par
  31. - temporary : bool\par
  32. \ul Layer\ulnone\par
  33. - quantos : Array [][]\par
  34. - isOccupied() : bool function \par
  35. - clear() : void\par
  36. \ul GameBox\par
  37. \ulnone - scene : ThreeJS Scene\par
  38. - layers : Array []\par
  39. - currentShape : Shape\par
  40. - checkState() : short // gamestate 0: in progress, 1: winning, -1:losing\par
  41. - progress() : void\par
  42. - isTime() : bool // returns whether STEPTIME has passed\par
  43. - setup( SizeX, SizeY ) : void \par
  44. - move(x,y) : void // moves current Shape \par
  45. - rotate(degrees) : void // rotates current Shape\par
  46. - checkColisions() : void // check collisions \par
  47. \ul Shape (abstract)\ulnone\par
  48. - geometry : array[positions]\par
  49. - position : Vector3\par
  50. - rotation : Degrees\par
  51. - node : ThreeJS Entity\par
  52. \b\fs28 Precomputing/Initializing\par
  53. \b0\fs22 - Initialization starts on GameBox which will initialize an array of Layer instances which will initialize an array of Quantos. \par
  54. - Camera must be created with orbital controls\par
  55. - Creation of the scene with a plane and a skybox\par
  56. - Setup event Listeners for playing the game\par
  57. - Scene initialization\par
  58. - Attach Gamebox Scene to the main scene\b\fs28\par
  59. Gameloop\par
  60. \b0\fs22 The gameloop goes as follows : \par
  61. Every frame : \par
  62. \tab if box.isTime() then box.progress() // internal scene update\par
  63. On Event : \par
  64. \tab box.move(event) \par
  65. \tab or \par
  66. \tab box.rotate(event)\par
  67. \par
  68. }