Is There Such a Thing as an Easy C Game Engine?

in #programmingyesterday (edited)

image.png

I’ve already stated that I love Python for, well, pretty much 80% of my programming.

That includes game development as you might have seen in past articles.

That’s all great apart from situations where you want to deploy a single compiled executable or where the rest of your code is already being developed.

My C-based dungeon game is in that exact situation so I have been considering my options.

Fortunately my needs are extremely simple, so simple in fact that I considered using one of the many GUI frameworks.

After all, the game is “tile based”, meaning all the game objects and the player are positioned on a grid like chess pieces.

In the past I’ve used SDL, which is up to version 3 now, and I know that works with Emscripten allowing compilation for the web, making it truly cross-platform for modern devices.

But I’ve heard great things about Raylib.

I hadn’t realised that Raylib games can also be compiled to WASM in the same way, plus is compatible with Mac, Windows, and Linux.

There are a lot of helpful and powerful added abilities that I’ve not even looked into yet too.

So far all I’ve done is got a sprite moving around under keyboard control over a basic tile map but I’m happy so far.

Prerequisites

Before we begin, ensure you have the following installed:

  • Git CLI – You can install it by downloading from the official Git website.
  • C/C++ Compiler – We’ll use GCC, but Clang or MSVC will also work.
  • Make – Required for building projects; available through your system’s package manager.

Install Linux drivers

sudo apt install libasound2-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev libxcursor-dev libxinerama-dev libwayland-dev libxkbcommon-dev

Cross-platform quickstart

Rather than compile Raylib myself I started with the QuickStart GitHub repo:

git clone https://github.com/raylib-extras/raylib-quickstart.git raylibdemo
Sort:  

Why must it be C?
Unless you are building a game engine, it probably isn't the best option.

Because my project is already C, it’s the rogue-like dungeon crawler I’ve been posting about.

I would think using C would drastically increase the time to finish and the amount of problems you run into.

These days most people shouldn’t be using c/c++ for most projects.

You’d be surprised because I already separated out the rendering from the logic. Remember the game up until now is character based, plus there’s no way to use python for the retro target computers I’m already compiling for successfully using c.

Ahh retro you probably are stuck with C

Yeah that said I could make the modern version as its own project without the constraints of the retro side which could be better in the long run

Loading...