LOVE & Hadoukens? Q's on Timing, Netplay, Rollback

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
pk
Citizen
Posts: 67
Joined: Wed Dec 14, 2011 2:13 am
Location: Texas, United States
Contact:

LOVE & Hadoukens? Q's on Timing, Netplay, Rollback

Post by pk »

I'm interested in using LOVE as a framework for a fighting game, in the same ilk as Mugen or FM2K. I have a few technical questions first:

Timing: Is LOVE's internal timer and/or loop event accurate enough?

Fighting games need to maintain a steady 60 FPS. Timings for inputs and internal calculations might need to run at an even higher rate. Is there a relatively accurate timer and/or event loop that can reliably buffer inputs and spit out a rendered screen 1/60th of a second?

Netplay: Can the included luasocket module implement delay-based netplay with rollback?

For those not familiar, I mean the kind of design seen in GGPO and detailed by mauve here.

Note: I'm not asking if there's a built-in Throttling API and a Netplay API. I know there aren't. I just want some people's thoughts on the possibility and plausibility of implementing a fighter.

Also, how difficult do you think implementing these things would be? Timing doesn't seem too difficult, but netplay could be a real beast, regardless of language. I have a feeling I'd have to commission a programmer to make this fighter and I'm worried he might be better off just writing the whole game himself if LOVE is lacking in these areas.

On the otherhand, if LOVE can host a quality fighter framework.......
ALL CREATURE WILL DIE AND ALL THE THINGS WILL BE BROKEN. THAT'S THE LAW OF SAMURAI.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: LOVE & Hadoukens? Q's on Timing, Netplay, Rollback

Post by kikito »

pk wrote:Timing: Is LOVE's internal timer and/or loop event accurate enough?
Yes. On any machine bought in the last 5 years you get much more than 60 FPS on a regular game. You will probably hit graphic driver problems much earlier than hitting time limit (provided that your game doesn't do too much expensive operations on every frame, like creating a new font)
pk wrote:Netplay: Can the included luasocket module implement delay-based netplay with rollback?
I guess you could implement that on top of luasocket, but it is not something that it does by default.
pk wrote:Also, how difficult do you think implementing these things would be? Timing doesn't seem too difficult, but netplay could be a real beast, regardless of language.
The timing part would not be a big problem. Chances are that you will not have to do anything special. If you want the FPS to stay at 60 FPS, and no higher, you might have to reimplement the game loop. This should take 1 or 2 evenings.

Net code is always difficult. Estimate 1 man-month of work just to get it right.
Last edited by kikito on Wed Sep 26, 2012 9:16 am, edited 1 time in total.
When I write def I mean function.
User avatar
qaisjp
Party member
Posts: 490
Joined: Tue Sep 04, 2012 10:49 am
Location: United Kingdom
Contact:

Re: LOVE & Hadoukens? Q's on Timing, Netplay, Rollback

Post by qaisjp »

(very) interesting link, Love will do fine for the job but syncing is the real deal.
Lua is not an acronym.
User avatar
Boolsheet
Inner party member
Posts: 780
Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland

Re: LOVE & Hadoukens? Q's on Timing, Netplay, Rollback

Post by Boolsheet »

If it comes to synchronization and determinism you also have to consider that LÖVE and Lua use floating-point numbers extensively.

The official x86 LÖVE builds for Windows and Linux use x87 and the x86-64 builds use SSE2. OS X may only use SSE2 because they can. With their default settings, x87 and SSE2 can produce slightly different results because x87 has a higher precision for intermediate results. The differences should be rather small, but they build up if you keep calculating against the numbers. This matters if your design expects the calculations to be completely determenistic across all systems.
Shallow indentations.
User avatar
pk
Citizen
Posts: 67
Joined: Wed Dec 14, 2011 2:13 am
Location: Texas, United States
Contact:

Re: LOVE & Hadoukens? Q's on Timing, Netplay, Rollback

Post by pk »

kikito wrote:Net code is always difficult. Estimate 1 man-month of work just to get it right.
That estimate sound about right. I think I'm going to have to shell out some $$$ to a freelance coder to get a quality implementation. (I'm a freelance illustrator, so I have no objection in doing so.) If/when I do get the funds, I'd like to have the code released as an open source library.
qaisjp wrote:(very) interesting link, Love will do fine for the job but syncing is the real deal.
Syncing does seem quite hairy. Mauve talks about using the character x position and HP values to sync in his caster program. Designing this game from the ground up and having complete control over the data formats, it should be possible to sync between players reliably and accurately (?).
Boolsheet wrote:The official x86 LÖVE builds for Windows and Linux use x87 and the x86-64 builds use SSE2.
Thanks for pointing this out. I'm somewhat familiar with the vagaries of floating-point calculations. I'm not against using custom builds if it comes down to it. Although I'd much rather use vanilla LOVE builds if at all possible.
ALL CREATURE WILL DIE AND ALL THE THINGS WILL BE BROKEN. THAT'S THE LAW OF SAMURAI.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Semrush [Bot] and 4 guests