Wednesday, 27 September 2023

Chapter 27 // Exercise 2, 3 - Principles & Practice Using C++

In this exercise I'm using Visual Studio 2019 and ISO C11 Standard.

Chapter 27 // Exercise 2

Complete the intrusive List example in section 27.9 and test it using every function.

This was quite a painful exercise. Mainly because I hate linked lists and they confuse me with their mPrev->mNext->mPrev malarky but this time I had to do it in C! C also just has so many parenthesis.

Chapter 27 // Exercise 3

"Pretty up" the intrusive List example in section 27.9 as best you can to make it convenient to use. Do catch/handle as many errors as you can. it is fair game to change the details of the struct definitions, to use macros, whatever.

So I turned the code into my usual style and found a bug? I'm not sure but I couldn't get it to run using the code in the book. In the main() function it needs to be struct Link* curr. I think he did that on purpose though as the for loop doesn't work otherwise because a List doesn't have suc as a member variable.

Apart from that, I didn't really bother with the other things.

Chapter 27 // Exercise 2 - Principles & Practice Using C++


Friday, 22 September 2023

Unreal Free For The Month Jam // September 2023 - Escape The Palace Hall

What is Free For The Month Jam?? I explain it all here in great detail:

Basically, it's a game jam I made up where you have to use the current Unreal Free For The Month Assets to do, something.

It's called a jam instead of a game jam because you don't have to make a game. It can just be a simple mechanic. Whatever floats your boat.

This month I sat down and was actually able to complete my own jam for the first time since I started it almost year ago.

My entry this month came from ChatGPT which told me to create:

So that's what I did. And I made it into a video:


It's very basic, but I really struggle with finishing projects so I was proud I managed to get this to a packaged state and was happy to call it finished.

I ended up creating a very small game that requires you to find 2 items, pick them up and place them on pedestals to unlock the doors. If you don't do it within 60 seconds, you lose. It features a grab mechanic and a simple interact mechanic with the doors, as well as two trigger box events that cause spooky things to happen. I then added some sounds and music for ambience.

Keeping the scope small was really difficult and hopefully I'll be able to complete next months faster.

Monday, 28 August 2023

Chapter 27 // Exercise 1 - Principles & Practice Using C++

In this exercise I'm using Visual Studio 2019 and ISO C11 Standard.

Chapter 27 // Exercise 1

Implement versions of strlen(), strcmp(), strcpy().

I feel like I'm being punished. Please let me go back to C++, I swear I'll be good. 




Monday, 24 July 2023

Dev Diary // FLTK & Tetris Part 2

A little while ago I had fun making Tetris in FLTK; a library not meant for games.

It worked perfectly except for the bad flickering that I thought was down to the fact that FLTK just wasn't designed to handle games.

Then today I was working (as usual), and I saw a some code in Unreal Engine called double buffer and a light bulb went off in my head. When using something like Direct X, you usually set up a swap chain, and a buffer and a second buffer and all that jazz because the whole point is to draw your next frame to an unseen buffer, then you swap the unseen buffer with the one currently being displayed; ad infinitum. 

I wondered if this was the actual issue and the flickering was being caused by screen tearing. Turns out, it was. I had a look at the FLTK documentation and they have a solution for this!

Fl_Double_Window is a type of Fl_Window, so seeing as how my Window wrapper is a wrapper around Fl_Window, I just inherited from Fl_Double_Window instead and voila! No more flickering; it just works™.

FLTK and Tetris using C++ - Using FL Double Window to prevent screen tearing

This made me very happy. It's very smooth now and it's actually got me excited for my planned Game Engine: Blink. What can I create now? I could do anything.

Thursday, 20 July 2023

Chapter 27 // Drill 1, 2, 3 - Principles & Practice Using C++

In this exercise I'm using Visual Studio 2019 and ISO C11 Standard.

Chapter 27 // Drill 1

Write a "Hello, World!" program in C, compile it, and run it.

The last time I did this, I used Visual Studio Code and had to set up my own build script and call it on the command line. I'm much lazier now and I'm just using Visual Studio Community.


Chapter 27 // Drill 2

Define two variables holding "Hello" and "World!" respectively; concatenate them with a space in between; and output them as Hello World!

I was a bit embarrassed that it took me a good 25 minutes to do this exercise lol. I got to "define 2 variables" and was like "how do string again??" I also got caught out by the missing terminating nulls and using strcpy instead of strncpy.


Chapter 27 // Drill 3

Define a C function that takes a char* parameter p and an int parameter x and print out their values in this format: p is "foo" and x is 7. Call it with a few argument pairs.

A little bit more what I'm used to. I absolutely despise that Unreal Engine uses printf so prolifically. I love cout << and I'm not afraid to say it.