Antiruins engine

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
User avatar
lerabot
Insane DCEmu
Insane DCEmu
Posts: 134
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Sun Nov 01, 2015 8:25 pm
Has thanked: 2 times
Been thanked: 19 times

Antiruins engine

Post by lerabot »

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 and .wav for sound effects.
- 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 Thu Oct 05, 2023 1:58 pm, edited 2 times in total.
These users thanked the author lerabot for the post (total 3):
|darc|GyroVorbisIan Robinson
User avatar
lerabot
Insane DCEmu
Insane DCEmu
Posts: 134
Joined: Sun Nov 01, 2015 8:25 pm
Has thanked: 2 times
Been thanked: 19 times

Re: Antiruins engine

Post by lerabot »

Just added 2 examples, one for playing dreamRoQ video with sound (not 100% accurate timing, but quite decent) and one for savefiles.
These users thanked the author lerabot for the post (total 3):
|darc|Ian RobinsonGyroVorbis
User avatar
GyroVorbis
Elysian Shadows Developer
Elysian Shadows Developer
Posts: 1874
Joined: Mon Mar 22, 2004 4:55 pm
Location: #%^&*!!!11one Super Sonic
Has thanked: 80 times
Been thanked: 62 times
Contact:

Re: Antiruins engine

Post by GyroVorbis »

lerabot wrote: Fri Sep 22, 2023 12:39 pm The engine backend is written in C and is pre-compiled, meaning you don't need the Dreamcast toolchain to use this tool.
:o

That... is actually really freaking epic. I'm going to start telling everyone who doesn't know C or C++ but wants to start with DC development to start here.
These users thanked the author GyroVorbis for the post:
Ian Robinson
User avatar
lerabot
Insane DCEmu
Insane DCEmu
Posts: 134
Joined: Sun Nov 01, 2015 8:25 pm
Has thanked: 2 times
Been thanked: 19 times

Re: Antiruins engine

Post by lerabot »

I'll make a video to show the whole install / building game process. I also think it's quite epic :P. It does have some limitation (of course) but it's quite capable. Summoning Signals is made with this engine (albeit an older version).
These users thanked the author lerabot for the post:
Ian Robinson
User avatar
Ian Robinson
DC Developer
DC Developer
Posts: 116
Joined: Mon Mar 11, 2019 7:12 am
Has thanked: 209 times
Been thanked: 41 times

Re: Antiruins engine

Post by Ian Robinson »

lerabot wrote: Thu Oct 05, 2023 12:54 pm I'll make a video to show the whole install / building game process. I also think it's quite epic :P. It does have some limitation (of course) but it's quite capable. Summoning Signals is made with this engine (albeit an older version).
This really is super fantastic thank you for doing this :) I have tested and seen how pro and nice the engine is on your game :)
Post Reply