ANTIRUINS Engine

Place for discussing homebrew games, development, new releases and emulation.

Moderators: pcwzrd13, deluxux, VasiliyRS

User avatar
lerabot
blackout!
Posts: 135
Joined: Tue Oct 27, 2015 12:40 am
Dreamcast Games you play Online: Starlancer

ANTIRUINS Engine

Post by lerabot »

Image

I'm releasing the first version of my 2D dreamcast engine Antiruins.

The engine backend is written in C and is pre-compiled, meaning you don't need the Dreamcast toolchain to use this tool.
Instead of C, the game code is written in Lua. Lua is a neat scripting language that is decently fast, has memory management, easy to learn, etc.
This greatly reduce compilation and debugging of the game and lets you iterate faster.

The engine currently supports:
* Texture loading using .dtex and .png files.
* Music streaming using CDDA audio.
* .wav sound effect.
* Loading/saving LUA table to a memory card.
* Displaying images in the VMU.
* Playing DreamRoQ video.

Currently supported but need better documentation/testing:
* Sprite atlas and sprite animation.
* Map loading.

A sample game looks like this:

Code: Select all

local gw = {}

local logo, sfx, bgm
local texX, texY = 320, 240
local realTime = 0

-- Game Create
function gw.create()
    -- Loads a font from a file.
    -- The font file is a texture atlas with 16x8 characters
    -- The last argument means no font resizing.
    local font = graphics.loadFont(findFile("assets/MonofontSmall.dtex"), 16, 8, 0)
    

    -- Loads a texture from a file.
    -- Find file will look for the file at /pc /rd / cd and /sd
    -- It will also look for the file in the current game directory
    logo = graphics.loadTexture(findFile("assets/logo.dtex"))

    -- Loads a .wav file in the SPU memory. Mostly used for short sound and SFX.
    sfx = audio.load(findFile("assets/login.wav"), "SFX")

    -- Loads the first .wav file in the music folder.
    bgm = audio.load(0, "STREAM")
    -- Play the music at 200/254 volume and loop.
    audio.play(bgm, 250, 1)
end

-- Game Update
function gw.update(dt)
    realTime = realTime + dt

    if input.getButton("START") then
        exit()
    end

    if input.getButton("A") then
        audio.play(sfx, 210)
    end

    -- Get the joystick of controller 1
    local joy = input.getJoystick(1)
    texX = texX + joy.x / 128.0
    texY = texY + joy.y / 128.0

end

-- Game Render
function gw.render(dt)
    graphics.setClearColor(0,0,0.5,1)

    graphics.setDrawColor(1,0,0,1)
    -- Arguments are: textureID, x, y, width, height, rotation
    local texWidth = 128 + (math.sin(realTime) * 64)
    local texHeight = 32 + (math.sin(realTime) * 16)
    graphics.drawTexture(logo, texX, texY, texWidth, texHeight, realTime * 10)

    graphics.setDrawColor(1,1,1,1)
    graphics.print("DT: " .. dt, 20, 440)
end

function gw.free()
end

return gw
It is currently in alpha stage, but my two project (The Hideout and Summoning Signals) are using this engine.
There are other fun stuff in there but I need to complete the documentation and clean up some of the code.
Feel free to inspect the lua folder to see all the function available.

You can read the documentation here
Here's the GitLab link

There is no license file for now, but consider this BSD-2.
Last edited by lerabot on Sun Oct 08, 2023 5:43 pm, edited 2 times in total.
Image
Indie Game Studio
colgate
Doom
Posts: 185
Joined: Sun Jan 03, 2016 2:30 pm
Dreamcast Games you play Online: PSO

Re: Antiruins Engine

Post by colgate »

That's cool, does dreamroq videos with audio work?
User avatar
lerabot
blackout!
Posts: 135
Joined: Tue Oct 27, 2015 12:40 am
Dreamcast Games you play Online: Starlancer

Re: Antiruins Engine

Post by lerabot »

It does play DreamROQ video with sound. I'm using BBhoodsta's version which is not 100% frame accurate, but still pretty decent.

I just added 2 new examples (video using DreamRoQ and how to save/load files) and will update the documentation today.
Image
Indie Game Studio
colgate
Doom
Posts: 185
Joined: Sun Jan 03, 2016 2:30 pm
Dreamcast Games you play Online: PSO

Re: Antiruins Engine

Post by colgate »

That's really cool I'll check it out for sure.
User avatar
lerabot
blackout!
Posts: 135
Joined: Tue Oct 27, 2015 12:40 am
Dreamcast Games you play Online: Starlancer

Re: Antiruins Engine

Post by lerabot »

I want to start a game exemple to help people get started. The engine quite flexible and can could do shmups, Visual Novels, Platformer and 2D RPG quite well.

I feel like we have seen quite a few shmups, but I'm wondering if there are any genre that you'd like a template of?
Image
Indie Game Studio
Green Ranger
killer
Posts: 273
Joined: Mon Jan 19, 2015 5:38 pm

Re: Antiruins Engine

Post by Green Ranger »

lerabot wrote:I want to start a game exemple to help people get started. The engine quite flexible and can could do shmups, Visual Novels, Platformer and 2D RPG quite well.

I feel like we have seen quite a few shmups, but I'm wondering if there are any genre that you'd like a template of?
Personally I would love to see a RPG and Fighting Game template, if possible. :)
colgate
Doom
Posts: 185
Joined: Sun Jan 03, 2016 2:30 pm
Dreamcast Games you play Online: PSO

Re: Antiruins Engine

Post by colgate »

I think moving sprites, animation and collision are the most hard concepts to learn.
User avatar
lerabot
blackout!
Posts: 135
Joined: Tue Oct 27, 2015 12:40 am
Dreamcast Games you play Online: Starlancer

Re: Antiruins Engine

Post by lerabot »

Thank you for the feedback. I'll make a template with a simple character movement for a 2D RPG and add simple collision as well.

I think I even have basic support for Tiled Map (https://thorbjorn.itch.io/tiled) somewhere.
Image
Indie Game Studio
User avatar
lerabot
blackout!
Posts: 135
Joined: Tue Oct 27, 2015 12:40 am
Dreamcast Games you play Online: Starlancer

Re: Antiruins Engine

Post by lerabot »

I added a sprite animation example and made a quick start video to help you get started.

Image
Indie Game Studio
Post Reply