123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- {\rtf1\ansi\deff0\nouicompat{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
- {\*\generator Riched20 10.0.10586}\viewkind4\uc1
- \pard\sa200\sl276\slmult1\b\f0\fs44\lang9 Tetris 3D\fs22\par
- \par
- \fs36 Description \fs22\par
- \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
- \b\fs36 Game Structure\fs22\par
- \i The structures of the game: \par
- \b0\i0\tab - GameBox\par
- \tab\tab The area in which the game takes place. Consists of several `Layers`.\par
- \tab - Layer\par
- \tab\tab A 2D array of quantum cubic area.\par
- \tab - Quanto\par
- \tab\tab Smallest cubic area everything is made of.\par
- \tab - Shape \par
- \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
- \b\i Object Logic\b0\i0\par
- \tab\ul Quanto\par
- \ulnone\tab Quanto is a class that has only a threejs node as a property and some helper variables like occupied flag.\par
- \tab\ul Shapes\par
- \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
- \tab\ul Layers\par
- \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
- \tab\ul GameBox\par
- \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
- \par
- \b\lang9 Class Diagram\par
- \ul\b0 Quanto\par
- \ulnone - node : ThreeJS Entity\par
- - occupied : bool\par
- - temporary : bool\par
- \ul Layer\ulnone\par
- - quantos : Array [][]\par
- - isOccupied() : bool function \par
- - clear() : void\par
- \ul GameBox\par
- \ulnone - scene : ThreeJS Scene\par
- - layers : Array []\par
- - currentShape : Shape\par
- - checkState() : short // gamestate 0: in progress, 1: winning, -1:losing\par
- - progress() : void\par
- - isTime() : bool // returns whether STEPTIME has passed\par
- - setup( SizeX, SizeY ) : void \par
- - move(x,y) : void // moves current Shape \par
- - rotate(degrees) : void // rotates current Shape\par
- - checkColisions() : void // check collisions \par
- \ul Shape (abstract)\ulnone\par
- - geometry : array[positions]\par
- - position : Vector3\par
- - rotation : Degrees\par
- - node : ThreeJS Entity\par
- \b\fs28 Precomputing/Initializing\par
- \b0\fs22 - Initialization starts on GameBox which will initialize an array of Layer instances which will initialize an array of Quantos. \par
- - Camera must be created with orbital controls\par
- - Creation of the scene with a plane and a skybox\par
- - Setup event Listeners for playing the game\par
- - Scene initialization\par
- - Attach Gamebox Scene to the main scene\b\fs28\par
- Gameloop\par
- \b0\fs22 The gameloop goes as follows : \par
- Every frame : \par
- \tab if box.isTime() then box.progress() // internal scene update\par
- On Event : \par
- \tab box.move(event) \par
- \tab or \par
- \tab box.rotate(event)\par
- \par
- }
- �
|