Motionmelody Plus Lua

In Motionmelody, I’ve been designing a system for loading and writing Lua scripts that can be executed in-game. It includes a fully-featured script editor so you won’t have to use Visual Studio Code or anything.

In the future I’m planning on adding a debugger and maybe an intellisense-like system.

I was mostly inspired by NotITG and the amount of bullshit you’re able to do in that game. Hopefully you’ll be able to make some cool stuff with it.

Here’s the full example script as just an example of what the Lua API is like:

local drawLines = {}
local currentLine = {}
local drawingLine = false
local drawColor = { 0, 0, 0 }
local drawColorIndex = 9;

local function isPointInRectangle(px, py, x, y, w, h)
    -- Check if the point is within the bounds of the rectangle
    if px >= x and px <= (x + w) and py >= y and py <= (y + h) then
        return true
    else
        return false
    end
end

local function drawPalette(r, g, b, i)
	local rectX = -640 + ((32 + 16) * i) - 32;
	local rectY = 360 - 32 - 16;
	local rectWidth = 32;
	local rectHeight = 32;
	
	if (i == drawColorIndex) then
		melody.graphics.setColor(0, 0, 0);
		melody.graphics.drawRectangle(rectX - 4, rectY - 4, rectWidth + 8, rectHeight + 8, 12);
	end
	
	if (isPointInRectangle(melody.player.getX(), melody.player.getY(), rectX, rectY, rectWidth, rectHeight)) then
		drawColor = { r, g, b, 1 }
		drawColorIndex = i;
	end
	
	melody.graphics.setColor(r, g, b);
	melody.graphics.drawRectangle(rectX, rectY, rectWidth, rectHeight, 8);
end

function OnDraw()
	melody.graphics.setZLayer(4);

	for i, line in ipairs(drawLines) do
		local color = line[5];
		melody.graphics.setColor(color[1], color[2], color[3]);
		melody.graphics.drawLine(line[1], line[2], line[3], line[4]);
	end
	
	if (drawingLine) then
		melody.graphics.setColor(drawColor[1], drawColor[2], drawColor[3]);
		melody.graphics.drawLine(currentLine[1], currentLine[2], currentLine[3], currentLine[4]);
	end
	
	drawPalette(1, 0, 0, 1);
	drawPalette(1, 0.5, 0, 2);
	drawPalette(1, 1, 0, 3);
	drawPalette(0.8, 1, 0, 4);
	drawPalette(0, 1, 0, 5);
	drawPalette(0, 0.5, 1, 6);
	drawPalette(0, 0, 1, 7);
	drawPalette(0.5, 0, 1, 8);
	drawPalette(0, 0, 0, 9);
	drawPalette(1, 1, 1, 10);
	
	-- reset button
	local resetX = 640 - 166 - 16;
	local resetY = 360 - 64 - 16;
	local resetWidth = 166;
	local resetHeight = 64;
	
	if (isPointInRectangle(melody.player.getX(), melody.player.getY(), resetX, resetY, resetWidth, resetHeight)) then
		if (melody.input.isMouseButtonPressed(0)) then
			drawLines = {}
		end
		melody.graphics.setColor(0.6, 0.6, 0.6, 0.5);
	else
		melody.graphics.setColor(0.2, 0.2, 0.2, 0.5);
	end
	melody.graphics.drawRectangle(resetX, resetY, resetWidth, resetHeight, 16);
end

function OnUpdate()
	if (melody.input.isMouseButtonPressed(0)) then
		currentLine = { melody.player.getX(), melody.player.getY(), melody.player.getX(), melody.player.getY(), drawColor }
		drawingLine = true;
	end
	
	if (melody.input.isMouseButtonDown(0)) then
		currentLine[3] = melody.player.getX();
		currentLine[4] = melody.player.getY();
	end
	
	if (melody.input.isMouseButtonReleased(0)) then
		table.insert(drawLines, currentLine);
		currentLine = {}
		drawingLine = false;
	end
end
Depression Is Sucks

Happy anti-gay month.

For the past couple years, I’ve been dealing with a huge depression. Mostly caused by my overwhelming cynicism about Humanity. It’s not fun to make video games when you feel this way. Constantly waking up every single day to spend 12 hours working on a game and then going back to sleep. It’s not that I hate making games, I really do love it, but it’s extensively obvious that this is not what humans were designed to do.

Suicide is a constant thought I have every day, it’s almost a joke at times. Very pathetic.

Happiness is overrated to be honest, comfort is more important right now. I just need the comfort to finish this game, and then we’ll see what happens next…

In my efforts to distract myself from the dishonorable state of my mind, I’ve decided to buy play some new games, not really a thing I do anymore.

Mini-Praise of Animal Well

Animal Well might be one of the greatest games of all time. Period. It’s no Pizza Tower but it’s definitely up there. The art, sound design, music, level design, it’s just a mastapeece. It goes to show that there are still people willing to make good and high quality stuff out there. Excellent.

My only problem with the game is the save system, it pretty much only exists to facilitate nostalgia and nothing else. It’s more of a checkpoint than an actual save. The game would’ve been better without it.

Hats off to Billy Basso.

How to Setup raylib with BeefLang

I said I would write another tutorial someday.

Honestly, Beef has been one of my most favorite languages to work with in the past few months, even more than C#!

Beef is compiled with no GC, and while I could probably write a whole post on how much I loathe garbage collectors, just know it makes the language really fast.

If you’re already familiar with C# (as I was), you can start using Beef pretty much instantly.

More info on it here.


Hoping to increase awareness of the language, I’ve created a very small and simple guide that demonstrates how to use one of my favorite game frameworks, Raylib, alongside one of my favorite languages.

I’m not going to go over the more advanced stuff. The Beef Documentation covers most questions you may have. You can also join the BeefLang Discord server and ask for help there.


Tutorial

First, Download and install Beef. If you’re reading before version 1.0, I would recommend using the Nightly Releases. They may already include fixes for bugs you could encounter and the latest features.

Now that you have Beef installed, open the Beef IDE, and you should see something that looks like this:

(Recent Projects blocked out for secrecy…)

Click the “Create Workspace” button, and select the folder you want to create your workspace in. Note: The name of the folder is what the initial startup project will be called.

A workspace in Beef is similar to a solution in C#, it contains all the projects inside your main project.

Press “Ctrl+Shift+S” to save your solution and everything in it.

Currently your project is empty. If you try to run your project by pressing “F5”, the IDE will ask if you want to auto-generate startup code because there is none. Select “Yes”.

If you press “F5” now, a console window will appear and quickly disappear. Congratulations, you have just created your first Beef program!

Let’s install Raylib so that we can use it with Beef.

Raylib is written in C, so to use it we’re going to have to write some bindings for it. Luckily, I already did that which you can clone from GitHub.

Extract the code to a folder and keep it in a safe place. We only need the “raylib-beef” folder for all purposes covered in this tutorial, so don’t worry about any of the other folders or files.

Right-click on “Workspace” (not the tab) and select “Add Existing Project”.

Go to the safe place where you stored the “raylib-beef” folder, and inside of it, and double-click on the “BeefProj.toml” file.

You should now see “raylib-beef” in your workspace panel.

Right-click on your main project and select “Properties…”.

From there, select “Dependencies” from under the “General” dropdown and click the checkbox next to “raylib-beef”.

You are now ready to use Raylib with Beef! I wrote a sample program that draws the raylib-beef logo to the window.

Copy and paste this into “Program.bf” under your main project and press “F5” to run.

using System;
using RaylibBeef;
using static RaylibBeef.Raylib;

namespace example; // Replace with your project name.

class Program
{
	public static int Main(String[] args)
	{
		InitWindow(800, 600, "Raylib Beef 4.5");

		var beefMain = Color(165, 47, 78, 255);
		var beefOutline = Color(243, 157, 157, 255);

		while (!WindowShouldClose())
		{
			BeginDrawing();
			
			ClearBackground(RAYWHITE);

			DrawRectangle(GetScreenWidth() / 2 - 128, GetScreenHeight() / 2 - 128, 256, 256, beefOutline);
			DrawRectangle(GetScreenWidth() / 2 - 112, GetScreenHeight() / 2 - 112, 224, 224, beefMain);

			DrawText("raylib", GetScreenWidth() / 2 - 44, GetScreenHeight() / 2, 50, beefOutline);
			DrawText("beef", GetScreenWidth() / 2 - 62, GetScreenHeight() / 2 + 46, 50, beefOutline);

			DrawRectangle(GetScreenWidth() / 2 + 54, GetScreenHeight() / 2 + 54, 42, 42, beefOutline);
			DrawRectangle(GetScreenWidth() / 2 + 62, GetScreenHeight() / 2 + 62, 26, 26, RAYWHITE);

			DrawCircle(GetMouseX(), GetMouseY(), 20, beefOutline);
			DrawCircle(GetMouseX(), GetMouseY(), 8, beefMain);

			DrawFPS(20, 20);

			EndDrawing();
		}
		CloseWindow();

		return 0;
	}
}

Have fun!

Motionmelody Update

Hello, It’s been quite a while, hasn’t it? Over a year since my last update on anything.

Let’s start with an update on the Motionmelody editor. It’s completely different now, with a waveform and full undo-redo support. We can finally make Darude - Sandstorm properly.

At this point, I’m about 60% done with the game. It’s taking me a little longer than I would’ve liked, but it’s definitely better than what I showed before.

Rhythm Heaven Visual Maker Stuff

Alright, first off let’s get some things straight: I have almost no idea what I’m doing; NOT.

I’ve probably made at least 12 rhythm games at this point, most didn’t make it past 3 months in development, but I’m feeling good about this one. I’m investing a lot of time into it, but I’m confident that this will be eventually finished.

Introducing Rhythm Heaven Movie Maker (name possibly not final)

Note that there is a lot in this screenshot I plan to change, but the point is that I’m really happy with how it looks right now.

Now, the purpose of this program is to create visuals for Rhythm Heaven Custom Remixes. While there is an audio editor for those, this is specifically for visuals.

I originally started it to help me make some visuals for a remix I was making. I’m deciding to expand it the more use cases I need for my videos. So I probably won’t be working on it full time as far as I’m concerned.

The code is very dynamic and I have a function for pretty much every use case I would need, so implementing things is just a matter of time and how fast I am at animating.

Here’s the Update code for Working Dough: