About a year ago I was curious about building an ECS-based game engine with world simulations like in dwarf fortress, but obviously at much smaller scale while playing Starfield. Something cool started to materialise after tinkering so I thought why not turn it into a space-sim roguelike with a simulated living world.
I use swift because it gives me fantastic devex with all its great type inference and macros + raylib gives me cross platform input handling / rendering and window management.
C-interop setup is basically instant - you point compiler to c headers and the API becomes immediately visible on swift side
As for swift ergonomics, I particularly love that I can now write very readable code, like:
> world.addRelation(attacker, Attacks.self, target) > world.addRelation(player, Owns.self, sword)
or
> for (entity, position) in world.query(Position.self).with(Health.self, Velocity.self).without(Enemy.self) {}
One example: the following wouldn't compile in swift:
func query<each T, each K>(
_ body: ((repeat each T), (repeat each K)) -> Void
) { ... }
so you kinda work around it with extra type wrappers but this looks ugly - I've been using macros to hide some of the ugliness away xDedit: the example is oversimplified just to show the point - in this example compiler can't really tell where T ends and K starts, so its logical; but I had more complex cases where a human would've been able to infer types correctly
> if yes what are the things that raylib is missing that these engines have?
Asset management and import pipelines, rendering pipeline, loads of ready-to-go features like environments, baked lighting and global illumination, AO, reflections, particle systems, input mapping and event propagation, scripting, audio systems, GUI systems, and lots more.
Raylib is a library that you could use to build all that stuff, but otherwise it's a useful library, not a fully-featured game engine.
If you don't want a game engine and know exactly what you features you need and want to build only that, then Raylib is a great option.
If you don't want to write a global illumination system or asset management pipeline but would rather focus on creating gameplay, then a game engine is a good choice.
Raylib helps you draw stuff, play sound, and do the basics. But you're gonna be writing your own lighting/raytrace/pathfind/etc functions and it's ultimately going to take longer. The upside is if you need to do something very unique, all of the power to mske it reality is in your hands because Raylib isn't opinionated on how your game logic works and how it's packaged up. It's just the delivery guy to give the result to the user.