diff --git a/slides.tex b/slides.tex index 5776286..ec537c6 100644 --- a/slides.tex +++ b/slides.tex @@ -35,8 +35,8 @@ \begin{frame}{Who are we?} \begin{itemize} \item Group of 5 people - \item At the start of the project we had about 1 Semester of C++ Programming under our belt - \item All shared a common interest in C++ Programming + a curiosity for game development + \item 1 Semester of C++ Programming under our belt at the start + \item Common interest: C++ Programming + game development \end{itemize} \end{frame} \subsection{The project} @@ -51,21 +51,105 @@ \begin{itemize} \item Started out with a Minigame \item Realized we can split it into \enquote{Engine} and \enquote{Game Specific} Content + \item Goal: make easy to use engine without GUI \Rightarrow essentially a game dev lib \end{itemize} - \Rightarrow We could then build on what we have while simultaneously having an implementation using the engine + \Rightarrow We could then build on what we have while simultaneously having an implementation using the engine as proof of concept Smart right :D ?\dots \end{frame} \begin{frame} - What awaited us was about the equivalent of trying to neatly sort single spaghetti strands next to each other after - it has previously been generously mixed with some *juicy* pasta sauce. + What awaited us was about the equivalent of trying to neatly sort single spaghetti strands after + they had previously been vigorously jumbled up and mixed with some *juicy* pasta sauce. In other words, quite a messy endeavor\dots \end{frame} \begin{frame}{Roadmap} -\nth{3} Semester - learning SDL +\nth{3} Semester - learning SDL and the principles of game development \nth{4} and \nth{5} Semester - making the engine + +At this point we were certain this would be a walk in the park as it would essentially *just* be some refactoring, right?. +\end{frame} +\note[itemize]{ + \item Somewhere around this time we realized there was more to compiling a C++ program than pressing + the run button in Visual Studio. + \item (subtle foreshadowing about how using VS set us back many many hours :,)) + \item There was quite the naive optimism at the end of this semester (i.e wheeee we made a whole game on our own we are unstoppable :D) + \item (about 4th/5th semester): separating the project into the game and the parts of the program that could be reused for other games. +} +\begin{frame} +Realization: doing it right the first time is better than fixing it later. + +And no, don't "just start programming because the architecture will solve itself later" +\end{frame} + +\begin{frame}[allowframebreaks, fragile]{Spaghetti, an example} +\begin{itemize} + \item Original Ticket:\enquote{attackspeed stat needs reimplementation} + \item Step one, make it so Stateffects are not hardcoded in Engine +\framebreak +\begin{minted}[linenos,autogobble,samepage=false,breaklines]{c++} +void chickengame::pickupables::movementSpeedEffect(Entity* player) +{ + player->getComponent() .modifyStatDur(Stats::MOVEMENT_SPEED, BUFF_DURATION, BUFF_VALUE); +} +\end{minted} + +\framebreak + + \item Step two \dots uh oh how do i manage a stateffects life cycle? +\begin{minted}[linenos,autogobble,samepage=false,breaklines]{c++} +void StatEffectsComponent::update() +{ + for (int i = 0; i < MAX_STATS; i++) + { + if (this->buffs.at(i) == 0) continue; + if (this->buffs.at(i) - 1 == 0) + { + this->resetStatValue((Stats)i); + } + this->buffs.at(i) -= 1; + } +} + +void StatEffectsComponent::modifyStatDur(Stats stat, int duration, int value) +{ + if(this->buffs.at((uint8_t)stat) == 0) this->modifyStatValue(stat, value); + this->buffs.at((uint8_t)stat) += duration; +} +\end{minted} + +\framebreak + + \item Step three \dots oh no why are stat numbers hardcoded in the engine? + +\begin{minted}[linenos,autogobble,samepage=false,breaklines]{c++} +void StatEffectsComponent::modifyStatValue(Stats stat, int modifier) +enum class Stats +{ + MOVEMENT_SPEED, + ATTACK_SPEED +}; +\end{minted} + +\framebreak + + \item Step 3.2 uhhhhhh i should make it so developers can add their own stats + \item Step 3.2.4 how does one elegantly access those set stats so the engine can also work with them + \item Step ??? help why is this one commit touching 15 files and still not remotely done??? +\end{itemize} +\framebreak + +\begin{minted}[linenos,autogobble,samepage=false,breaklines]{c++} +void chickengame::pickupables::movementSpeedEffect(Entity* player) +{ + int basePlayerSpeed = player->getComponent() .getEntry("speed"). value_or(0); + player->getComponent().setEntry("speed", 4); + player->getComponent() .addEffect(BUFF_DURATION, [&]() { + player->getComponent() .setEntry("speed", basePlayerSpeed); + }); +} +\end{minted} \end{frame} \section{Learnings} @@ -76,9 +160,19 @@ \item On UAS: Only ever Make or no project setup \end{itemize} \end{frame} + \begin{frame}{Visual Studio} -Hate +\begin{itemize} + \item Visual C++ :,) + \item Extra generated files by IDE + \item VS Solutions have some filepath quirks if you're not careful +\end{itemize} \end{frame} +\note[itemize]{ + \item Undefined behaviour first noticed by "huh but it works for me :p" + \item When trying to access assets things went weird +} + \begin{frame}{How the \_ do I import a library?} \begin{itemize} \item git-modules