Send the love.physics world to players (multiplayer game)

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Quôzul
Prole
Posts: 15
Joined: Mon Apr 16, 2018 5:03 pm
Location: France
Contact:

Send the love.physics world to players (multiplayer game)

Post by Quôzul »

Hello,

I'm currently making a multiplayer game with Sock.lua, the world is created by the server using the love's integrated physics engine and Windfield, I would like to send the world to the players. What's the best way to do it ?

I've tried with Hero but I can't serialize the output...

Thanks :awesome:

EDIT

I forgot to mention that levels are randomly generated by the server.

Excuse me if my english is bad
Attachments
hero_test.love
(34.82 KiB) Downloaded 73 times
Last edited by Quôzul on Fri Jul 06, 2018 7:32 am, edited 1 time in total.
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Send the love.physics world to players (multiplayer game)

Post by ivan »

The easiest option if your levels are not user generated is to just send the level name and build version.
Each of the clients could have a copy of the levels to begin with.
Box2D serialization is a good starting point.
After that point you would only need to send the changes/input.
Determinism (no "pairs" in the game logic) and fixed update steps will probably be necessary too.
It's hard to make something like this work seamlessly, but it's certainly possible.
User avatar
Quôzul
Prole
Posts: 15
Joined: Mon Apr 16, 2018 5:03 pm
Location: France
Contact:

Re: Send the love.physics world to players (multiplayer game)

Post by Quôzul »

ivan wrote: Thu Jul 05, 2018 5:49 pm The easiest option if your levels are not user generated is to just send the level name and build version.
Each of the clients could have a copy of the levels to begin with.
I don't really understand what you're meaning, levels won't be user generated, I forgot to specify that levels would be randomly generated by the server.
ivan wrote: Thu Jul 05, 2018 5:49 pm After that point you would only need to send the changes/input.
Determinism (no "pairs" in the game logic) and fixed update steps will probably be necessary too.
This part won't be very hard to make.
User avatar
zorg
Party member
Posts: 3441
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Send the love.physics world to players (multiplayer game)

Post by zorg »

Quôzul wrote: Fri Jul 06, 2018 7:31 am
ivan wrote: Thu Jul 05, 2018 5:49 pm The easiest option if your levels are not user generated is to just send the level name and build version.
Each of the clients could have a copy of the levels to begin with.
I don't really understand what you're meaning, levels won't be user generated, I forgot to specify that levels would be randomly generated by the server.
He means that instead of sending over the levels themselves, which would mean you probably needing to send over tons of data always, you could just send over which level you're actually playing on, at the start i mean;
That said, if they're randomly generated, then you could also just send over the seed value; assuming that you're using love.math.random and not math.random, you can assume that the same level will be generated from one specific seed value.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
Quôzul
Prole
Posts: 15
Joined: Mon Apr 16, 2018 5:03 pm
Location: France
Contact:

Re: Send the love.physics world to players (multiplayer game)

Post by Quôzul »

zorg wrote: Fri Jul 06, 2018 9:16 am That said, if they're randomly generated, then you could also just send over the seed value; assuming that you're using love.math.random and not math.random, you can assume that the same level will be generated from one specific seed value.
Good to know, I'll try sending a world with a seed :awesome:
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Send the love.physics world to players (multiplayer game)

Post by ivan »

I've tried with Hero but I can't serialize the output...
Bitser warns you right there why your "world" reference can't be serialized.
It's because "world.save" returns a table with functions.
This part won't be very hard to make.
I suppose it depends on the game.
Pretty hard to make/debug in my experience.
Post Reply

Who is online

Users browsing this forum: No registered users and 45 guests