Game Progress

I had the idea a year ago now to rewrite a prior attempt at a 2D game in C and SDL. I felt the need to (grudgingly) move away from C#/XNA after Microsoft deprecated the framework. I know that MonoGame exists as a port, but at the time, and even unto now, I've only encountered problems using it. Suffice to say, it did not work cleanly just swapping the library references. Due to my long-time fascination with learning C programming so I can later get more into the depths of certain areas of computer science (think OS and electronics programming), I've finally taken the leap and gotten knee deep into my game rewrite.

Arguably, C is not the greatest language to be writing a game in these days. The process lends itself perfectly to object orientation, very clear separation of concerns, and strong encapsulation with limited (or no) access to properties in the global scope. That being said, this project is for more than to simply rehash my prior experience with OO programming. It's an interesting tangential learning experience in organizing code in a language that has high potential of mushing into a ball of spaghetti. In future posts I'll be addressing some of the conventions that I have come up with. I don't know whether they fall into what the old-timers would consider "good" C programming practice, but with a new generation of users of a language come new ways of thinking about old problems (not to give myself too much credit - I'm sure I'm not trying anything that hasn't been done before).

As of last night I have a pretty basic framework of sorts built up. The game uses a statically sized playable area at 640x480 to alleviate the burden of buffering out-of-view map segments. I have basic support for directional key presses to move the player sprite around, and I have a simplistic message dialog box working with pagination for longer messages. I might want to make a page on this site with a list of things that I need to do yet so I can keep track of things. For now, here's a video that I captured of the current incarnation:


[Edit 06/10/2018 - I've added a page containing an expanded To-Do list here]

Here is a list of things that need doing in roughly the order I'll probably tackle them:

  • Sprite animation
  • Sprite movement with linear interpolation
  • An "asset_pipeline" module to centralize loading of sprite sheets and store them in an array so they can be destroyed easily at cleanup time
  • Map file loading and parsing of Lua
  • Collision detection
  • Connecting map files via "doors"

Those are more immediate need items. Here's a start of a longer-term list of things which readily pop into mind:

  • Player inventory and health
  • NPC movement paths, inventory, and health
  • Game script, NPC scripts
  • Save state
  • Sound effects
  • Flip map textures

Code Stats

I found a little utility called cloc which you can run to get stats for your codebase. Here's what I'm looking at so far:

Language                     files          blank        comment           code
C                                8             86             37            470
C/C++ Header                     8             50             27            310
make                             1              0              0              3
SUM:                            17            136             64            783