The Daily Click ::. Forums ::. Klik Coding Help ::. DirectPlay
 

Post Reply  Post Oekaki 
 

Posted By Message

BBalazs



Registered
  10/07/2004
Points
  41
17th October, 2004 at 11:43:37 -

Hi all! I'm trying to make a game that works on LAN - and it uses the DirectPlay object. I use DirectPlay because it does not need Internet and I can test it.

This will be a platformer for 2 players max - I got to the part when they connect to each other. At the moment the connection is made the first level is fired. Movements are correct for both players (though the OTHER player (the one received by the computer) has a bit of a fizzing on the Y axis (I mean it goes up/down 1 pixel fast) and there is no lag. Than I wanted to insert shots.
They work fine too, but are laggy, even though they don't affect movement. Sometimes the lag is awful large, taking seconds! How can you reduce this lag (for TCP/IP connection)?

Here's what I tried (I leave out the stuff needed for the standard platform engine):


Is message waiting? -- Produce a message

GROUP SEND MOVEMENT
Always -- Send X, Y, Dir, Speed, Anim# from Player 1

Always
On Receive X, Y, Dir, Speed, Anim# -- /apply values to player 2 object, everything normally except at Y values which are received Y - 13; otherwise the position is incorrect/

GROUP SEND MOVEMENT OVER

Player 1 is facing direction (right)
Upon pressing Space Bar -- Deactivate Group SEND MOVEMENT ; (player 1)Shoot bullet at (right), speed 100 ; Send Single Value 1 ; Activate Group SEND MOVEMENT

Player 1 is facing direction (left)
Upon pressing Space Bar -- Deactivate Group SEND MOVEMENT ; (player 1)Shoot bullet at (left), speed 100 ; Send Single Value 2 ; Activate Group SEND MOVEMENT

Received Single Value 1 -- (player 2) Shoot bullet at (right), speed 100

Received Single Value 2 -- (player 2) Shoot bullet at (left), speed 100


That's all - please help!!!




 
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
18th October, 2004 at 05:25:03 -

There shouldn't be too much lag even if your coding isn't too snappy. But try removing the 'always' from

Always
On Receive X, Y, Dir, Speed, Anim# -- /apply values to player 2 object, everything normally except at Y values which are received Y - 13; otherwise the position is incorrect.

If you are still lagging bad check your router connections. If there is still lag then you will probabley need to code some sort of dead reckoning system.

 
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
   

Post Reply



 



Advertisement

Worth A Click