Approaching things with a new angle

Oliver Marsh
Since December I stopped working on Mind Man as I was lacking direction. In the mean time I started working on some other projects, most notably a text adventure engine. Originally my plan was to make a video series using C to make games . The first project was a text adventure game just on the command line. However I was enjoying it so much, I forgot about the video series, and started developing it past the initial plans. While I was making it I was programming with a modular approach in mind. I wanted to create some reusable header files that I could drop into any project in the future, and give functionality like openGL, dynamic arrays etc.

I eventually lost steam with the text adventure game. It has most of the functionality, but I didn't have a good story idea, which worked well with the text adventure style.

The feature I like a lot it that I can declare the game code in a txt file, in a declarative fashion, and the game will read this in on startup.

The syntax looks like this, with colon and a keyword declaring what sort of function it is.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
:room room1 "bedroom" "You are in a room with somebodies dwellings. There is a bed on the floor and a table. It is night time." 

:object key "key" "A large key with inscribings on it."

:interaction TAKE  "You put the key in your backpack"    
:interaction DROP "You dropped the key" 
    
//:object "snake" "You see a snake coming towards you. It looks provoked."

//:attacker 2 "The snake lashes out at you, and bites you " 30
    
:object "bread" "There is an old piece of stale bread"

:interaction EAT "You ate the delicous bread" 5
:interaction TAKE "You put the bread in you backpack" 
:interaction DROP "You drop bread from your backpack"
    
:room room2 "corridor" "There is a long corridor and at the end there is a wrought iron gate."

:connectRooms room1 room2 "You see a pavement leading down a long corridor" "You see a small room with a bed." NORTH 


The main bring away from this project was I had these reusable header files, which I liked developing and liked the modular approach of building a game engine with. I just combine these components like lego and then write the game code on top it all. After this I started developing the header files a bit more and extending them to the OpenGL core profile and made an expandable array header file.

I decided to test these out in a platform type game. Using the IMGUI library and the header files, the game took shape quite quickly. Working on it I released I could turn mind man into this new engine. Instead of a top-down discrete grid based game, it would be a side scrolling platformer. It wouldn’t have the path finding component of Mind Man, but would have similar music puzzles.

What I have got in terms of engine code is working and is sufficient for a 2D game with 3D elements in it. Other than absolute necessary work (i.e. relating to gameplay code), I’ll try stay away from the engine code as much as possible. Also avoid going on any technical rabbit holes.
This is so I get a prototype up as quick as possible and have a fully functionally game working as soon as possible. Gameplay code all the way! (Until something breaks…).

I hope to get a fully functional game up and running within the next month. Then I can see the shape it is taking and see what needs to grow within the game (do we need more puzzles, story etc. ). I won’t be spending too much time thinking about the art at this point. For now I’ll just have some placeholders either from images of the internet or ones i’ve bought from itch.io (very good resource!).  Just so we know the engine is working. I may delve deeper into sound more than the art but again won’t be concentrating on it too much. 

I plan to work on the game a lot more, and upload more blog posts and plan to make some devlog videos

Thanks for reading!

PS: If you like the 'Making games in C' video, please let me know. I do want to make the series at some point.
Interesting read!

The "modular" approach is smart. Personally I also find it extremely useful to pull reusable stuff out from previous games and put in some modular header. Doing the same rote thing over and over again not only decreases productivity, but also morale. I think it was also talked about in Sean Barrett's stream.

I'm interested in the text adventure series, mainly the part where you parse the semantics of user input given some context. Can't wait for more videos on those!
Thanks Chen for the comment.

Yes, since changing to this approach I've been thinking about reusability a lot more when I write code. The thing I've found the hardest is knowing how much to rely on other header files. Ideally they should be able to exist on their own, but for example the font header file depends on the openGL one, which I think is fine, but it's knowing where to draw the line.

Also honouring the separation between the reusable headers and specific game engine code can present challenges. There's a few times where putting game specific stuff into the header files is easier than thinking about how to properly seperate the two.

I defiantly have another go at the C coding series soon. Thanks!