Posts

Using NimScript for your build system

Welcome to this tutorial on using NimScript for your build system! In this tutorial, we'll explore how to use NimScript to define tasks and automate your build process. NimScript is a powerful and flexible scripting language that is a sub-dialect of the Nim programming language. Benefits NimScript is a versatile scripting language that can be used on any platform where Nim can run. With NimScript, you can enjoy the same syntax, style, and ecosystem as compiled Nim. This means that developers won't need to learn anything new or switch contexts. [source: https://nim-lang.github.io/Nim/nims.html#Benefits ] Getting Started To use NimScript as your build system, you can use the task template. With this, you can write tasks that can be executed with a working Nim compiler. You can write these tasks either in the .nimble file or in a separate .nims file, which can be executed by calling nim taskname filename.nims directly. Running nimble tasks in the package root will display a

Naylib Goes Mobile: Porting to Android in Just 3 Days!

Image
Hello there! In this post, I'll share how I managed to port my Nim raylib bindings to Android in just three days. I'll talk about the challenges I faced and the solutions I used to make it happen. To be honest, I had no clue about Android development before starting this project. I just wanted to show off my cool demos to my classmates on my phone. So, after my exams were over and I had a few free days, I got right into it. Background So, I had recently revamped my build system. I dumped the outdated nake tool and started using nimble tasks instead. I also took into account some feedback from users of my library who weren't too happy. I changed the way the raylib static library is built by using this cool compile pragma that builds the C sources alongside the nim project. This approach makes it easier to target different platforms. So, let's say I want to develop a web game now, all I have to do is provide the right --cpu and --os command arguments when building my

An introduction to ECS by example

In this post, I'm taking a closer look at how an ECS system works, talking about the pros and cons of different approaches, and trying to answer if it's something that could be used outside of gaming. What is an ECS ECS is a programming pattern commonly used in high-end game engines, simulations, visual effects and CAD/CAM software, among others. The acronym stands for Entity-Component-System, and it forms the foundation of the ECS architecture. Unlike the traditional object-oriented programming approach based on inheritance, this architecture uses composition. While it's not as well-known for smaller projects, ECS is a go-to choice for top-tier applications where performance is of utmost importance. This is because it efficiently utilizes CPU instruction and data caches. In the following sections, we'll explore the ECS design of a basic game. Components To create basic movement, two main components are used: transformations and movement. Transform2d enables entiti