Unreal Engine 4
Setting up Unreal
- Download Epic launcher from here: https://www.epicgames.com/store/en-US/ (Blue "Get Epic Games" button on right corner)
- Navigate to Unreal Engine -> Library tab and add Unreal version 4.24 (currently installed in classroom)
- Create new project by pressing Launch -> choose Games -> First Person. Select the project location and leave everything else default. Press Create project and try to run it.
Unreal Introduction
This is a class diagram of Unreal's base classes:
Useful links:
Practice 1
Goal: create a grenade launcher by adding explosions to the first person template.
- Create a new project using First Person Template with following settings:
- Create and use a custom GameMode blueprint.
- Check the FirstPersonProjectile blueprint and try to describe what is it doing.
- Spawn the explosion effect from the StarterContent whenever the projectile hits something (Hint: Use Spawn Emitter at Location).
- Make the projectile behave similarly when hit hits the environment or the cube.
- Make the explosion configurable through variable.
- Make the explosion apply impulse to all the objects in a radius.
- Add additional collision component with OverlapAll collison preset.
- Loop through the overlapping actors and apply radial impulse to each one of them.
Practice 2
Goal: make a time based jumping puzzle.
- Create an BP_ExtractionZone actor.
- Add UBoxComponent which responds to the pawn overlap only
- Call a custom CompleteMission event in your custom game mode blueprint when the player enters. Pass the InstigatorPawn as its argument and disable its input.
- Play sound when mission is completed (you can use Unreal engine sound file).
- Add UDecalComponent with similar size to the UBoxComponent. Rotate it so that it shows the image on the floor.
- Create new WBP_GameOver (widget blueprint)
- Add a text "Mission Complete" anchored to the center.
- Create this widget in the game mode when the mission is completed and add it to the viewport.
- Create a new Actor BP_SpectatingViewport with a static mesh with MatineeCamera that is hidden in game.
- Add the actor in scene, right click -> pilot and move it to get a good overview of the scene.
- On game over, find the camera actor and get the PlayerController and use SetViewTargetwithBlend function to blend the view to the new point.
- Try different blend functions and times to make the transition smoother.
- Create WBP_HUD (widget) and add it to the viewport at the beginning of the game.
- Add method for setting the time value.
- Add a timer to the GameMode that ticks every second, decreases the remaining time and updates the widget.
- End the game with "Mission Failed" text when the time reaches to zero.
- Create a launch pad that uses LaunchCharacter function in your character class to launch the player in the air.
- Define variables for LaunchStrength (1500f) and LaunchPitchAngle (35f).
- On launch get the launchpad actor rotation, and create a LaunchVelocity vector by increasing its pitch and multiplying the vector by the LaunchStrength.
- Extra: Launch other dynamic objects too when they touch the launch pad.
Practice 3
Goal: make a lever and door system.
- Download meshes: Attach:DoorAndLever.zip
- Import them to a Meshes folder without generating materials (Import all)
- Create a base material with color property
- Create different color material instances
- Add colored materials to the meshes
- Create a blueprint interfaces BI_Interactable
- Add interface function Interact.
- Add interface function CanInteract that returns boolean.
- Add interface function Reset.
- Create a Lever actor BP_Lever that inherits BI_Interactable.
- Lever has two static meshes that open the door. (Included in fbx file)
- Add a line trace to the first person character tick event
- Use Camera world location and world rotation to calculate the line trace start and end points.
- Save the hovered Interactable to a variable.
- Call the interact method when E is pressed (you will have to configure E as an action key).
- Add a world space widget to the lever with the remaining time display.
- Create a new WBP_LeverScreen widget that scales with the screen and displays remaining time. ** Try to use layouts to organize elements on the widget.
- Add Widget component to the BP_Lever and attach the WBP_LeverScreen.
- Create lever functionality
- When the lever is pressed, rotate the handle down using SetRelativeRotation.
- Extra: use Timeline node to rotate the handle over time.
- Add event dispacther that dispatches an event when lever is pressed.
- Add second event dispatcher that dispathes an event when lever resets.
- Count the time and when its up move the lever up again.
- Create a Door actor BP_Door. (World rotation has Get Forward Vector function)
- Door has two static mesh components that slide away when its opened.
- Door has BI_Lever reference variable that is instance editable, assign the BP_Lever in scene.
- Attach to the lever event dispatchers and open and close the door. Use timeline to do it smoothly.
Practice 4
Goal: create collectable objects and level layout.
- Create a collectible actor with sphere mesh.
- Create a custom material for the sphere, that is glowing and the color can be edited.
- When the player touches the actor, play a sound and decrease the counter on the UI.
- Don't destroy the actor but make it invisible and after a certain time, make it visible again.
- Count the number of collectibles gathered on the HUD and only allow to end the level when all are collected.
- Use the Level Blueprint to randomly spawn the collectable objects to the world. (50 collectables)
- Use a Line Trace to place them on ground.
- Create a Data table with name, color, value and cooldown times.
- Use the Data table values to randomly assign the values to the collectables.
- Use BSP objects like doors and ramps to create a cool looking level layout.
Submission
Submit a compiled version of your game (Windows 64 build). Zip your build folder into a single package and make sure that all the additional files (that were created when building the game) are also included in this package. Don't submit your source code.
Unfortunately the file will be too large to directly upload in here. Upload the file to your google drive or another file hosting platform. Write the sharing link to a txt file and submit this.
Deadline: 8.12 (before the lab)
3. Unreal project 1