Using code from Love2D?

I stumbled across this repo on GitHub GitHub - rcmagic/DemoFighterWithNetcode: An example fighting game demonstrating how to implement rollback based netcode. and it’s a very simple fighting game with netcode and I noticed that it was a Love2D project which is another game engine that uses Lua although I know Robloxs Lua and Love2Ds Lua is different, but it’s still the same language with the same syntax and stuff so yeah this was a huge find and I wanted to know if it was possible to convert all of this into Roblox or would it be a waste of time?

The only thing I’m not sure about is because Love2D is like a proper game engine where you have control over making players and servers (I think?) there’s code for that stuff and well Roblox obviously already does this for you so I’m not sure if any of this can even be used in roblox

You should check the code for the game and see if it uses the same as roblox lua. Or is something similar.

Yes, for the match state which is the bulk of the roll back fighting code it seems doable. By tracking positions and such.

The biggest issue is networking as you have said.

--main.lua
-- Checks whether or not a game state desync has occurred between the local and remote clients.
function Game:SyncCheck()

	if not NET_DETECT_DESYNCS then 
		return
	end

	if Network.lastSyncedTick < 0 then
		return
	end

	-- Check desyncs at a fixed rate.
	if (Network.lastSyncedTick % Network.desyncCheckRate) ~= 0 then
		return
	end

	-- Generate the data we'll send to the other player for testing that their game state is in sync.
	Network:SetLocalSyncData(Network.lastSyncedTick, Game:GetSyncData())
			
	-- Send sync data everytime we've applied from the remote player to a game frame.
	Network:SendSyncData()

Rollbacks will heavily rely on the Network libary with the functions inside.

This network libary also requires the socket libary for networking. Looking further I believe you can find a way to sync the Game.tick, so maybe it’s possible? I would need to spend a lot more hours staring at the network module however.

Also additional features like roblox automatic physics replication will make it a pain to control the physics happening. I would also be highly aware of that.

1 Like

Well like I said Love2D and Roblox both use Lua so the code will or should mostly work because it’s the same language I’m probably gonna have to adjust some things and that’s the issue I’m not sure if the things I have to adjust will make make it all useless.

Do you happen to know how I would organize this in Roblox? If I were to try and bring the match state code into studio for example would it be a client thing or server thing? :thinking: