Libdragon Tutorial

Libdragon is a software development kit (SDK) for making games on the Nintendo 64. It allows you to develop using the C programming language and the GCC compiler up to C11.

For the novice user, it can be very intimidating and difficult to use, so it’s best to have a firm understanding of C before starting on your N64 development journey through Libdragon. I will also be using Git for version control, Docker for something and Make for compiling builds throughout this tutorial.

Libdragon basics

These guides are the bare minimum to make a Libdragon-based game. It will only have a text interface so it won’t be very exciting, but it’s a necessary stepping stone to creating more complex projects.

Installing Libdragon

Check the page on setting up Libdragon for an in-depth guide on how to get it to work on your PC. With this guide, you'll end up with a skeleton project that you can use as a basis for your project.

Compiling with Libdragon

What good is source code if you can’t compile it? This page on compiling with Libdragon will show you how to build your first N64 ROM file.

Libdragon Console

The first thing that you can modify in your program is the console. Let’s have a look at how it can be manipulated to create text-based games or displaying debug information.

Controlling controllers

What is a game without the ability to control it? In this tutorial we'll have a look at the various ways to manage the controller input.

Dragon File System (DFS)

The Dragon File System (DFS) is used to hold data on the ROM and then load as needed. It is mostly used to store sprites and audio, but can be used to hold map data and arbitrary files.

Making sprites with mksprite

Mksprite is a N64 development tool for converting PNG files into sprite files that are usable by the Libdragon library.

Converting audio with audioconv64

You can use audioconv64 to convert audio files (.wav, .xm & .ym) to N64 format (.wav64, .xm64 & .ym64) for use with the Libdragon audio subsystem.

Libdragon Graphics

The Libdragon graphics engine has a few ways of defining how you can generate a visual display using both software and hardware methods.

Display Subsystem

The display subsystem in Libdragon is used to provide a context for the Nintendo 64's viewport, bit depth and resolution.

Software graphics

Libdragon has a library of software graphics rendering functions that can be used to generate colours as well as draw shapes and sprites.

OpenGL

Libdragon is compatible with OpenGL, which is an industry-standard API for rendering 2D and 3D vector graphics.

Hardware graphics – updated

You can use the N64's Reality Display Processor to speed up hardware graphics rendering of shapes and sprites. It's faster, but more complex and less flexible.

Libdragon Audio

The Libdragon audio subsystem is used to play, stop and manipulate the audio stream. Though it only works with WAV, XM and YM files, it can be very versatile given the right input.

Composing & converting audio

Libdragon has 3 available file types for its audio output - WAV, XM and YM. This page will show how you can start composing your own.

Playing audio using Libdragon

This tutorial will show you how Libdragon's audio subsystem is used to play WAV, XM and YM files, mix them using the RSP and pushing it via the audio buffer and then out.

Audio mixer (WAV effects)

The audio mixer can be used to modify waveform audio to create unique sounds using the same space in memory.

XM & YM effects

There is also a separate way of manipulating XM and YM audio tracks. It's not as flexible as WAV, but still useful in some occasions.

Libdragon saving

While it is possible to make a game that doesn’t use any saves, it severely limits how long your game can be. Let’s have a look at how this can be done with Libdragon.

Saving on EEPROM

The EEPROM is used to save gameplay data of up to 16kbit. Let's have a look on how to interact with it using both high and low-level methods.

Saving on a Controller Pak

It is also possible to save on a Controller Pak to take advantage of the larger save space and portability.

Full page index

Search

Subscribe to the mailing list

Follow N64 Squid

  • RSS Feed
  • YouTube

Random posts