mirror of
https://github.com/kuhyx/engineer-thesis-WUT.git
synced 2026-07-04 11:43:05 +02:00
feat: finishing up implementation details
This commit is contained in:
parent
22865b699c
commit
0c7210a176
@ -980,6 +980,109 @@ For our Match Three game engine, we aimed to create a simple core, capable of en
|
||||
\item Good coding principles: when writing code, clang-tidy was extensively used to highlight potential errors and eliminate bad practices
|
||||
\end{itemize}
|
||||
|
||||
\section{Integration of Libraries and Tools}
|
||||
In this section we will explain rationality for choosing libraries and tools for our engine and how they were implemented
|
||||
|
||||
\subsection{ Choice of graphic renderning API }
|
||||
There are 3 main APIs for graphical rendering
|
||||
\begin{itemize}
|
||||
\item DirectX
|
||||
\item OpenGL
|
||||
\item Vulkan
|
||||
\end{itemize}
|
||||
DirectX developed by Microsoft focues on Windows operating systems and
|
||||
Microsoft line of consoles Xbox, it is deemed as being harder with more
|
||||
low level programming and requiring better understanding of how underlying
|
||||
mechanisms work but in turn offers functionalities and better performance.
|
||||
It does not have free license. \\
|
||||
OpenGL is developed by Khronos Group and offers good compatibility,
|
||||
especially if using OpenGL ES subset which works on Windows, Linux,
|
||||
Mac OS, Android, iOS and all major consoles.
|
||||
It is widely recognized as easiest of APIs and most popular choice
|
||||
for writing first game engine. On the other hand it lacks some of
|
||||
more advanced features which have to be written manually.
|
||||
It uses open source license similar to BSD
|
||||
\\
|
||||
Vulkan is also developed by Khronos Group and as such is deemed as a
|
||||
spiritual successor of OpenGL with focus on using modern C++ features and
|
||||
fixing issues created by OpenGL 30 years old development time.
|
||||
Out of these three it is recognized as the hardest one as
|
||||
it is both complicated and newest. Similarly as OpenGL
|
||||
it uses open source license, namely Apache License 2.0.
|
||||
\\
|
||||
\begin{table}[H]
|
||||
\centering
|
||||
\caption{Comparison of Graphics APIs}
|
||||
\begin{tabularx}{\textwidth}{|l|X|X|X|X|}
|
||||
\hline
|
||||
& \textbf{Developer} & \textbf{Platform Focus} & \textbf{Complexity} & \textbf{License} \\
|
||||
\hline
|
||||
\textbf{DirectX} & Microsoft & Windows, Xbox & Harder, requires understanding of underlying mechanisms & Non-free \\
|
||||
\hline
|
||||
\textbf{OpenGL} & Khronos Group & Windows, Linux, Mac OS, Android, iOS, major consoles (especially with OpenGL ES) & Easiest, lacks some advanced features & Open source (similar to BSD) \\
|
||||
\hline
|
||||
\textbf{Vulkan} & Khronos Group & Modern platforms, successor to OpenGL & Hardest, newest & Open source (Apache License 2.0) \\
|
||||
\hline
|
||||
\end{tabularx}
|
||||
\end{table}
|
||||
Considering all of those characteristics I decided to go with OpenGL API,
|
||||
specifically OpenGL ES subset with its focus on compatibility as
|
||||
making a multiplatform application is one of the focues of this thesis.
|
||||
I decided that since this will be my first attempt at game engine development
|
||||
I need something that is relatively easy and has a lot of resources online.
|
||||
I would most likely not use advanced features of Vulkan and DirectX and
|
||||
therefore finish my thesis before approaching problems where OpenGL
|
||||
does not deliver more complicated architecture.
|
||||
From my own private preferences I also prefer software with
|
||||
open source license.
|
||||
|
||||
\subsection{Choice of OpenGL Library}
|
||||
There are 4 basic OpenGL libraries that I considered:
|
||||
\begin{itemize}
|
||||
\item freeGLUT
|
||||
\item SDL
|
||||
\item SFML
|
||||
\item GLFW
|
||||
\end{itemize}
|
||||
freeGLUT was created as opensource alternative to GLUT,
|
||||
is considered to be the worst out of all 4,
|
||||
written in archaic way, using C or very old C++,
|
||||
which in turn results in unexpected "buggy" behaviour,
|
||||
it is also not really popular with lack of online guides \\
|
||||
SDL - Simple DirectMedia Layer has big userbase,
|
||||
it is not designed to by used as a standalone
|
||||
library and requires additional libraries to do networking
|
||||
or to create more complex applications. \\
|
||||
SFML is the library with most features out of all 4,
|
||||
it supports networking, audio and has system features by
|
||||
default. It uses modern object oriented C++.
|
||||
Main problem with SFML is that it is not very popular API,
|
||||
therefore troubleshooting problems with SFML is quite hard and
|
||||
it has only few use guides online \\
|
||||
GLFW is an library that is both the most popular and with fewest features by default.
|
||||
It forces users to use additional libraries for networking,
|
||||
sound, physic calculations and so on but in turn is also
|
||||
quite small and flexible. It has biggest community and a
|
||||
lot of guides, like one hosted at
|
||||
\href{learnopengl.com}{learnopengl.com} or one created by
|
||||
programming youtuber Cherno \\
|
||||
I decided to use GLFW library. I wanted something that is
|
||||
relatively easy to troubleshoot and has abundance of
|
||||
learning materials online.
|
||||
|
||||
\subsection{GLAD and OpenGL Extension Handling}
|
||||
GLAD enabled the dynamic loading of OpenGL functions, this way engine can use the latest OpenGL features.
|
||||
|
||||
\subsection{Text and Image Rendering with FreeType, stb\_image, and ft2build}
|
||||
|
||||
FreeType and stb\_image were choosen for their simplicity and popularity
|
||||
|
||||
\begin{itemize}
|
||||
\item Font Rendering: With FreeType and ft2build, the engine can render text, crucial for messages, scores, and menus.
|
||||
|
||||
\item Image Loading: stb\_image simplifies the task of loading and processing various image formats, from PNGs and JPGs to more complex formats, making asset integration much easier.
|
||||
\end{itemize}
|
||||
|
||||
\subsection{Core Modules}
|
||||
|
||||
The engine's architecture is segmented into modules:
|
||||
@ -1976,147 +2079,6 @@ void Shader::Compile(const char* vertexSource, const char* fragmentSource, const
|
||||
\subsection{Dependency Management}
|
||||
There are several libraries: OpenGL, GLFW, stb\_image and freetype being integrated into engine, they are simply included at the top of any files that need them.
|
||||
|
||||
\section{Match Three Logic and Mechanics}
|
||||
Match Three game challenges players to align identical items in rows or columns of three or more. This section describes how the Match Three logic and mechanics were implemented within our game engine.
|
||||
|
||||
|
||||
\subsection{The Fundamental Game Grid}
|
||||
|
||||
A Match Three game takes place on a grid, where each cell holds an item (tile):
|
||||
|
||||
\begin{itemize}
|
||||
\item Dynamic Grid Generation: The engine supports grids of various sizes, ensuring adaptability for different game designs or levels.
|
||||
|
||||
\item Item Diversity: While classic Match Three games primarily used jewels or candies, our engine supports any kind of 2d image assets user wants to use, these assets can later be processed by user created shaders
|
||||
\end{itemize}
|
||||
|
||||
\subsection{Matching Logic}
|
||||
|
||||
\begin{itemize}
|
||||
\item Pattern Recognition: The engine monitors the grid, identifies patterns where three or more items align vertically or horizontally.
|
||||
|
||||
\item Combo Chains: Beyond the basic three-item match, the engine recognizes and rewards larger matches and cascading chain reactions.
|
||||
\end{itemize}
|
||||
|
||||
\begin{figure}[htp]
|
||||
\centering
|
||||
\includegraphics[scale=0.5]{images/matchThreeSelect.png}
|
||||
\caption{Selecting tile to swap in game engine}
|
||||
\label{}
|
||||
\end{figure}
|
||||
|
||||
\subsection{Player Interactions and Moves}
|
||||
|
||||
\begin{itemize}
|
||||
\item Drag and Swap: The primary interaction method, where players drag items to swap positions and create matches.
|
||||
|
||||
\item Move Validation: Not every swap leads to a match. The engine predicts potential matches before finalizing a move, ensuring players don't make invalid swaps.
|
||||
\end{itemize}
|
||||
|
||||
Our engine offers basic match three experience with couple of additional features added on the top.
|
||||
\section{Integration of Libraries and Tools}
|
||||
In this section we will explain rationality for choosing libraries and tools for our engine and how they were implemented
|
||||
|
||||
\subsection{ Choice of graphic renderning API }
|
||||
There are 3 main APIs for graphical rendering
|
||||
\begin{itemize}
|
||||
\item DirectX
|
||||
\item OpenGL
|
||||
\item Vulkan
|
||||
\end{itemize}
|
||||
DirectX developed by Microsoft focues on Windows operating systems and
|
||||
Microsoft line of consoles Xbox, it is deemed as being harder with more
|
||||
low level programming and requiring better understanding of how underlying
|
||||
mechanisms work but in turn offers functionalities and better performance.
|
||||
It does not have free license. \\
|
||||
OpenGL is developed by Khronos Group and offers good compatibility,
|
||||
especially if using OpenGL ES subset which works on Windows, Linux,
|
||||
Mac OS, Android, iOS and all major consoles.
|
||||
It is widely recognized as easiest of APIs and most popular choice
|
||||
for writing first game engine. On the other hand it lacks some of
|
||||
more advanced features which have to be written manually.
|
||||
It uses open source license similar to BSD
|
||||
\\
|
||||
Vulkan is also developed by Khronos Group and as such is deemed as a
|
||||
spiritual successor of OpenGL with focus on using modern C++ features and
|
||||
fixing issues created by OpenGL 30 years old development time.
|
||||
Out of these three it is recognized as the hardest one as
|
||||
it is both complicated and newest. Similarly as OpenGL
|
||||
it uses open source license, namely Apache License 2.0.
|
||||
\\
|
||||
\begin{table}[H]
|
||||
\centering
|
||||
\caption{Comparison of Graphics APIs}
|
||||
\begin{tabularx}{\textwidth}{|l|X|X|X|X|}
|
||||
\hline
|
||||
& \textbf{Developer} & \textbf{Platform Focus} & \textbf{Complexity} & \textbf{License} \\
|
||||
\hline
|
||||
\textbf{DirectX} & Microsoft & Windows, Xbox & Harder, requires understanding of underlying mechanisms & Non-free \\
|
||||
\hline
|
||||
\textbf{OpenGL} & Khronos Group & Windows, Linux, Mac OS, Android, iOS, major consoles (especially with OpenGL ES) & Easiest, lacks some advanced features & Open source (similar to BSD) \\
|
||||
\hline
|
||||
\textbf{Vulkan} & Khronos Group & Modern platforms, successor to OpenGL & Hardest, newest & Open source (Apache License 2.0) \\
|
||||
\hline
|
||||
\end{tabularx}
|
||||
\end{table}
|
||||
Considering all of those characteristics I decided to go with OpenGL API,
|
||||
specifically OpenGL ES subset with its focus on compatibility as
|
||||
making a multiplatform application is one of the focues of this thesis.
|
||||
I decided that since this will be my first attempt at game engine development
|
||||
I need something that is relatively easy and has a lot of resources online.
|
||||
I would most likely not use advanced features of Vulkan and DirectX and
|
||||
therefore finish my thesis before approaching problems where OpenGL
|
||||
does not deliver more complicated architecture.
|
||||
From my own private preferences I also prefer software with
|
||||
open source license.
|
||||
|
||||
\subsection{Choice of OpenGL Library}
|
||||
There are 4 basic OpenGL libraries that I considered:
|
||||
\begin{itemize}
|
||||
\item freeGLUT
|
||||
\item SDL
|
||||
\item SFML
|
||||
\item GLFW
|
||||
\end{itemize}
|
||||
freeGLUT was created as opensource alternative to GLUT,
|
||||
is considered to be the worst out of all 4,
|
||||
written in archaic way, using C or very old C++,
|
||||
which in turn results in unexpected "buggy" behaviour,
|
||||
it is also not really popular with lack of online guides \\
|
||||
SDL - Simple DirectMedia Layer has big userbase,
|
||||
it is not designed to by used as a standalone
|
||||
library and requires additional libraries to do networking
|
||||
or to create more complex applications. \\
|
||||
SFML is the library with most features out of all 4,
|
||||
it supports networking, audio and has system features by
|
||||
default. It uses modern object oriented C++.
|
||||
Main problem with SFML is that it is not very popular API,
|
||||
therefore troubleshooting problems with SFML is quite hard and
|
||||
it has only few use guides online \\
|
||||
GLFW is an library that is both the most popular and with fewest features by default.
|
||||
It forces users to use additional libraries for networking,
|
||||
sound, physic calculations and so on but in turn is also
|
||||
quite small and flexible. It has biggest community and a
|
||||
lot of guides, like one hosted at
|
||||
\href{learnopengl.com}{learnopengl.com} or one created by
|
||||
programming youtuber Cherno \\
|
||||
I decided to use GLFW library. I wanted something that is
|
||||
relatively easy to troubleshoot and has abundance of
|
||||
learning materials online.
|
||||
|
||||
\subsection{GLAD and OpenGL Extension Handling}
|
||||
GLAD enabled the dynamic loading of OpenGL functions, this way engine can use the latest OpenGL features.
|
||||
|
||||
\subsection{Text and Image Rendering with FreeType, stb\_image, and ft2build}
|
||||
|
||||
FreeType and stb\_image were choosen for their simplicity and popularity
|
||||
|
||||
\begin{itemize}
|
||||
\item Font Rendering: With FreeType and ft2build, the engine can render text, crucial for messages, scores, and menus.
|
||||
|
||||
\item Image Loading: stb\_image simplifies the task of loading and processing various image formats, from PNGs and JPGs to more complex formats, making asset integration much easier.
|
||||
\end{itemize}
|
||||
|
||||
\chapter{Case Study: Development of a Prototype Match Three Game}
|
||||
\section{Game Concept and Design}
|
||||
In order to gauge the usability of our game engine, we decided to create a sample match three game using royalty free assets. First part of this process was game design
|
||||
|
||||
Loading…
Reference in New Issue
Block a user