November / December 2019 - Development time: 3 weeks
🔨 Game made with Unity 3D (ver. 2019.2.4f1). In this game you walk in a forest and you decided to clean the rubbish to preserve nature. So pick up all the soda cans in the allotted time. It's an original game, not inspired by a tutorial. By the way I used tons of tutorials and websites to help during the development. The gameplay is quite basic, but the mecanics including navigation, introduction, sound design are the same than in a commercial game. The 3D environments and animations are quite high grade quality.
Download the installer here [899Mb] and just follow the instructions.
Download the zip with the game here [0.98Gb] and unzip forest-windows64.zip on your computer.
In 'forest-windows64' launch forest-project.exe by clicking on it to play.
Download the zip with the game here [1.00Gb] and unzip forest-mac-osx.zip on your computer.
In 'forest-mac-osx' launch build-macsos.app by clicking on it to play.
Warning: It's not an approved Mac App Store application so you will have to select 'allow apps downloaded from anywhere' or click on 'open anyway' on the alert box if you want to launch the game.
Download the zip with the game here [1.01Gb] and unzip build-linux_x86_64.zip on your computer.
In 'build-linux_x86_64' launch forest-project.x86_64 (you will have to allow the file running as executable: right click on forest-project.x86_64 and chose Properties -> Permissions -> Allow executing file as program).
Or in the directory 'build-linux_x86_64':
chmod +x forest-project.x86_64
run forest-project.x86_64
Scripts used are in the script folder on this repository.
-------
This game was made to show my skills using Unity 3D and what's it's possible to do with it. This game has a peaceful atmosphere and educational virtues. It's usually the kind of game / application that inspires institutionnal or non-profit organizations as clients.
It's a desktop version. It would be possible to make that kind of game for mobiles or web browsers (WegGL), but the quality should be downgraded.
This game has been tested again and again and again... But if you have advises or if you see bugs / problems, please contact me using the issue button on this repository.
Walk in the forest and grab the 30 cans within 10 minutes.
Use wasd or zqsd keys (according to your choice in the menu setting) to move and your mouse to look around. Use LeftShift to run and Space to jump. You can help yoursel with the minimap that displays can that are near you.
If you win or fail, a menu is displayed asking you if you want to try again or go back to menu.
Other features:
-
'F2': show / hide the Minimap
-
'Escape' / 'P': show / hide pause menu with continue or back to menu.
No cans to pickup or timer, just walk and discover the landscape using the same keys than in game mode.
-
'F2': Open the pannel to choose and display the time of the day, it will affect the environment lighting. Or choose the time of the day with 'F3' / 'F4' / 'F5'/ 'F6' (simulated morning / afternoon / evening or real time).
-
'Escape' / 'P': show / hide pause menu with continue or back to menu.
Here you can change the keyboard layout setting, querty (WASD) or azerty (ZQSD). You could also see a summary of the keys used in the game.
-------
You can select between game mode or walking mode.
The game selected is managed by Scriptable Objects (that can be sused as 'global' variables between scenes).
The two versions of the game have just one scene with some GameObjects displayed or not according to the boolean value in the Scriptable Objects. This value is reset each time we comme back to the intro scene.
Here you can choose keyboard layout.
It's a native feature that lacks in Unity for years. That's wy I use the asset Rewired that is more powerful thant the input management of Unity, even the new one in preview.
It uses scriptable objects to remember the choice in the second scene.
This scene has been made using the Unity additionnal package Cinemachine.
Cinemachine allows to use several virtual cameras to make cut-scenes, trailers and so on. In this intro I use the dolly track feature.
The lanscape is the same the the one used in the game. The result is displayed as an animation made with the components Animator and Animation.
To make quality cinematics can be a long process... Here it's far to be perfect, you could see some speed variation during the cinematic...
Canvas are used as overlay to display buttons and informations (GUI), with some scripting and EventSystem components, including tooltips.
There are also many canvas in the forest/game scene. I used scale with screen size rendering and anchors to be sure that every elements fit on the screen according to the resolution. Several resolutions have been tested in the game pannel using the resolutions / aspect ratio selector.
The music is fade out with a coroutine then another coroutine is launched to display the loader asynchronously. The same loader is used on the two scenes. There aren't specic script for this scene, it uses the same than in the next so they will be detailled there.
This game uses Forest Environment - Dynamic Nature from NatureManufacture.
And yes, it uses the demo provided with the asset. To speak franckly, this game is just for demonstration purpose. To make that kind of map takes about two weeks for a professionnal level designer (according to NatureManufacture). Moreover, everything already uses LOD (Level of Detail according the position of the camera), that increases performances.
BTW I've used the new Terrain Tools package (preview) to make some changes in the terrain. You should not be able able to fall from it now...
The terrain is surrounded by moutain and there is a slope detection to avoid player falling outside the map.
By the way, I made like all developers, I added... invisible walls! (just in case).
The game use a minimap in the GTA style to display the rubbish to collect. The minimap is made with a ortographic camera above the player.
In the properties of this camera I target a render texture previously made. So I can use this texture in the overlay in a raw image with the content displayed with the camera in it as texture.
To improve performances, this camera uses occlusion culling (so what is not in front of the camera is not calculated by the computer) and displays some layers only in culling mask.
Markers are GameObjects in the prefab of cans. The main camera displays the layer with the rubbish and the minimap only these markers.
3.2.3. Script: HitBehaviour.cs
//HitBehaviour: Raycast on GO that can be picked-up / Highlight GO
Script that uses raycast to find if we hit an object on the 'rubbish' layer (cans). It calls an other script when we click on an grabbable object.
It's also used to change the material on grabble object when the raycast hits it.
It's also in this script that I cound the cans grabbed. I can define if all the cans have been picked up. It could be managed in another script, but It was the easiest way for me to avoid to increase the score if the player would click several times... The rubbish are children of a GameObject (used like a kind of folder). I don't have to specify how many GO there are in it because I count them in the script. BTW It's divided by 2 because each prefab has two GO, the rubbish and its icon (for the minimap)...
3.2.4. Script: GrabObject.cs
// GrabObject: animation / sound / set the object unactive
Script used to grap the object following a guide put on the FPSPlayer component.
When the mouse button is released the script set inactive the icon on minimap immediately (otherwise it moves on the minimap following the can asset). The can disapear after a few time using a coroutine and the IEnumerator method.
It's also in that script that the sound is played.
3.2.5. Script: ScoreAndTimeController.cs
//ScoreAndTimeController : counter and score management / detect if lost or win
Coundown that converts deltaTime in minutes / seconds. Delta time can be specified in the inspector.
Score displaying according to the total of GO contained in the rubbish GO.
It's also that calss that controls if the player has won or lost.
3.2.6. Script: GameController.cs
//GameController : counter and score management / display messages and pannels /show hide some elements
This script manage many things: display or hide elements according to the situation.
- Manage GUI buttons on intro
- Displays elements that are Game mode / Free mode specific
- Displays pannels and messages when we lost or win
- Manage loading scene and progress bar for the two scenes
- Manage the launch of sound fade in / fade out
Note to myself: don't forget 'Event Listener' if you use GUI.
3.2.7. Script: FirstPersonControllerEdited.cs
//FirstPersonController.cs: Player control management
Modified version of FirstPersonController.cs component to manage Rewired and Dynamic Footsteps for first person games assets and SlopeDetection.cs datas.
3.2.8. Script: ActionKeysManager.cs
//ActionKeysManager: Manages the keyboard shortcuts ingame and what's displayed / hidden
Used for the pause menu, the displaying of the minimap or the time selector pannel.
It also display a pannel in walking mode that allows to choose the time of the day and display the hour using dropdown menu and toggle.
3.2.9. Script: SlopeDetection.cs
//SlopeDetection: Finds the slope/grade/incline angle of ground underneath a CharacterController
I used and modified this script to detect the slope using a raycast behind the player. So i can set the high of jump according to the slope/ incline angle of ground underneath.
3.2.10. ToolTips.cs
//ToolTips: displays tooltip on menu when a button is hovered
Script to display tooltips. The content (title+content) is managed in a component on the GO.
I use the asset Dynamic Footsteps for first person games to manage footstep sounds. Not expensive and very useful.
With that asset you can define sounds played randomly using a tag. BTW I had to adjust or create some colliders (primitive / mesh) on some GameObjects (water and bridges). According to me it's more easy to add colliders on a tagged GO than define texture that will interact with a raycast (textures can be numerous or be changed by the designer / raycast could... not work on every cases) . I've tried several solutions, this one convinced me.
During the game, the time goes by...
I use the following asset for that: Hendrik Haupt - Enviro - Sky and Weather
Note to myself: uncheck 'don't destroy on load' on Enviro manager to reset all datas and reactivate them by scripting.
Scripts avoid to use GameObject.FindGameObjectsWithTag or GameObject.Find methods but use public variables that can be accessed from the inspector.
TextMeshPro is used for text that's more efficient than regular text.
There is occlusion culling (the computer calculate only what's shown by the camera) on the cameras using the rendering option (not on the camera component otherwise it causes glitches).
A lot of asset in hierarchy use LOD (Level of Detail) that reduces the load on the hardware and improves the rendering performance.
All the cameras allow dynamic resolution. It means that if frame rate reduces, the game scales down the resolution to maintain a consistent frame rate.
Excepted in the profesionnal gaming industry, I've noticed that the sound design is often neglected.
However, it's very important in what you feel when you play game, watch movies, series and so on... Like in the real life, real silence is quite rare... The sound and music, it's 90% of the atmosphere... So I've paid attention of the sound in this game.
So I've bought some royalty free soundtracks and also took care of licensing so I selected royalty free ones.
This royalty free song from Whitesand is used for the intro.
-------
- Whitesand - Drops (Royalty and Copyright Free) - Youtube / Facebook / Twitter / Instagram / SoundCloud
- Forest Sounds Germany ! Crows, Birds & Soft Wind! Royalty Free - freetousesounds
- Night Sounds National Park Doi Suthep, Thailand! Jungle Sound Effects! Royalty Free - freetousesounds
- Free SFX / Free Sound Effects
- Zapsplat / Free sound effects & royalty free music
- Freesound
- 3D Game Kit - Unity Technologies
- Bird Flock Bundle - Unluck Software
- Cola Can - YGS Assets
- Dynamic Footsteps for first person games - John's Art
- Enviro - Sky and Weather - Hendrik Haupt
- Firefly Particles - Unluck Software
- Forest Environment - Dynamic Nature - NatureManufacture
- Rewired - Guavaman Enterprises
-------
- Brackeys Game Dev Tutorials
- DitzelGames
- Epitome
- IMERSITY
- Info Gamer
- inScope Studios
- Jason Weimann - Unity 3D College
- Learn Everything Fast
- Raywenderlich
- SpeedTutor
- Sykoo
- Sylvain - Créateur 3D
- TUTO UNITY FR
- Unity Guruz
- Unity Learn
- Unity Pour les nuls
- Unity3D With Scott
-------