[WIP]BeatFever Mania ~ osu! Engine reimplementation

Show off your games, demos and other (playable) creations.
User avatar
Sulunia
Party member
Posts: 203
Joined: Tue Mar 22, 2016 1:10 pm
Location: SRS, Brazil

Re: [WIP]BeatFever Mania ~ osu! Engine reimplementation

Post by Sulunia »

Davidobot wrote:I would recommend using dt to solve the stutter problem. Also, maybe round your values to whole numbers before drawing, using math.int(coord).
"dt" is being used already as part of the calculation of the interpolated song timer. This song timer is then used in the calculation of the notes vertical position, so i assume dt is already applied.
This interpolated song timer is used exactly to make sure the notes don't stutter whilst sliding down the screen. A nicer explanation about this can be found here: https://www.reddit.com/r/gamedev/commen ... the_music/
NightKawata wrote:
Davidobot wrote:I would recommend using dt to solve the stutter problem. Also, maybe round your values to whole numbers before drawing, using math.int(coord).
math.int is a Lua 5.3 function, I believe? I don't see any points to Lua 5.3 in the topic, so I don't think he'd be able to do that? Unless you're referring to an external library or the sort.
The lua Love2d 0.10.1 uses is lua 5.1, so i guess it doesn't have math.int().
Nixola wrote:math.floor will do I guess
Exactly. I'll later upload a version of the game with debugging enabled and the code i'm using to update the notes Y position in order to try to clarify things as much as i can. I don't think i'll be able to simplify the game without it having at least 6 lua files along with it.

@edit
Regarding working directly with zip files, you guys mean it's better to:
1) Scan a folder for osz files
2) Mount these files to a songs folder in the save directory
3) Delete the extracted/installed .osz file
4) Load songs from the savefolder?

@edit2
Figured out what i was doing in the update note position logic. Thanks for the suggestions! I had to use the song time DT.
Don't check my github! It contains thousands of lines of spaghetti code in many different languages cool software! :neko:
https://github.com/Sulunia
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: [WIP]BeatFever Mania ~ osu! Engine reimplementation

Post by Davidobot »

Sulunia wrote: Regarding working directly with zip files, you guys mean it's better to:
1) Scan a folder for osz files
2) Mount these files to a songs folder in the save directory
3) Delete the extracted/installed .osz file
4) Load songs from the savefolder?
That should do it. I even wrote a zip file extractor a while ago, which might come in handy.

EDIT: Welp, my last post was my 1000th. I guess is my 1001th. Wow, that happened fast. I would like to take this opportunity to thank my mum for not actually unplugging my computer when I didn't go to dinner fast enough.
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
Sulunia
Party member
Posts: 203
Joined: Tue Mar 22, 2016 1:10 pm
Location: SRS, Brazil

Re: [WIP]BeatFever Mania ~ osu! Engine reimplementation

Post by Sulunia »

It helps a lot. I'll work on this right now.

Also, congrats on 1000 posts!

@edit

@Davidobot where does the extracted .zip file go to? Nothing happens when i call the function here.
Im trying to load an .osz file from the "install" folder in the game directory, so it loads the file and extracts it to "installedSongs" in the save directory.
Don't check my github! It contains thousands of lines of spaghetti code in many different languages cool software! :neko:
https://github.com/Sulunia
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: [WIP]BeatFever Mania ~ osu! Engine reimplementation

Post by Davidobot »

Sulunia wrote: @Davidobot where does the extracted .zip file go to? Nothing happens when i call the function here.
Im trying to load an .osz file from the "install" folder in the game directory, so it loads the file and extracts it to "installedSongs" in the save directory.
That script is designed to work with zip files in the save directory of the game, inside appdata. It extracts it into a folder called the same as the zip file, if I remember correctly.

EDIT: Nope, it unzips the file straight into the directory. You can easily modify this to go into a separate folder.
Nevermind what was written here.

EDIT 2:
I went an rewrote the code for you <3

Code: Select all

local lfs = love.filesystem

local function enu(folder, saveDir)
    local filesTable = lfs.getDirectoryItems(folder)
	if saveDir ~= "" and not lfs.isDirectory(saveDir) then lfs.createDirectory(saveDir) end
   
    for i,v in ipairs(filesTable) do
		local file = folder.."/"..v
		local saveFile = saveDir.."/"..v
		if saveDir == "" then saveFile = v end
      
        if lfs.isDirectory(file) then
			lfs.createDirectory(saveFile)
            enu(file, saveFile)
        else
			lfs.write(saveFile, tostring(lfs.read(file)))
		end
    end
end

function extractZIP(file, dir, delete)
	local dir = dir or ""
	local temp = tostring(math.random(1000, 2000))
	success = lfs.mount(file, temp)
        if success then enu(temp, dir) end
	lfs.unmount(file)
	if delete then lfs.remove(file) end
end
The function extractZIP works as so:
file refers to the location of your zip file in the save directory. filesystem.mount only works for things inside the save directory.
dir refers to the folder to unzip in. Leave empty or as "" to extract directly into the save directory.
delete is a boolean which if true, deletes the original zip file after running the function.
Last edited by Davidobot on Thu Mar 31, 2016 6:02 pm, edited 2 times in total.
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
Sulunia
Party member
Posts: 203
Joined: Tue Mar 22, 2016 1:10 pm
Location: SRS, Brazil

Re: [WIP]BeatFever Mania ~ osu! Engine reimplementation

Post by Sulunia »

Yup, i just found that out.

So, people would have to place the ".osz" beatmaps right into the love save folder first? That sounds more complicated than the actual installation instructions, doesn't it? :huh:
The person would have to first launch the game so it creates the folders, then navigate somewhere obscure to install the songs..
Don't check my github! It contains thousands of lines of spaghetti code in many different languages cool software! :neko:
https://github.com/Sulunia
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: [WIP]BeatFever Mania ~ osu! Engine reimplementation

Post by Davidobot »

Sulunia wrote: So, people would have to place the ".osz" beatmaps right into the love save folder first? That sounds more complicated than the actual installation instructions, doesn't it? :huh:
The person would have to first launch the game so it creates the folders, then navigate somewhere obscure to install the songs..
You can simplify the process by calling

Code: Select all

love.system.openURL("file://"..love.filesystem.getSaveDirectory())
After the program runs once. That opens up the save directory automatically for the user to put stuff into.
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
Sulunia
Party member
Posts: 203
Joined: Tue Mar 22, 2016 1:10 pm
Location: SRS, Brazil

Re: [WIP]BeatFever Mania ~ osu! Engine reimplementation

Post by Sulunia »

Now that makes it a bit more interesting. But I'd also have to create a button in the selection screen UI to open the install folder for the user anytime he wanted aswell (and not only when no songs are installed), but given the fact the selection screen code is messed up, i'll try cleaning it up/simplifying the code and better plan it's UI before adding such thing.

I'll have a talk to the "designer" here, to see his opinion and work on improving the UI, then i'll do exactly what you said. Many thanks!
Don't check my github! It contains thousands of lines of spaghetti code in many different languages cool software! :neko:
https://github.com/Sulunia
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: [WIP]BeatFever Mania ~ osu! Engine reimplementation

Post by Davidobot »

Sulunia wrote:Many thanks!
It's my pleasure. I look forward to being of help in the future. I recently got back into OSU! after a two year hiatus and can't wait to see this project grow. Maybe I'll put my 4 years of LÖVE-ing to use finally by helping someone. :o:
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: [WIP]BeatFever Mania ~ osu! Engine reimplementation

Post by Nixola »

Sulunia, thanks to a guy on IRC you might be able to mount .zip files that are dropped on LÖVE's window. I tested the code on Linux and it looks like it works! You could use liblove.PHYSFS_mount instead of lfs.mount in Davidobot's function to extract the files, I guess.

Code: Select all

local ffi = require('ffi')
ffi.cdef('int PHYSFS_mount(const char *newDir, const char *mountPoint, int appendToPath);')
local liblove = ffi.os == 'Windows' and ffi.load('love') or ffi.C

function love.filedropped(file)
  local path = file:getFilename()
  liblove.PHYSFS_mount(path, 'mountpoint', false)
end
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
Sulunia
Party member
Posts: 203
Joined: Tue Mar 22, 2016 1:10 pm
Location: SRS, Brazil

Re: [WIP]BeatFever Mania ~ osu! Engine reimplementation

Post by Sulunia »

Nixola wrote:Sulunia, thanks to a guy on IRC you might be able to mount .zip files that are dropped on LÖVE's window. I tested the code on Linux and it looks like it works! You could use liblove.PHYSFS_mount instead of lfs.mount in Davidobot's function to extract the files, I guess.

Code: Select all

local ffi = require('ffi')
ffi.cdef('int PHYSFS_mount(const char *newDir, const char *mountPoint, int appendToPath);')
local liblove = ffi.os == 'Windows' and ffi.load('love') or ffi.C

function love.filedropped(file)
  local path = file:getFilename()
  liblove.PHYSFS_mount(path, 'mountpoint', false)
end
:awesome: Thats even better than what was originally planned!
I'll test this out here. Since i'm still waiting on UI feedback, i'm coding a bit more of the game logic instead.
What's the guy name anyways? So i can give proper credits in the implementation

To implement that, i will also need to check if the file already was installed and such, so there'll be a bit more of code. If it works though, i don't think it could be possibly any more user friendly than THAT. Huge thanks!
Does love even have a IRC? Where? :o:
Also, if you keep your mouse hovered on top of the emoji there, it says "Im so happy i could shit a rainbow right now". 10/10 would shit rainbows again
Last edited by Sulunia on Thu Mar 31, 2016 7:34 pm, edited 2 times in total.
Don't check my github! It contains thousands of lines of spaghetti code in many different languages cool software! :neko:
https://github.com/Sulunia
Post Reply

Who is online

Users browsing this forum: No registered users and 166 guests