Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Well the past 2 weeks have been interesting. I went through two different game engines, then finally settled on love2d. I really like love2d a bunch, but was excited to make everything in my own engine. Ah well, next time. I managed to port everything over from my own engine to love2d in about a day, and got some of the cool tech implemented as well.

The first thing that I did was get my synth engine in. Right now there is just an 808 bassdrum, snare drum, and closed hat, but the tech layer is there for me to add as many modules as I want. It uses package.loadlib on desktop to bring in the dylib (osx dll) that I have built of my c code. Luckily I can just open up a new audio stream without any issues using SDL_openAudio and start chucking my buffers over to it.

The other neat bit of tech I have is a webserver that runs on the iOS device builds. With the server I can just post lua files directly from my text editor, and have it reload lua data without needing to recompile and send to the device.

My main love.update function that hotswaps lua code looks like the following:

function love.update(dt)
    -- check to make sure we are running the webserver
    if webserverLoadString then
        local webserverString = webserverLoadString();
        -- if so, bring the data in
        if webserverString ~= nil then
            local serverChunk = loadstring(webserverString)
            local noerr, res = pcall(serverChunk)
            if not noerr then
                print("error: ", res)
            else
                -- attach the incoming arcade game to the current state if it is the right type
                if mainState.class.name == "ArcadeState" then
                    mainState:remove(mainState.game);
                    res = res.start()
                    mainState.game = mainState:add(res);
                end
            end
        end
    end
end

on the c side, I am just running a webserver that queues up the data that has been sent to it, and waits until lua asks for it.

I suspect this could be built as an extension that runs on the desktop as well, but I haven't found a good crossplatform webserver yet. If anyone has any tips for stuff that isn't like a zillion c files, I am happy to hear about it. Even better if it already has lua bindings.