The Daily Click ::. Forums ::. Klik Coding Help ::. Lacewing Lag Issue
 

Post Reply  Post Oekaki 
 

Posted By Message

DS Strider

ZOMGFACE11

Registered
  18/03/2007
Points
  337
19th November, 2009 at 21:38:56 -

Hello, I just started using the Lacewing extension in MMF2 to enable online support in the projects I'm working on. However, there seems to be considerable lag between players, not to mention frequent sprite jumping. Is there an article aside from Flava's that I can use to shorten the lag between two players? (Note: I am not sending packet data every frame, but rather when a player presses/releases a button, as per Flava's guide.)

I have included an example file here:

http://www.9bit-productions.com/test.rar

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  50152

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
19th November, 2009 at 23:41:44 -

There will always be lag. This isn't an issue that is confined to lacewing, but in fact every game has lag time between packets being received.

Now personally I wouldn't suggest using Flava's method of online sending. Instead check for a change in the x or y position of the player before sending the data. Trust me you'll be glad you did later.

Next you'll need to develop a dead-reckoning system. I short this basically means calculate where all the players would be based on their last position, direction, and velocity. Also you'll need to send the real x and y with this information too just in case there is a calculation error.

However if the exact position of each player isn't dreadfully important you could always just do linear interpolation between each peers last position and the new received position.

Yup, that's pretty much it. I'm sure someone else who knows more than me can fill in the gaps if you're confused.

 
n/a

DS Strider

ZOMGFACE11

Registered
  18/03/2007
Points
  337
19th November, 2009 at 23:50:10 -

Got any links to an example of dead reckoning?

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  50152

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
20th November, 2009 at 00:32:29 -

No unfortunately not.

I've implemented it into the game I'm currently working on, but the engine changes on a game to game basis.

Like if you have a platformer you have to send all the physics information (gravity, walk speed, ect) and then apply those physics properties to all the peers to maintain their correct position. It was a pain to setup really.

If you are doing a top down game it's a bit easier. You could just use beizer-curves to calculate the intermediate positions.

And the easiest method is to just simply interpolate between the old and new positions.

Like this:

-Set Peer X position to
X("Peer")+(ReceivedX("Peer")-X("Peer"))*0.3+max(min((ReceivedX("Peer")-X("Peer")),1),-1)

-Set Peer Y position to
Y("Peer")+(ReceivedY("Peer")-Y("Peer"))*0.3+max(min((ReceivedY("Peer")-Y("Peer")),1),-1)

 
n/a

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
20th November, 2009 at 01:50:54 -

Also, is that IP you are using for a public server? I couldn't find the address anywhere on the public server listings, but if it is then that will surely be the biggest cause of lag above anything else - dependent on your location.

I'm in Australia so if the server is in America then the messages travel like this:

Client 1 (AUS) > Server (USA) > Client 2 (AUS)

with a round trip time of something like 600ms. Very laggy.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  50152

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
20th November, 2009 at 06:11:05 -

I posted this on another thread, but it should work for you too:

http://www.jsoftgames.com/LacewindGUIChat.zip

 
n/a

DS Strider

ZOMGFACE11

Registered
  18/03/2007
Points
  337
20th November, 2009 at 13:19:02 -

The IP address is to a server hosted on another PC in my home. I doubt it would be the final game server once I'm done. Right now it's just for testing.

 
n/a

Rob Westbrook



Registered
  25/05/2007
Points
  193

360 OwnerVIP Member
23rd November, 2009 at 20:09:47 -

UrbanMonk, that example you posted has been a great help to me as well x)

I'm liking the massive influx of Lacewing queries that have sprung up in the last few days.

 
There are 10 types of people in the world: Those who understand binary and those who don't.
   

Post Reply



 



Advertisement

Worth A Click