C / ++ Code Thought Process


Ok so from today the game now has objective(s). To be quite honest, I only added the singular "get over this amount of score" objective as of now because I am unsure what I will want in the future.

But, that's why i'm writing a tech post to be honest. I wanted to talk about my thought process when writing the code for this particular system as I had a couple of options when doing this.

I try my hardest to only write code that will actually be of immediate profit IE not try to complicate things from step 1.
A perfect example of this is when I write something that maybe seems like it should be a function. I don't immediately functionize the procedure due to the fact that I may never need to do said procedure more than once throughout the entire game's lifespan.

There is the obvious processor save (depends on if the compiler auto inlines it for you or not tho) time since you won't have a jmp instruction but this isn't the main reason why I don't do this. Again, I don't do this due to the fact that when you add a function, you're literally adding to this evergrowing and more complex theoretical "node network" of functions that could literally be called at any point in the program whether it is appropriate or not. I have noticed that complexity is literally that thing that makes games harder to make. It is also absolutely required since you're going "forwards" with a game in terms of starting with no math or simulation but adding said things that interplay with each other to create new and complex interactions that ultimately form the thing we call a video game. Or so is the way that I think about games these days. Whereas on the other hand if you take a real world game like baseball, you're actually starting with probably near infinite complexity (ie gravity works only one way on the "surface") and trying to eliminate complexity to make a more fair game (so when the little dog comes and snatches the baseball, you wish you could remove that "event" but actually can't because that's the way the world works).
So anyways, there's my rant on why I don't like functions lol

That being said, once I end up doing the same operation twice (or more or less the same operation) I end up writing a function to kill code duplication as that too can easily overcomplexify the code base (because when you make one change on your code, you're going to want that procedure thats the same or similar to be changed in every single spot as you usually are correcting the behaviour of the func).

Thanks for reading! I hope you got something out of it and have an awesome day :)

Files

Funmi_Windows.exe 224 kB
Oct 01, 2021
ChallengeList.txt 1 kB
Oct 01, 2021

Get Funmi

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.