Ion-Physics Puzzles and Exploration 3D Videogame
Abstract
In this document is presented the whole related work of the project. In it is explained what type of project is as well as what are the phases that composes it. The project consist mainly in a 3D playable demo made with Unity. Its main characteristics are the use of default sphere physics for the puzzles and the use of the terrain and tree modeling tools included in Unity for all the modeling involved in the game world to enhance the exploration part of the game. The game is in first person and is only made for PC.
Full text
Videogamedesignanddevelopmentdegree Finaldegreeproject’sTechnicalReport Ion-PhysicsPuzzlesand Exploration3DVideogame Author:HéctorRuizMarco Tutor:JoséMartinezSotoca
2
Summary In this document is presented the whole related work of the project. In it is explained what type of project is as well as what are the phases that composes it. The project consist mainly in a 3D playable demo made with Unity. Its main characteristics are the use of default sphere physics for the puzzles and the use of the terrain and tree modeling tools included in Unity for all the modeling involved in the game world to enhance the exploration part of the game. The game is in firstpersonandisonlymadeforPC. Keywords:Unity,Videogame,3D,FirstPerson,Puzzle,Physics,Exploration 3
Índex Summary 3 FiguresIndex 7 Introduction 10 ProjectSpecifications 11 Story 11 Mechanics 12 3DDesign 13 Software 14 Motivation 15 Objectives 16 Justification 17 InitialPlanning 18 Design 20 VisualStyle 21 Mechanics 24 Puzzles 24 Feedback 27 Exploration 27 Environment 29 Architecture 30 Development 33 InitialTests 33 Terraintool 33 Treetool 35 Shaders 35 Lighting 36 CameraEffects 36 Assets 37 ArtDevelopment 39 GameWorld 39 Modeling 42 2DArt 43 Sound 46 TechnicalDevelopment 47 4
MainMenu 47 Physics 49 Effects 50 Sound 50 Ambiental 50 AreaMusic 51 Modifiers 51 Feedback 51 Footsteps 51 Physics 52 Camera 52 Antialiasing 52 AmbientOcclusion 52 Bloom 53 Environment 53 Fog 53 Particles 54 LightShafts 57 VolumetricLights 58 Shaders 59 Water 59 Toon 60 CelKernel 60 Animations 62 Scripts 63 PlayerScripts 63 FirstPersonController 64 CursorInteractions 65 PlayerWalkableArea 66 Rider 67 MapController 68 Activator 68 PuzzlesScripts 69 PuzzleController 69 SpherescopeController 70 CableController 70 MicroOrbController 70 AudioScripts 71 BackgroundMusicController 71 HighVolume 71 5
PhysicalSound 71 DebugScripts 72 TakeScreenshot 72 FPSDisplay 72 MenúsScripts 72 Fader 73 SceneLoader 73 GameControl 73 EffectsScripts 74 PositionLerper 74 SynchronizedPosition 76 Effects 76 ShaftAdapter 76 Rotator 76 MeshFader 77 Optimizations 78 Baking 78 OcclusionCulling 80 PostProcessingStack 81 Results 83 FinalPlanning 93 Conclusions 94 Objectives 94 ProblemsandSolutions 96 FinalBake 96 Terrain 97 Bibliography 99 References 99 Documentation 99 Assets 99 Tools 100 6
Figures Index Figure1:ExampleoftheWorldMap 11 Figure2:PhotoofaSuperplexus 12 Figure3:TheWitnessgraphicstyle 13 Figure4:Rimegraphicstyle 13 Figure5:Rocks’stylecomparison 21 Figure6:ColorcontagioninTheWitness 22 Figure7:WithoutFinalGather(left)andwithFinalGather(right)comparison 22 Figure8:EmissivefoliageeffectinTheWitness 23 Figure9:GrassstylefromZelda:BreathoftheWild 23 Figure10:Puzzlesketch 25 Figure11:Blackandwhitepuzzles’sequenceinTheWitness 25 Figure12:Puzzles'learninganddifficultycurvesdesign 26 Figure13:Keys’sketch 28 Figure15:Islandmapsketch 30 Figure16:Architecturecolorsreference 31 Figure17:Temple'sarchitecturereferenceandtemple'sarchitecturesketch 31 Figure18:Lighthouse'sarchitecturereferenceandlighthouse'ssketch 32 Figure19:Romanicaqueduct 32 Figure20:Terraintestfullofgrass 33 Figure21:Terraintoolwithoptimizedoptions 34 Figure22:MaterialexamplewithoutGlobalIllumination 36 Figure23:Neoneffectinatestmap 37 Figure24:Sunshaftseffectinatestmap 38 Figure25:NaturalrampelevationintheterrainintheUnityEditor 39 Figure26:PaintHeighttoolfromTerraintool 40 Figure27:Raise/LowerTerraintoolfromTerraintool 40 Figure28:SmoothHeighttoolfromTerraintool 41 Figure29:PaintTexturetoolfromTerraintool 41 Figure30:Lighthousemodel,floormodelandwallmodelin3dsmax 42 Figure31:Exampleofdifferentmodelsmadewith3dsmax 43 7
Figure32:Originaltexture(left)andmodificatedtexture(right) 43 Figure33:Skyboxfinalversion 44 Figure34:Originalgrass(left)andmodificatedgrass(right) 45 Figure35:Imageofthedifferentcursorstates 45 Figure36:Finalversionoftheislandmap 46 Figure37:Finalversionofthegametitle 46 Figure38:CanvasScalerconfiguration 47 Figure39:Particlesinthetitle 48 Figure40:LightShaftintensitycomparison 48 Figure41:ObjectsaschildsofthewaterplaneintheHierachy 49 Figure42:Antialiasingsettings 52 Figure43:AmbientOcclusionsettings 53 Figure44:Bloomsettings 53 Figure45:WithandwithoutHeightFogeffectcomparison 54 Figure46:Fireparticlesmaterial 55 Figure47:Fireparticlesystemrenderer 56 Figure48:Finalfireparticleseffect 56 Figure49:Waterfoameffect 57 Figure50:Shinyfloatingdotseffect 57 Figure51:Sunshaftseffect 58 Figure52:WithandwithoutVolumetricLighteffectcomparison 59 Figure53:Watershaderwithandwithouttransparentplanecomparison 59 Figure54:Standardshader(left)andCelShadingshader(right)comparison 60 Figure55:DiffuseTypes,fromlefttoright,basic,frontalandmixed 61 Figure56:CelKernelshadermaterialexamplesfortheorbs 62 Figure57:Catapultanimationgraphandcatapultanimationtimeline 63 Figure58:PlayerScriptsflowchart 64 Figure59:FPCfinalconfigurationwithBobbingandJumpoptionsdeactivated 65 Figure60:DefinedfootstepssoundsandWalkablemaskfromPlayer 67 Figure61:Dockwithbellandboat 68 Figure62:Foldedmapinastonenexttothefireplace 68 Figure63:PuzzleScriptsflowchart 69 Figure64:MenuScriptsflowchart 73 8
Figure65:Lowtide(above)andhightide(below)comparison 75 Figure66:Openeddoor(left)andcloseddoor(right) 75 Figure67:RotatingringsfromtheGyroTemple 77 Figure68:MeshFadereffectwhentakingtheredkey 77 Figure69:BakedGIoptions 78 Figure70:LightmapStaticoption 79 Figure71:GenerateLightmapUVsoption 79 Figure72:OccluderandOccludeeStaticoptions 80 Figure73:BakingOcclusionprocess 81 Figure74:MaterialexamplewithHDRemissionof3 82 Figure75:Bedroom 83 Figure76:Statueelevator 84 Figure77:Lighthouseoutsideandbridge 84 Figure78:Firstzoneoftheisland 85 Figure79:Beachzone 85 Figure80:Firstkeyzone 86 Figure81:Secondkeyzone 86 Figure82:Hangingbridgeszone 87 Figure83:Thirdkeyzone 87 Figure84:GyroTemple 88 Figure85:Firstpuzzlessequence 89 Figure86:Orbincatapult 89 Figure87:Invertedpuzzlewaitingtobesolved 90 Figure88:Outdoorwoodelevator 90 Figure89:Brokenwoodbridgeandsharkrocks 91 Figure90:Lighthousefromthedistance 91 Figure91:Finalscenewithlighthousebeingilluminated 92 Figure92:Newbakesettings 96 Figure93:Lighthousebakeartifactsnearthedoorandnearthestairs 97 Figure94:Rockarchreference 98 9
Objectives · Obj 1: Make a playable demo of a 3D videogame for PC in first person that will use the spheres physics as main mechanic and that will contain an free explorable scenario. · Obj 2: The demo will focus exclusively on one of the six proposed islands, but tryingtoshowavarietyofenvironmentsinit,includingthenavigationsystem. · Obj 3: The scenarios of the game will be pleasing to the eye using a colorful aesthetic without textures and the modeling will be low-medium poly without excessivedetail. · Obj 4: The terrain, grass and tree tools included in Unity will be used to create thescenario. ·Obj5:Itwillbeimportantthatthegamehasagoodsoundenvironment. ·Obj6:Theinterfacewillbeascleanandclearaspossible. ·Obj7:Thesoundandinterfaceshouldtransmitgoodfeedbacktotheplayer. · Obj 8: The difficulty and learning curves will be well balanced, allowing the player to learn and understand the mechanics little by little without any kind of tutorial. 16
Justification As I mentioned before, many video game developers now choose to focus on realistic graphics and on complicated or repetitive mechanics. In the videogame industry such games abound. However, I think that videogames are a way of abstracting us from the world around us and introducing us to a completely new world that is unknown to us at first and that we learn its characteristics little by little. If you use realistic graphics that are reminiscent of the real world, you already know what surrounds you and all that immersive experience is diluted. The same applies for the mechanics. If they are elaborated and complicated or very monotonoustheyendupboringtheplayerandheendsupstopplaying. In this project I want to avoid this kind of thing and I want to offer the player an immersive experience in which appear situations that encourage him to continue playing and exploring the world around him and to continue learning about everythingthatthegameproposestohim. 17
InitialPlanning The project is divided into different tasks established as follows with their time estimations: T1.Writethetechnicalproposal[5h] T2.TestsonUnityoflighting,shaders,optimization,terrainsandothers.[24h] T3. Design: It includes all aspects of the demo that will be performed, such as mechanics, scenarios, puzzles, models, interface, game flow, difficulty and learningcurves,soundandvisualfeedback,story,etc.[90h] T4. Modeling: It includes all the elements of the scene realized in 3dsmax, like the lighthouse, the Gyro temple, the rails, the catapults, the rocks, the puzzles, the keys,etc.[50h] T5. Programming: It includes the movement of the First Person Controller and the camera, interaction with the stage, puzzles, normal sound and sound of physics, controloftheboat,catapultsandmanyotherdetails.[70h] T6.Lookforresourceslikesounds,texturesandassets.[16h] T7. Montage: It includes all the assembly tasks of the scenario in the Unity editor that are terrain modeling, tree modeling, placing of textures and grass, animations, modeling of bridges and placement on the stage of all the elements suchaspuzzles,rails,temples,lighthouse,catapultsandrocks,amongothers T8.WritetheTechnicalReport[45h] T9.Preparethefinalpresentation[10h] 18
The following table shows in more detail all the tasks performed daily according to the initial planning that was decided. In this planning that goes from Tuesday to Saturday, every day is dedicated 4 hours to the indicated tasks, making a total of 300hours: SEMANAS MARTES MIÉRCOLES JUEVES VIERNES SÁBADOS 13,febrero/ 19,febrero Pruebasde terrenos,cesped, arboles,etc Pruebasdeshadersy materiales Pruebasde iluminaciónyefectos BuscarTexturas, SonidosyMúsica Crearmateriales. Pruebaspartículas fuego 20,febrero/ 26,febrero AñadirFPC. CrearOrbes ScriptPhysicalSound ScriptActivatory PositionLerper ScriptInteractuator+ CursorSprites AñadirFog. Modelarescenario depruebas 27,febrero/ 5,marzo Diseñar,modelary configurarGyro,y Estatua Diseñar,modelary configurarPuerta+ Pared BuscarshaderAgua AñadirOcéanoal escenario Diseñar,dibujary añadirSkybox. TestingSemanal Redactarpartede lamemoriafinal 6,marzo/ 12,marzo AñadirMenús (versiónbásica) Soportedesonido paraActivatory PositionLerper ReconfigurarFPC (FirstPersonControlle r) ScriptWalkableAreas TestingSemanal Redactarpartede lamemoriafinal 13,marzo/ 19,marzo Diseñarelfaro (parte1) Diseñarelfaro (parte2) Modelarelfaro (parte1) Modelarelfaro (parte2) TestingSemanal Redactarpartede lamemoriafinal 20,marzo/ 26,marzo Añadirpartículasy efectos(Shafts, Ambient Occlusion...) Transicionesentre escenarios. Pruebasde Optimización (OcclusionCulling) Buscarfuentedetexto yadaptarlainterfaz TestingSemanal Redactarpartede lamemoriafinal 26,marzo/ 2,abril Diseñarhabitación inicialdeljuego Modelarhabitación inicial(parte1) Modelarhabitación inicial(parte2)+ Materiales Modelarhabitación inicial(parte3)+ Materiales TestingSemanal Redactarpartede lamemoriafinal 3,abril/ 9,abril Diseñarescenario (parte1) Diseñarescenario (parte2) Diseñarescenario (parte3) Diseñarescenario (parte4) TestingSemanal Redactarpartede lamemoriafinal 10,abril/ 16,abril Diseñarpuzzles (parte1) Diseñarpuzzles (parte2) Crearterrenobase delescenario (parte1) Pintarterrenodel escenario TestingSemanal Redactarpartede lamemoriafinal 17,abril/ 23,abril Diseñarpuzzles (parte3) Sonidodepasosdel FPCsegúnelsuelo Programarpuzzles (parte1) Sonidospuzzlese interacciones TestingSemanal Redactarpartede lamemoriafinal 24,abril/ 30,abril Crearterrenobase delescenario (parte2) Dibujarcésped Ponercéspedenel terreno Modelarárbolesy rocas Ponerárbolesyrocas enelescenario TestingSemanal Redactarpartede lamemoriafinal 1,mayo/ 7,mayo Diseñarpuzzles (parte4) Programarpuzzles (parte2) DiseñarMenús, interfazytítulo Dibujarelartedela interfazdelosmenús yeltítulodeljuego TestingSemanal Redactarpartede lamemoriafinal 8,mayo/ 14,mayo Programarpuzzles (parte3) Programarpuzzles (parte4) BuscarSFX Añadirtodoslos sonidoaljuego TestingSemanal Redactarpartede lamemoriafinal 15,mayo/ 21,mayo Diseñoy programaciónbarca Diseñoy programación catapultas Bordearconpiedras losacantilados delasislas Pruebasendiferentes ordenadoresy pantallas(resolución) TestingSemanal Redactarpartede lamemoriafinal 22,mayo/ 28,mayo Añadirpequeños detalles Testingdelademo final Optimizareljuego (OcclusionCulling) TestingSemanal Redactarpartedela memoriafinal Testingdel proyectofinalcon otraspersonas In the section of Final Planning will explain what changes have been and what has beentheactualplanningthathasbeencarriedout. 19
Design The design is a very important part involved in any development of a video game, since it includes from the artistic and sound section, to the mechanics and rules of game passing through history and architecture among others. In this project it has beennecessarytodesignallthisandmuchmore. One of the first things to do in order to start designing is to look for references and create a factory of ideas. For this, all types of images and folders have been compiled with references that include scenarios, artistic styles, different architectures, natural elements, concrete objects, etc. For this project, almost 2000 reference images have been collected. Throughout this section will be showingsomeofthemthataremorerelevant. On the other hand, once you have all the references it is time to start making different sketches of all the aspects involved in the project. In this case, sketches of the stage, the lighthouse, the temple, the puzzles and everything that is related totheinitialidea. 20
VisualStyle At the beginning of the project, it was unknown what the mechanics of puzzles with spheres physics would consist of. The only thing that was known is that is wanted to create a large stage, pleasing to the eye and freely explorable with a camera in first person. For this, the first of all is the visual style, which as previously mentioned, is based on games like The Witness and Rime, which give much importance to the color and high saturation of the same, achieving very alive landscapes. They use flat colors or very subtle textures that allow to highlight the importance of shapes and reliefs with the use of lights and shadows. In addition they use modeling without much detail almost low-medium poly. In order to apply thisvisualstyleyoumustfirststudyit.Thisisdiscussedindetailbelow. Figure5:Rocks’stylecomparison The first thing to analyze are the textures. If you compare the rocks of Figure 5 you can see that the ones on the left have a texture that is used to highlight the shape of the rock while in the one on the right the texture is merely decorative and the shape of the rock Is highlighted by light and shadows. In this project is wanted to achieve the effect shown on the right, that is, the lighting is the one who handle the shaping of the elements on the stage. To help highlight the relief, theAmbientOcclusion effectwillalsobeused. 21
Figure6:ColorcontagioninTheWitness Figure 6 shows another of the effects to be achieved. It is the color contagion. On the ground you can see how it reflects slightly the purple color of the plants on the right or on the ceiling, on the left, you can see that it starts to take on a greenish tonality due to the vegetation that is on the other side of the wall. To achieve this effect is used what is called Final Gather . Through a series of bounces and calculations by the scene, this effect is painting and accumulating color where it bounces. To be able to apply this effect it will be necessary that the illumination of the scene is baked, that is to say, that it is not calculated in real time but that isappliedwithprecalculatedtextures.ThiseffectcanbeseenbetterinFigure7. Figure7:WithoutFinalGather(left)andwithFinalGather(right)comparison 22
Another important aspect of this visual style is the vegetation. In The Witness, both the foliage of the trees, and the flowers and the grass, seem to have a glowing appearance almost as if they were emitting light. To achieve this effect it will be necessary to use the Emission property in the materials used for the leaves ofthetrees.ThiseffectcanbeseeninFigure8. Figure8:EmissivefoliageeffectinTheWitness As for the grass, because it will be placed using the tool that comes integrated in the tool of creation of land of Unity, it will be complicated to adapt it and to modify it so that it resembles to the visual style raised. To do this, special attention must be paid to the shape and color of the grass leaves. In the Figure 9 it is possible to appreciate better the style of the grass that is wanted to try to achieve. Figure9:GrassstylefromZelda:BreathoftheWild 23
Mechanics As for the mechanics, they started based on the so-called Marble Machines [1], which are small circuits by which a series of marbles roll. The idea was that the scenario of the game would be one of these circuits and that the player in first person could interact with different elements and mechanisms to help the orb to continue advancing correctly by the circuit until arriving at the lighthouse. However the mechanisms of the Marble Machines are very advanced and require many hours of design and modeling and there was no time for all the rest of the things they wanted to do, so is chosen to simplify the idea. It kept the idea of the circuit that carried the orb from its initial point to the lighthouse, but they were only a series of rails by which the ball fell and roll. During this tour, the orb encounters different obstacles and the player must solve them so that the orb continues to advance. These obstacles require the resolution of puzzles, which are puzzles based on spheres physics. As explained above, these puzzles are based, on the one hand, on a previous project called Hexascope and on the other hand, in the so-called Superplexus [2]. It is a combination of both concepts and the result is explainedbelow. Puzzles Along the stage you will find a kind of pedestals or stone columns that have a spherical element of transparent glass in the upper part. This glass sphere is the one that works as a superplexus and the player can rotate it on both its x-axis and its y-axis. Inside the sphere there are one or more micro orbs that can be blue or red. In turn, the sphere has one or more ring shaped exits, which may also be red or blue. The initial concept is that the player must rotate the sphere to make the orbs fall through the exits of their same color. A small initial sketch is shown in Figure10. 24
Figure10:Puzzlesketch However, the idea is that to this initial basic concept will be added small variants that will gradually appear as you progress in the game. For the demo, only the color variant of the base is added. The pedestal has a ring on the base that normally lights up in blue when the puzzle is available to be solved. However there will come a time when in some puzzles the base will be illuminated in red instead of blue. The blue color indicates that it is a normal puzzle and the red color indicates that it is an inverted puzzle. This means that if the base is red, instead of introduce the orbs through the exit of the same color, you have to enter the orbs through the exit of the opposite color. Therefore in inverted puzzles, blue orbs must be inserted into the red exit and the red orbs into the blue exit. This concept may seem strange or over complicated at first but thanks to the good design of the learning curve, the player will learn this easily without any tutorial. In The Witness is made a very good use of the learning curve, introducing the mechanics of the puzzles little by little and increasing the difficulty progressively. In Figure 11 you can see a sequence of puzzles in this game. Without needing to explain what these puzzles consist of, you can see that each panel, how much morecomplexitlooksfromlefttoright. Figure11:Blackandwhitepuzzles’sequenceinTheWitness 25
As for the lighthouse, it has been based on the oriental stone lanterns, since they are tall structures and with straight sides. In Figure 18 we can see both the referenceimageandthesubsequentsketchthathasbeenmade. Figure18:Lighthouse'sarchitecturereference(left)andlighthouse'sarchitecturesketch(right) Another important structure is the large stone bridge that connects the lighthouse with the island. For this structure it has been decided to rely on the typical Roman stoneaqueducts,ascanbeseeninFigure19. Figure19:Romanicaqueduct 32
Development InitialTests First of all before starting to develop anything of the game is needed to do all kinds of tests in Unity to see the different possibilities there are and know which ones to use, as well as look for some complementary and alternative assets. The followingtestswerecarriedout: Terraintool The first tool to test is the terrain modeling tool. Is wanted to use this tool on one side to accelerate the process of creating the environment and on the other side to use the option of grass placement that comes integrated. The tests consist mainly of seeing how the tool works and how optimized the grass rendering is. Being a tool that is based on the operation of height maps to generate the terrain, you can not model structures such as stone arches or structures that are wider above than below. For each value of X and Z, there can only be one Y value of height. Therefore this is a disadvantage that has this tool, since if you wanted to do something more advanced would need to be molded separately with some external toolsuchas3dsMaxorBlender. Figure20:Terraintestfullofgrass 33
To test the optimization of the grass, a test map with a simple terrain filled with grass has been created as shown in Figure 20. In it a First Person Controller has been placed, the one that comes by default in the standard assets of Unity. Doing this and running the game in fullscreen, the fps were reduced to about 10, therefore did not seem very optimized. In order to try to improve it, we have studied the different options of this tool [5] and some of them have been modified. Figure21:Terraintoolwithoptimizedoptions 34
One of these options is Detail Distance , which is the maximum distance at which the grass is rendered. By default this is 250 which is the maximum but you can reduce it so that it does not render grass that is far away and that you really can not see. Another option is Detail Density that varies between 0 and 1 and the default is 1. This value allows to define the density of grass that is in each unit of area. The lower, the less grass there will be. Finally the most important option that has turned out to be a big difference in optimization is Detail Resolution Per Patch , which allows you to define the size of the square area that is rendered in a single draw call. By default this value is 8, which is the minimum. However, putting it to the maximum, which is 128, drastically reduces the number of draw calls needed to render. For this option to take effect, it is important to check the Collect Detail Patches checkbox. Thanks to all these changes, especially the last one, if you try again the scene, you get 60fps. The final options that have been chosenareshowninFigure21. Treetool On the other hand is the tree modeling tool. It has been tried to model some test trees and is quite easy and intuitive although it can be tedious if you want to make trees with many branches. To reduce the workload, this tool will be used, but only simple trees with few branches were modeled. This decision is also partly to maintainthelow-mediumpolystyleofthegame. Shaders As previously mentioned, the visual style is based on games like The Witness and Rime, which give much importance to the color and high saturation of the same and highlight the importance of shapes and reliefs using lights and shades. To try to imitate this type of lighting has chosen to try different shaders of cel shading and toon shading. Toon shading shaders already come by default in the Unity standard assets. As for the shaders of cel shading, they have been obtained freely in different web pages [6]. However, both types of shaders have finally been discarded for not producing the desired effect and in return the standard shader will be used with vibrant and flat colors and with a slight Emission effect to increase the saturation. It is important that the Emission Global Illumination be markedasNone sothatitdoesnotilluminatethescene,asshowninFigure22. 35
Figure22:MaterialexamplewithoutGlobalIllumination Even so, some materials have been kept with the toon shader for elements such as rocks, trunks and some metals, to produce variations of saturation and interesting reflections, which simulate streaks in the rocks or glitterings in some metals. In addition, a own shader has been developed based on cel shading. This shader has been used for orbs and causes objects to have a colored kernel inside them. The shaderswillbeexplainedinmoredetaillater. Lighting Lighting is an important aspect to take into account especially for the visual style that is wanted to achieve. However real-time lighting consumes too much and reduces fps drastically. This is mainly due to the amount of shadow casters in the scene and the complexity of the models. Therefore bake lighting is used. Different bake testing has been done with different options to know how it works and how to configureitwhenthefinalbakeisneededtobedone. CameraEffects In Unity's standard assets a series of effects that can be applied to the camera are included. These effects improve and enhance the visuals, but they consume too much and greatly decrease the fps. Therefore, despite wanting to use many of these effects, in the end has chosen to use only those strictly necessary such as Antisliasing and Ambient Occlusion . Although the Ambient Occlusion will already 36
be calculated when the bake is done, this Ambient Occlusion in real time achieves much more accurate results than the one that gets the bake, so that is why it has been decided to use it. However being in real time, the fps suffer enough especiallywhenthereisalotofgeometry. Assets In conjunction with the camera effects, it has been wanted to add another series of effects that allow for example to simulate neon effect or height fog effect. These effects have been obtained from the asset store or free form different web pages. On one side there is the asset MK Glow Free [7] that allows to create materials that produce neon or incandescent effect. This requires the use of a camera effect to be able to render these materials correctly, which also causes the fps to drop. This effect is used as a feedback element in the different puzzles and in the wiring of the stage as well as the buttons. Lets you know the player when an item is on or off. On the way back, the player must follow the cables as they light up to know whatrouteshouldfollow,soyoucouldsaythatthecablesalsoworkasaguide. Figure23:Neoneffectinatestmap On the other hand there is the Light Shafts asset [8] which allows to create lightbeams as well as to simulate the effect of sun shafts and even of height fog. In the project will be used for all these aspects. On the one hand, like dense fog 37
inside the lighthouse to give a more immersive effect. On the other hand as a sun ray effect to improve the visuals. And finally as lightbeams like feedback illuminating certain zones and puzzles so that the player knows in each moment wherehehastogoandwhichway. Figure24:Sunshaftseffectinatestmap Finally there is the Volumetric Lights asset [9] which allows to do things similar to the previous asset, but in this case, the use that is going to give is the area lighting. This will be applied to Pointlights and serves not only to illuminate the geometry with which it impacts, but also to illuminate the entire spherical area. This will be used for practically every spotlight in the scene, such as torches, door panes and even the orb itself. The only purpose of the use of this asset is to increasetheimmersiveeffectthatiswantedtoachieveinthisproject. All these effects inevitably decreases the fps and being assets already prepared is not possible to optimize them, or at least not in a relatively simple or comfortable way. 38
ArtDevelopment This section refers to any aspect of the artistic development that has been necessary done for the project. This includes sound and both 2D and 3D art. Inside 3DartisalsoincludedallthescenariomodelingdoneinUnity'seditor. GameWorld To make all the game world, the terrain tool from Unity has been used. Thanks to the initial tests carried out, this process has been able to be carried out more quickly. In general the modeling of the terrain has not been difficult but it is true that when trying to model ramps has been more complicated since this tool does not offer any simple way to do this, but you have to do it by pulse, little by little. OneoftheserampscanbeseeninFigure25. Figure25:NaturalrampelevationintheterrainintheUnityEditor Paint Height has been used on one hand to create large terrain shapes and elevations such as islands and beach areas. Thanks to this option you can model terrain at different heights. For example, for beach areas a base height of 22 has been used and for the island zones a base height of 70 has been used. This value canbedefinedintheHeightpropertyasshowninFigure26. 39
Figure26:PaintHeighttoolfromTerraintool Later the Raise / Lower Terrain option was used to model more in detail the different slopes and mounds of terrain as well as the ramps that join areas of different heights. This tool is used more by pulse, as if it were sculpting in the groundanditiseasytobemistakensoitisnecessarytodoitcarefully. Figure27:Raise/LowerTerraintoolfromTerraintool 40
Finally the Smooth Height option was used to smooth and round the terrain and makethetransitionsbetweenheightsmoreprogressive. Figure28:SmoothHeighttoolfromTerraintool Once the whole terrain has been modeled, the Paint Texture option has been used to paint with different textures previously elaborated. You can see these textures andthisoptioninFigure29. Figure29:PaintTexturetoolfromTerraintool 41
Figure39:Particlesinthetitle On the other hand has been programmed a script that causes the sun to shine more or less over time. This script can be applied to any Light Shaft of the corresponding asset previously discussed. In this case a Light Shaft has been used forthesun'sraysandtheeffectremainsasshowninFigure40. Figure40:LightShaftintensitycomparison 48
Finally another script has been programmed that causes the tide to rise and low as time goes by. In addition, the elements that are in the water like the boat or the wooden boards, are also affected by this tide. It has simply been necessary to place these objects as children of the object that acts as sea, as shown in Figure 41. Figure41:ObjectsaschildsofthewaterplaneintheHierachy Finally, to pass from one scene to another a script is programmed that allows to do both Fade In and Fade Out transitions. You can also use any image for the transition. For this particular project it has simply been decided to use a blank imageasatransition. Physics Unity comes with its own functions and objects that are responsible for calculating different types of physics. For this project only the physics for spheres have been used, since they are the only physical elements of the game. This applies both to the orb of the Gyro Temple and to the micro orbs of the puzzles. To use these physics it was not necessary to program or modify anything other than to use the 49
default functions, so it has been relatively simple. However, a little trick has been used for the physics to work correctly in the puzzles, because when the superplexus were rotated, the micro orbs inside it behaved strangely even going through the small obstacles inside the puzzle. This is due to the speed with which the superplexus is rotated among other factors. To solve this problem what has been done is to place the micro orbs as children of the rotating element. Thanks to thissmalladjustmentthephysicsfunctioncorrectly. Effects To achieve a good ambience and a striking aesthetic, sound, camera and environmenteffectshavebeenadded. Sound The sound has been a very important aspect in the development of the game, since it has been wanted to take into account and to work it carefully and in detail. Both 2D sounds and 3D sounds have been created. 2D sounds sound homogeneously and always at the same volume. The sounds in 3D adapt their volume taking into account the distance to the object that has the AudioListener , which in the case of this project, is the First Person. The following explains the different types of sound thathavebeencreatedandprogrammed. Ambiental The ambient sound refers to all those sounds of the environment that make the player more immersed in the Game World . Two types of ambient sound can be distinguished. On the one hand, there are those sounds of some element. In the project it has been used for example for the fire sound of the torches or the static sound of the neon lights found in the puzzles. These sounds sound low and you have to get closer to perceive them better. On the other hand, there are those sounds of the environment, which do not come from a particular sound source. In the project it has been used for the sound of the sea and the sound of the wind. Both sounds are always present throughout the game, but a script has been programmed that changes the volume of both sounds taking into account the Y coordinate of the player, more specifically, their distance from sea level. Therefore, when the player is closer to the sea, the sound of the wave is the one that sounds stronger and when it is farther away, such as at the top of the lighthouse,thesoundofthewindistheonethatsoundsstronger. 50
AreaMusic The game does not have background music that sounds throughout the entire game world, but there is some melody that sounds depending on the area in which the player is. For this a script has been programmed that allows to define areas with colliders as triggers and to define which melody sounds when it is inside that zone. In the project only this script has been used to define a particular melody when it is in the area of the lighthouse, so that place transmits a sense of mysticism. In addition, in this specific case it has been decided that the volume of the melody depends on the distance to the sea as well as the sounds of waves and wind, using the same script. In this way, the melody sounds louder the higher it is in the lighthouse. Modifiers To give a greater sound realism, a Reverb effect has been applied inside the lighthouse which makes the sounds resonate giving an echo effect. This effect does not need to be programmed since Unity allows to add this type of modifiers in spherical areas. Therefore, the only thing that has to be done is to place several of theseareasalongthelighthouse. Feedback One of the objectives of the project is to get the player to receive good feedback both visual and audible so that he can identify what happens. In the case of sound, this feedback has been applied on the one hand to the cursor and on the other hand to the puzzles. In the case of the cursor, when you point to an element with which you can interact, a slight sound is played, and when interacting, another is played a little more intense. Thanks to this the player can easily identify with what elements can interact. As for puzzles, each time a micro orb exits a sound is played and once the puzzle is completed, another sound is played that identifies whether the puzzle has been resolved correctly or not. If not, the puzzle restarts, playingaveryloudnegativesound. Footsteps The First Person Controller (FPC) that comes by default in Unity already comes with its own step sounds. However they are very basic and repetitive sounds so is opted to program a script called PlayerWalkableArea that allows you to improve this and add different types of sounds depending on the type of floor being stepped on. For this a vertical raycast has been used that leaves the base of the FPC and that detects the collider of the ground on which it is walking in each moment. Along with this, different tags have been defined to identify what 51
material each collider is. The tags that have been defined are stone, metal, wood, water and earth. Subsequently, these tags have been assigned correspondingly to the different elements of the scenario. In addition, the script also takes care of varying slightly the pitch of the sounds of random form. As a negative point to this method, since it works from colliders, there has been no way to define different sounds for ground and for grass, since both elements use the same collider of the terrain. One solution might be to try to define triggers for all grass areas but it wouldbeaslow,tediousandnotveryeffectiveprocess. Physics An important part of the project focuses on the sphere physics which are used in puzzles. To improve the sound experience has been decided to program a physical sound script called PhysicalSound that ensures that the orbs reproduce sounds when they collide and when they roll. The script is explained in detail in the Scripts section. Camera As previously mentioned, the Post Processing Stack asset has been used, which allows to use camera effects in a more comfortable and optimized way. The effectsthathavebeenusedareasfollows. Antialiasing This effect is used to improve the quality of the rendered image, causing the edges of the geometry not to be seen with sawtooth, but smoothed. To avoid consuming many fps, is chosen to select the default quality of Antialiasing , as shown in Figure 42. Figure42:Antialiasingsettings AmbientOcclusion This effect, like Antialiasing , serves to improve image quality. In this case, the Ambient Occlusion is responsible for obscuring those areas where the geometry is veryclosetogether.TheoptionsthathavebeenchosenareshowninFigure43. 52
Figure43:AmbientOcclusionsettings Bloom The bloom effect has been used for two different purposes. On the one hand for the camera to render the stage with more lighting and saturation, something that is necessary to maintain the visual style presented. On the other hand, for the neon effect, using materials with Emission and HDR lighting. This is explained in more detail in the Optimizations section. Neon is used for wiring the stage and to illuminatethepuzzlesandbuttons.TheoptionschosenareshowninFigure44. Figure44:Bloomsettings Environment For the environment of the game have wanted to add small details that make it lookmorecarefulwithagreaterimmersionfeeling. Fog Two types of fog have been used. On the one hand, the default type that is in Unity, which allows to add mist based on the distance from the camera. This 53
effect has been added very slightly, so only those elements that are really far away are affected by the fog. This effect also allows the horizon line to be blurred tosoftenthelinethatseparatestheskyfromthesea. On the other hand the asset Light Shafts has been used to create a height fog effect. This type of fog takes into account the height. It has been used for the interior of the lighthouse to give a feeling of dense air and humidity. This effect canbeseeninFigure45. Figure45:WithandwithoutHeightFogeffectcomparison The Light Shafts asset is not mainly intended for this but has been configured in a certain way that can achieve such effect. Of course, you have to make sure that thecollisionmaskisinNothing sothatnoelementblocksthefogeffect. Particles A lot of particle effects have been used for different elements and specific areas. All these effects have been configured using the Particle System implemented in Unity and its use has been very similar for all the effects that have been elaborated. To explain this process will be used as an example the fire particles usedinthefireplaceandthetorches. The first task is to create the material of the particles as shown in Figure 46. For these particles a sprite of a white circle has been used and an Additive material hasbeenchosen. 54
Figure46:Fireparticlesmaterial Later an empty object has been created with the Particle System and the material createdhasbeenplacedintheRenderer tabasshowninFigure47. 55
Figure47:Fireparticlesystemrenderer Finally the different options such as colors, lifetime, shape, etc. have been configuredtoachievethedesiredfireeffect,asshowninFigure48. Figure48:Finalfireparticleseffect 56
Below are other types of particles that have been created, such as foam when walking on the water or when sailing with the boat (Figure 49) and the floating whiteparticlesofthesmalltempleswherethekeysarefound(Figure50). Figure49:Waterfoameffect Figure50:Shinyfloatingdotseffect LightShafts Aside from using the Light Shafts asset to reproduce the Height Fog effect, it has also been used for other things. On the one hand for the effect of sunbeams. A large Light Shaft has been created that covers the sun of the skybox and points in the same direction as the directional light that is used as the sun. Then, a script is programmed called SynchronizedPosition , which causes the Light Shaft to follow 57
the camera. The following explains in detail how the FPC has been modified and thatotherscriptsaredirectlyrelatedtoit. Figure58:PlayerScriptsflowchart FirstPersonController The movement of the basic FPC was too abrupt so an acceleration value has been added so that it does not go from speed 0 to maximum speed instantly but it does it progressively. In addition this included some functions that were not necessary for this project, so they have been eliminated. These are, on the one hand the head bobbing effect of the camera, which tries to simulate the head swing of the character and on the other hand the option to jump. The first option has been eliminated because it was too dizzy and the second option simply because in this gameisnotcontemplatedthatyoucanjump. In addition to this have been added some public functions that can be called from other scripts. On the one hand, the Freeze() and UnFreeze() functions that block the character's movement and hide the cursor (which is controlled by the CursorInteractions script). However the camera movement can still be used freely. These functions are called from the PuzzleController script for when solving a puzzle and from the MapController script when you are browsing the map. On the other hand Ride() and UnRide() functions that work similar to Freeze() and UnFreeze() but these are called by the Rider script when the boat is being controlled. Finally the function SetFootstepSound() that allows to define the sound clips that correspond to the steps including also the base pitch and volume. This function is called from the PlayerWalkableArea script every time the FPC steps on 64
a new terrain type. Apart from these changes, the only thing that has been done is to configure different options and values that already come by default in the FPC. This includes defining the values of speed of movement and sprint as well as values ofmovementandsensitivityofthecameraamongothers. Figure59:FPCfinalvaluesconfigurationwithHeadBobbingandJumpoptionsdeactivated CursorInteractions This script is responsible for controlling the different states of the cursor, which are Normal ,Targeting and Pressed . These states have been defined using an enumerator and each state has been assigned a sprite. To show a state or another 65
of the cursor, on the one hand a front raycast is used that leaves the camera of the FPC and on the other hand is controlled which buttons of the mouse are pressed. The front raycast, if it is detecting an object with the Interactable tag, the cursor goes to Targeting state and if it does not detect any, it changes to Normal . You can set the distance of the raycast in the inspector. If the left mouse button is pressed, the cursor changes to the Pressed state. However, the Pressed state performs no function unless it happens just after the Targeting state. If there isnothingwithwhichtointeract,nomatterifthemouseispressedornot. Apart from this, a higher state called Hide has been prioritized, which hides the cursor if the FPC is in the Freeze() state, as previously explained. If any mouse button is pressed while in the Freeze() state, it automatically exits from this state by calling the UnFreeze() function. This has been done willfully so that the player candecidewhentostopinteractingwithapuzzle. PlayerWalkableArea Script in which are defined all the sound clips of steps for each type of terrain and that is responsible for checking what type of terrain is stepping on the FPC at any time through a vertical raycast. Each type of terrain has been defined with a differenttagsothatraycastcandetectitandknowhowtoidentifyeachterrain. In addition, this script has another important function, which is to define the zones where the FPC can be moved. For this a mask has been used which has been called Walkable . This mask has been put to all those elements on which the player can walk. This includes the lighthouse and the lands of the islands among others. If the player tries to walk on something that does not have the corresponding mask, he simply can not advance. On the other hand, to prevent the FPC from getting into the sea, you could not use the mask since the land collider above the sea is the same collider as the land under the sea. Therefore the player's movement on the Y axis has been limited. That is, the player can not move from a certain height downwards. In this case, this height is a little below the sea level, which is at 22 in the Y coordinate. Therefore, the player can walk into water only in those areas where he does not just cover but can not enter more. As an extra, when you step on the water, other than sounding the corresponding sound, particles that produce afoameffectareshowed. 66
Figure60:DefinedfootstepssoundsandWalkablemaskfromPlayerWalkableAreascript Rider This script on the one hand is responsible for controlling when the player is mounted or dismounted from the boat. To do this, the boolean IsRiding is used to know if the player is already mounted or not and with that information the Ride() or UnRide() function of the FPC is called. This script is activated when the player interacts with the bells that are on the docks. If the boat is in that dock, then the player is automatically mounted. To verify this, the distance between the bell and the boat is calculated, and if it is at a distance of 15 units or less, it is valid. The same rule applies when trying to moor. To do this you have to navigate to the dock whereyouwanttotieupandinteractwiththebell. 67
Figure61:Dockwithbellandboat On the other hand, it is also responsible for allowing the player to operate the boat with WASD. For the W and S keys a positive or negative AddForce is used to give speed forward or backward. On the contrary for the keys A and D a positive or negative AddTorque is used to give a turning force to the boat in one direction or another. MapController It is responsible for showing and hiding the map when the M key is pressed. This only works if the player has picked up the map before, which is located near the fireplace as shown in Figure 62. When the map is displayed or hidden, The Freeze() andUnFreeze() functionsoftheFPCarecalledrespectively. Figure62:Foldedmapinastonenexttothefireplace Activator It is a very important script that is used in all those elements with which you can interact. It acts as an intermediary and is responsible for calling other functions of other scripts. For example when interacting with a button on a catapult, the 68
Activator calls the Shot() function of the Catapult script. This is configured from the inspector, indicating which function or functions of which scripts are the ones triggered by the Activator . This has been decided to do so for convenience, since in this way when interacting with an object, the script that is activated is always the same, the Activator that is in that object. Then the Activator is already in chargeofcommunicatingwiththerestofscriptsandindicatedfunctions. PuzzlesScripts An important part of the project are physical puzzles. For this have been necessary severalscriptsexplainedbelow. Figure63:PuzzleScriptsflowchart PuzzleController This script is responsible for controlling each of the puzzles in the game. Since it has many functions and variables, it is going to be explained without going into much detail. The script is programmed so that it can be as customizable as possible through all the public variables it has. You can configure all sorts of options like what kind of puzzle it is (normal or inverted), how many orbs there are and what they are, what is the next puzzle, what elements are illuminated, what state it is in (available, solved, deactivated), etc. It has functions that allow to check in which state the puzzle is, if different requirements are met to change from one state to another, if it is necessary to reset the puzzle, etc. Apart from this it is important to mention some details to understand how the puzzles work. 69
The puzzles are connected sequentially so that when one is solved, the next becomes available. These sequences are also defined with a cable that runs through all the puzzles connecting them and that is illuminating. This cable is controlled by the CableController script. On the other hand, each puzzle has a series of micro orbs inside and you have to get them rotating the superplexus. These orbs are controlled with another script, called MicroOrbController . Finally, the rotating element is controlled with a last script, called SpherescopeController . All these scripts are called and consulted by the PuzzleController to be able to manage correctly everything that happens in each puzzle. Each of them is explainedbelow. SpherescopeController It has been decided to call spherescope to those elements with which the player can interact and rotate them freely in the axes X and Y. This is used mainly to handle the spheres of the puzzles. This script takes care of it. The W and S keys rotate the object on the X axis, and the A and D keys rotate it on the Y axis. It also has many public variables that can be configured in the inspector and allow you to customize the type of rotation. For example, you can limit the rotation to the Y axisonly,withamaximumof90º(bothways)andwithaspeedmultiplierofx2. CableController The only purpose of this script is to check the wiring status of the map and know when it should turn on. To do this you have two public functions Activate() and Deactivate() that are called from the PuzzleController and are responsible for turning the cables on and off respectively. What it does is to change the material of the cable to a material with neon effect to give the feeling that it ignites. For each section of cable a CableController is necessary and all the cables are children ofasameGameobject forcomfort. MicroOrbController This script has all the micro orbs found in each of the puzzles. It serves to configure the material and the value of the micro orb, as well as to control when it leaves the puzzle and with which exit does it (red or blue). Micro orbs can be blue or red. The blues have a value of 1 and the red ones have a value of -1. The same applies for the two types of exits. When an orb crosses an exit ring, both color values are multiplied, that is, the value of the orb by the value of the exit. This means that if for example a blue orb (value 1) exits a red ring (value -1), the result is 1 x -1 = -1. In normal puzzles, the results should always be positive, and in 70
inverted puzzles, they should always be negative. These values are read by the PuzzleController tobeabletoidentifyifthepuzzleissolvedcorrectlyornot. AudioScripts Another very important part is the sound as previously explained. Here are some scriptsthathavebeenprogrammedtomanagetheaudio. BackgroundMusicController This script lets you define what music plays in the background inside an area that is defined by a collider that acts as a trigger. When the FPC is inside the collider, thedefinedmusicplays.Whenyouleavethearea,themusicstops. HighVolume This script controls the volume of the AudioSource that is in the same GameObject . For this, the FPC position in the Y coordinate is taken into account. Depending on this value, the sound sounds at a higher or lower volume. You can define the minimum and maximum value of Y for which the sound plays at the minimum and the maximum volume respectively. It also allows you to reverse this calculation with a public boolean called IsInverted . This script is used for ambient sounds of waves and wind, as well as for the slight music that sounds in the lighthouse. PhysicalSound Thisscriptisresponsibleforsimulatingtwotypesofphysicalsoundsfororbs. On the one hand the sound of bounces and collisions. For this it has been necessary to take into account when a collision happens and at what speed it do it. Having this information, one sound can be reproduced for each collision and can be reproduced at different volumes and different pitches depending on the speed withwhichthecrashoccurred.Thefasterthehit,thehigherandpitcheritsounds. On the other hand the sound of sliding or rolling. For this it has been necessary to take into account the speed and angular velocity of the orb, as well as if it is in contact with some surface or not. Taking this data into account, a clinking sound has been produced when the orb rotates on a surface. This sound is repeated to a greater or lesser frequency and pitch taking into account the speed of the orb. The fasteritspins,themorefrequentandpitchertheclinkingis. 71
DebugScripts Some debug scripts have been used to help with the development of the game. These scripts have not been developed from scratch but some changes have been made. TakeScreenshot This script saves a screenshot in the project's root folder when the T key is pressed. A small modification has been programmed to be able to save them under different names. This is to add at the end of the base name the current date and time, so you can take as many captures as you want and will be saved in order by date. This script has been very useful for taking out captures of the project as it wasprogressingandinthiswayhaveafolderfullofimagesofprogress. FPSDisplay This script shows in the upper left corner of the camera the fps that the game is running. Although in the editor of Unity this functionality already exists, if an executable is mounted, the fps can not be shower, so this script has been used. In addition a small modification has been made so that if the fps are less than 30, the text is shown in red, and if it is greater than or equal to 30, it is shown in green. Thanks to this is quicker to identify if the game is running at more than 30 fps or not. MenúsScripts For the management of the menu and the different scenes it has also been necessarytoprogramsomescripts.Belowarethehighlightones. Figure64:MenuScriptsflowchart 72
Fader This script is responsible for displaying a transition on the screen that can be any given image. It has two functions, FadeIn() and FadeOut() . Both show the transition but one is input and one output. When the transition completes it calls theSceneLoader script. SceneLoader This script has a public function LoadScene () that given the index of the scene loads that scene. This has been used to move from the Main Menu to the GameWorld .ThisscriptiscalledbytheFader script,aftercompletingatransition. GameControl Although the function to save and load game at the end has not been implemented in the demo, if it has been programmed a script that takes care of it. For this it is necessary to create as many variables as you want to save all the necessary information of the progress of a game. In general this is something simple but long and tedious so it has not finally been done. However something that is not so simple is to save and load the position and rotation of the FPC and the FPC camera.Thereforesincethishadmoreinterestifitwasdone. The first part was to store and load the position X, Y and Z coordinates. This part has been relatively simple since it only consists on replacing the position of the FPCwiththepositionvectorthathasbeensaved. On the other hand had to save and load the rotation of the camera so that it looks exactly at the same point, something that has been quite more complicated, especially because you have to work with rotations. For this, it has been necessary to investigate more in depth how the camera movement of an FPC works. An FPC is composed of two main elements. On the one hand a CharacterController that allows to move the object (FPC) with the corresponding keys of movement (WASD in this case). On the other hand a Camera, which can be rotated with the movement of the mouse. However this rotation is based on the movement of two axes. On the one hand the rotation on the X axis, which is applied to the FPC and on the other hand the rotation in the Y axis that applies only to the camera. Therefore, the X rotation of the FPC and the Y rotation of the camera must be saved. The Save() function is now complete and writes the data to a file that is saved externally. However the Load() function of the rotation has required a series of transformations and more advanced calculations with Quaternions and 73
OcclusionCulling Another method used to optimize the game is the Occlusion Culling . This method is responsible for rendering only what is visible at each moment. Therefore, if for example the player is inside the lighthouse, nothing that is outside of the lighthouse is rendered even though it is inside the Frustum of the camera. To carry out this method simply mark the Occluder Static and Occludee Static options on thosestaticobjectsthatwillnotbemoved,asshowninFigure72. Figure72:OccluderandOccludeeStaticoptions For more accuracy, only the corresponding occlusion option can be marked for each object. The Occluder Static option is marked on large objects that potentially cover other smaller objects. The Occludee Static option is marked on those small objects that are likely to be covered by larger ones. However, this project has not been so accurate. Marking both options on both objects ensures that an object can act as both Occluder and Occludee, but slows down the occlusion bake process. Figure73showsascreenshotofthefinalsceneocclusionbake. 80
Figure73:BakingOcclusionprocess PostProcessingStack Due to the use of different assets the final fps obtained are around 15 and it would be appropriate to obtain at least 30, so there had to find some alternatives. Looking for the asset store has found an asset called Post Processing Stack [10], which allows to use the effects of camera in a much more optimized way. These effects include Antialiasing and Ambient Occlusion , which are the two main effects that have been chosen to use to make the scenario look good. By being optimized you can also use more of these effects without reducing the fps, as is the case of Bloom . Thanks to Bloom you can achieve the same neon effect that is achieved with the asset MK Glow Free , but in a more optimized way, so that the MK Glow Free can already be discarded. To make the effect work correctly, you must activate the HDR rendering option in the camera itself and make sure that the elements that have to have a neon effect have materials with the Emission propertyactivatedwithavaluegreaterthan1inHDR.ShowninFigure74. 81
Figure74:MaterialexamplewithHDRemissionof3 82
Results The final result is the desired one, a playable demo that contains on the one hand a three-dimensional scenario freely explorable and pleasing to the eye and on the other hand a series of puzzles based on the physical of spheres. A series of capturesofthefinalprojectwillbeshownbelow.Thiswillexplainthegameflow. The player begins the adventure in a bedroom room, inside the lighthouse. In this room lives the protagonist Kodo, who is in charge of the care of this lighthouse. In Figure 75 you can see the room with all its furniture. This room has been made octagonalbyaestheticssinceitisanoutoftheordinary. Figure75:Bedroom After leaving the room you reach the main room of the lighthouse, which is lit by a series of torches on the wall, impregnating the entire room with an orange light. In the center is a golden statue that works as an elevator as shown in Figure 76. At the base of the statue there is a button that drives the elevator and allows the player to climb to the top of the lighthouse. In the hands of the statue is where you have to get to place the orb that is in the Gyro Temple, although the demo does not reach this point. However, the final part is programmed when the orb is alreadyinthestatute. 83
Figure76:Statueelevator After leaving the lighthouse you can observe how the sun dazzles and sneaks between the columns. At the bottom there is a large, fairly long bridge that communicateswiththeisland,asshowninFigure77. Figure77:Lighthouseoutsideandbridge When arriving at the island the first thing that catches the attention is an area to the right with a fireplace, in which is the map of the island. After picking it up, you can start searching for the three keys. This is only a passing area of the island, to communicate the lighthouse with the rest of areas. In Figure 78 you can see whatthiszonelookslike. 84
Figure78:Firstzoneoftheisland Continuing it is reached a descent that leads to a zone of coast, with sand and some palm trees as well as big rocks as shown in Figure 79. In addition this zone is communicatedbydifferentwoodenbridges. Figure79:Beachzone In this area is found the first key, the blue one, which can be easily seen and inevitably catches the player's attention, so if the map is not consulted, it is also very easy to find. This key just like the others is located on a pedestal under a smalldomeasshowninFigure80. 85
Figure80:Firstkeyzone After picking up the first key and continuing along the coast you reach an ascent that leads to another area, in which the blue and purple colors take on importance, giving off a mystical air. In this area there is a small pond in the center surrounded by trees and some rock formations. Also in this area grow flowers that expand in circles of different sizes. In the center of the pond is the secondkey,thegreenone,asshowninFigure81. Figure81:Secondkeyzone Finally you reach the area where the last key is located. This area is formed by small elevations of land that are interconnected by hanging wooden bridges. In this area grow yellow trees and shrubs and, above all, many red poppies. In addition there are vestiges of some type of old construction, since there are columns and 86
great blocks of stone by all the zone, although not in very good condition. This zonecanbeseeninFigure82. Figure82:Hangingbridgeszone As you can see in Figure 83, at the end of this area, after climbing a hill full of poppies and columns on both sides, is the dome with the last key to be obtained, theredone. Figure83:Thirdkeyzone Finally, after having obtained the three keys, head to the Gyro Temple, which is also down to the coast. In the temple can be seen in the center three metal rings spinning at high speed and producing a deafening sound. In the center of the rings is the orb. On the sides of this element are three raised areas in which you have to 87
place the three keys that have been collected. The color of the light beam indicates which key goes on each pedestal. In this case, this is irrelevant since you have the three keys so inevitably will go one key on each pedestal. The Gyro TempleisshowninFigure84. Figure84:GyroTemple When interacting with the pedestals, the corresponding key is automatically placed in each one. Each key that is placed turns off one of the rotating rings. When the three rings stop, the orb is released by shooting upwards, where it reachesarailbywhichitwillbegintoroll. Here begins the second part of the demo, in which you have to solve the different puzzles to help the orb to advance. The demo only reaches the second zone of puzzles. The first zone of puzzles is located right next to the temple, in the same zoneofcoast,ascanbeseeninFigure85. 88
Figure85:Firstpuzzlessequence This first sequence of puzzles is formed by four puzzles, that when completed they allow the use of a catapult, in which the orb is after having rolled by the first rail. To activate the catapult simply press the button next to a pedestal. When activated, the orb is thrown into a kind of funnel, which directs the second and last rail of the demo. Figure 86 shows the catapult with the orb, as well as both railsandtheglassfunnel. Figure86:Orbincatapult Following the way back and the path of the orb you get to the second and final sequence of puzzles made for the demo. This zone is activated after having used the catapult. In this sequence of puzzles the red micro orb is introduced as well as 89
ProblemsandSolutions Throughout the development of the project have been appearing all kinds of problems.Herearesomeofthemostimportantones. FinalBake Despite having previously prepared the bake and have done tests, for the final bake it has been necessary to change some options because due to the large size of the scene and the number of elements in it, the bake could not be performed. When trying to make the bake, not only took a lot of time, but was unable to finish and errors appeared as "Out of memory". To solve this, some options have had to bechangedthatlowerthequality,asshowninFigure92. Figure92:Newbakesettings After modifying these bake options the bake has been able to realize with success, obtaining a good result. Even so, some small graphical glitches have appeared in 96
some textures as can be seen in Figure 93. This may be due perhaps to some vertex or badly closed edge in the geometry that has let the light through. It may also be simplysomemiscalculation,sincethelighthouseisafairlylargemodel. Figure93:Lighthousebakeartifactsnearthedoorandnearthestairs Anywaytheresultlooksgreatandthefinalsceneworksat45fpsonaverage. Terrain One of the biggest problems when modeling has been the proportions. Because the terrain has been modeled in the Unity editor itself, it was difficult to know the size and size of elements such as bridges. The ideal would be to model these elements in 3dsmax, however to avoid all these problems of proportions have been looked for an alternative. This consists of building these elements directly on the ground in the Unity editor, using basic geometric shapes such as scaled cubes and cylinders. This is a rather tedious process but the result has been very good. This method has been used for elements such as bridges, docks, the external elevator andallthewiringofthestage. Another problem that also arises from the fact of using the terrain tool of Unity, is the limitations of this. As previously discussed, this tool uses heightmaps to model terrain. Therefore, structures like the one shown in Figure 94 can not be generated. 97
Figure94:Rockarchreference In a zone of the game it was proposed to create arches of stone to connect different islands, but with this tool can not do this. So what was finally done was toconnecttheseislandswithhangingwoodenbridges. 98
Bibliography References [1]MarbleMachines: https://www.youtube.com/watch?v=3NJ7Fr6VrPU [2]Superplexus https://www.youtube.com/watch?v=9wohFfpLU7s [3]TheWitness https://www.youtube.com/watch?v=SPMMKFX78x0 [4]Rime https://youtu.be/PLszT6nHeAo Documentation [5]TerrainSettings https://docs.unity3d.com/Manual/terrain-OtherSettings.html Assets [6]CelShading: http://www.zehngames.com/developers/next-gen-cel-shading-con-unity-5/ [7]MKGlowFree: https://www.assetstore.unity3d.com/en/#!/content/28044 [8]LightShafts: https://github.com/robertcupisz/LightShafts 99
[9]VolumetricLights: https://github.com/SlightlyMad/VolumetricLights/ [10]PostProcessingStack: https://www.assetstore.unity3d.com/en/#!/content/83912 Tools [11]MP3CutterOnline: http://mp3cut.net/es/ 100