- [Instructor] Hi,
and welcome to the first section of this course.
Abstraction and code management,
making better use of OOP.
In this section,
we will start off with an introduction to the final project,
Thomas Was Late.
We would then move on to structuring
the Thomas Was Late code.
In the later videos,
we would learn building the game engine
and coding the main function.
Now we move on to the first video of this section.
The Thomas Was Late Game.
In this video,
we are going to take a look at features of Thomas Was Late,
creating a project from template
and the project assets.
At this point,
if you haven't already,
I would suggest you go and watch a video
of Thomas Was Alone at store.steampowered.com.
Notice the really simple
but aesthetically excellent graphics.
The video also shows a variety of gameplay challenges
such as using the character different attributes.
Height, jump, power and so on.
To keep our game simple without losing the challenge,
we will have fewer puzzle features than Thomas Was Alone.
But we'll have the additional challenge
of creating the need for two players to play cooperatively.
Just to make sure the game is not too easy,
you will also make the players race against the clock.
Hence the name of our game is,
Thomas Was Late.
Our game will not be nearly as advanced as the masterpiece
that we're attempting to emulate.
But we'll have a good selection
of exciting gameplay features,
like these.
A clock that countdowns from a time appropriate
to the challenge of the level.
Fire pits that are made of roar
relative to the position of the player
and respond the player at the start,
if they fall in.
Water pits have the same effect.
But without the directional sound effects.
Cooperative gameplay.
Both of players will have to get their characters
to the goal within the allotted time.
They will frequently need to work together,
for example the shorter lower jumping bomb,
will need to stand on his friend's Thomas's head.
The player will have the option of switching between full
and split screen.
So he can attempt to control both characters himself.
Each level will be designed in and loaded from a text file.
This will make it really easy to design varied
and numerous levels.
Take a look at this image of our game
to see some of the features in action.
And the component assets that make up the game.
Let's take a look at each of those features.
The image shows a simple HUD that details the level number
and the number of seconds remaining,
until the players failed and have to restart the level.
You can also clearly see,
the split screen co-op in action.
Remember that this is optional.
A single player can take on the game full screen,
while switching the camera focus between Thomas and Bob.
It is not very clear in this image
but when a character dies,
he will explode in a starburst,
firework-like particle effect.
The water and fire tiles can be strategically place
to make the level fun
and force cooperation between the characters.
Notice Thomas and Bob,
not only are they different in heights,
but they also have significantly
different jumping abilities.
This means that Bob is dependent upon Thomas for big jumps.
And levels can be designed to force Thomas to take a route
that avoids him banging his head.
In addition,
the fire tiles will emit a roaring sound.
This will be relative to the position of Thomas.
Not only will they be directional
and come from either the left or right speaker.
They will also get louder and quieter
as Thomas moves closer or further away from the source.
Here,
Thomas and Bob arriving at the fire pit
that Bob has no chance of jumping over without help.
This instance shows Bob and Thomas collaborating
to clear up precarious jump.
Here we see how we can design puzzles,
where our leap of faith is required
in order to reach the goal.
Look at this instance.
See how we can design oppressive cave systems
of almost any size.
We can also devise levels,
where Bob and Thomas are forced to split up
and go different routes.
Creating the Thomas Was Late project,
is the same as the other two projects.
I'll guide you through the steps in visual studio.
First you have select file in the main menu
and in that,
you have to click new project.
Now,
make sure that Visual C++ is selected in the left hand menu
and then select HelloSFML,
from the list of presented options.
In the name field,
type TWL in upper case
and also ensure
that the create directory for solution option is checked.
Now click OK.
Now that our project is created successfully,
we need to copy the smfl.dll files
which resides in SMFL,
bin subfolder into the main project directory.
These are the dll files we have to copy.
My main project directory lies in documents.
Visual Studio Stuff,
Projects,
TWL,
TWL subfolder.
Let's copy them into the TWL subfolder.
So the project is now setup and ready to go.
The assets in this project are even more numerous
and diverse than the zombie arena game.
As usual the assets include a font
for the writing on the screen.
Sound effects for different actions such as jumping,
reaching the goal or the distant roar of fire
and of course graphics for Thomas and Bob.
As well as the spreadsheet for all the background tiles.
All the assets required for the game
are included in the download bundle.
They can be found in section one graphics folder
and sound folders respectively.
As you can see,
in section one graphics folder,
we have images for background,
Bob and Thomas,
and this is our tiles sheet
that we are going to use for all of our background tiles.
This is the sound folder where we have various sounds
which are fallinfire, fallinwater,
fire1, jump and reach goal.
Now in the fonts folder,
the font that is required has not been supplied.
This is because I wanted to avoid any possible ambiguity
regarding license.
This will not cause a problem though,
as I will show you exactly where and how,
to choose and download fonts for yourself.
In addition to the graphics, sound and fonts
that we have come to expect,
this game has two new asset types.
There are level design files
and GLSL shader programs.
Let's find out about each of them.
Levels are all created in a text file,
by using the numbers zero through three,
we can build level designs to challenge players.
All the level designs are in the levels folder
in the same directory as the other assets.
In addition to these level design assets,
we have a special type of graphical asset
called shaders.
Shaders are programs written in GLSL,
Graphics Library Shading Language.
Don't worry about having to learn another language
as we don't need to get too in-depth to take advantage
of shaders.
Shaders are a special
as they are entire programs separate from our C++ code
which are executed by the GPU each and every frame.
In fact some of these shader programs are run every frame
for every pixel.
Let's see how we're going to use the assets.
The graphical assets make up the parts
of the scene of our game.
Take a look at the graphical assets
and it should be clear where in our game they will be used.
If the tiles on the tiles_sheet graphic
look a little different,
this is because they are partly transparent
and the background showing through changes them a little.
If the background graphic looks totally different
to the actual background in the game,
that is because the shader programs we will write
will manipulate each and every pixel,
each and every frame to create a kind of moulton effect.
Now for the sound assets.
These are all .wav format.
These are files that contain the sound effects
we will play at certain events throughout the game.
First, fallinfire.wav.
A sound that will be played when the player's head,
goes into the fire and the player has no chance of escape.
Fallinwater.wav.
Water has the same end effect as fire,
death.
This sound effect notifies the player,
they need to start from the beginning of the level.
Fire1.wav.
This sound effect is recorded in mono.
It will be played in different volumes
based on the player's distance from fire tiles
and from different speakers based on whether the player
is to the left or the right of the fire tile.
Clearly we will need to learn a few more tricks
to implement this functionality.
Jump.wav.
A pleasing slightly predictable whooping sound
when the player jumps.
Reachgoal.wav.
A pleasing victory sound from when the player
or players gets both characters,
Thomas and Bob,
to the goal tile.
Now that we've decided which assets we'll use,
it is time to add them to the project.
In case you using different assets,
simply replace to your appropriate sound
or graphic file with your chosen file,
using exactly the same file name.
First,
we have to browse to the visual directory.
My project directory is highlighted here.
This is the TWL subfolder.
Create five new folders within this folder
and name them as fonts,
graphics, levels, shaders and sound.
Now from the download bundle,
copy the entire contents of section one
into the TWL graphics folder.
I've copied and pasted them here.
Summarily,
copy the entire contents of sound folder
from the download bundle
into the TWL sound folder.
You can see I pasted the entire content
of sound folder here.
Now for the fonts.
Visit dafont.com in your web browser.
And then download the roboto light font.
You'll get this roboto.zip file.
Extract the contents of the zip download.
This is the folder created after extraction.
In this folder,
select the Roboto-Light.ttv file.
Copy this to our fonts folder.
We are done with fonts, graphics and sound.
Now we're left with levels and shaders.
From the download bundle,
copy the entire contents
of section one levels into our levels folder.
Summarily for shaders,
from the download bundle,
copy the entire contents of section one shaders
into our shaders folder.
Now that we have a new project along with all the assets
we will need for the entire project,
we can talk about how we will structure
the game engine code.
In this video,
we've looked to the Thomas Was Late game,
creating the project and from template
and the project assets.
Cool.
Next we'll see structuring the Thomas Was Late code.