Site icon Libretro

ChaiLove – Another Take on 2D Game Development

Whale from the Love2D logoWhen it comes to 2D game development frameworks, there are many options out there for indie game developers. Every framework has its own pros and cons, and its own use cases. Today, let’s talk about LÖVE, baby.

LÖVE is an awesome framework to make 2D games in Lua. With some modification, these games can be brought to libretro though Lutro. With the advent of C++14, are there tools and features we can bring in to improve the scripting experience behind developing 2D games?

Meet ChaiLove, an experiment in porting LÖVE to ChaiScript. Some of the goals behind this endevour include:

Examples

It’s pretty easy to get started with ChaiLove, just check out these code snippets.

Drawing text

def draw() {
    love.graphics.print("Hello World!", 400, 300)
}

Drawing an image

global whale

def love.load() {
    whale = love.graphics.newImage("whale.png")
}

def draw() {
    love.graphics.draw(whale, 300, 200)
}

Playing a sound

global music

def load() {
    music = love.audio.newSource("music.wav")
    love.audio.play(music)
}

For more information on ChaiScript, see the ChaiScript language reference.

Case Study: Floppy Bird

Floppy Bird is an example of what a ChaiLove game could look like. The game is a re-imagining of Flappy Bird using ChaiLove. It features rotating sprite graphics, music, sounds, a high score, save state support, and more. It’s available to download from the project releases, or directly through RetroArch:

  1. Online Updater → Core Updater → ChaiLove
  2. Online Updater → Content Downloader → ChaiLove → Floppy Bird.chailove
  3. Load Content → Downloads → Floppy Bird.chailove

The following video shows not only how to download the ChaiLove core and Floppy Bird, but also some gameplay:

What’s Next?

ChaiLove has a few places where it could grow, and we’ll need your help for it to get there. Some ideas include:

Resources

Exit mobile version