2d Game online

Questions regarding game mechanics and graphic programming should go here.

Moderators: Darobat, RecursiveS, Dante Shamest, Bugdude, Wizard

2d Game online

Postby Andy2005 » Thu Apr 28, 2005 6:32 pm

i want to make an online game
well to learn network game programming
is this what an online game design looks like ?
Image
Step 1) Look at This
Step 2) Get True Combat
User avatar
Andy2005
 
Posts: 1057
Joined: Wed Sep 24, 2003 3:26 pm
Location: NewYork

Postby t i l e x » Thu Apr 28, 2005 8:52 pm

Basically you'd just want to send the server the least data possible. I'd send only player coordonates and useful informations like health and such but make sure to send it only if it changed.
Code: Select all
if(healthChanged)
{
    // send information on the character's health
}
if(xChanged || yChanged)
{
    // send coordonates
}
That way you will minimize lag and low latency issues.
User avatar
t i l e x
 
Posts: 3604
Joined: Wed Dec 03, 2003 3:59 pm
Location: Québec (Canada)

Postby Corsix » Sat Apr 30, 2005 5:18 am

Learn to spell; it's client not clinet.
Code: Select all
#include <stdio.h>
char*_="XxTIHRCXCxTIHRXRCxTIHXHRCxTIXIHRCxTXTIHRCxXxTIHRCX";
int main(int l){for(l+=7;l!=putchar(010);++l);if(*(++_))main
(*_!=88?(putchar(*_^073)|putchar(33))&1:0xffff2a8b);}
User avatar
Corsix
 
Posts: 1181
Joined: Fri Jul 23, 2004 9:33 am
Location: Berkeley, UK

Postby Darobat » Sat Apr 30, 2005 7:07 am

To minimize lag, don't send coordinates of the player each frame, but rather every 10 frames lets say. Then to get rid of the choppyness of not updating it that often you can make a function that takes the current location and goal, and infers their location for the 9 frames where they aren't getting info. It's how much major MMO's do it.
Code: Select all
#include <stdio.h>
struct W{char m,M[4??),w;void x(char
*W)??<w^=w;while(w[W]!=0)putchar(W[w
]^M[w++%5??));}W():m(040),w(0){char*
X="d@PLfAU\x05P)sHEMoTTPF""\31";for(
;w<5;w++[M??)=m++);x(X);}}w;main(){}
User avatar
Darobat
Moderator
 
Posts: 2572
Joined: Sat Sep 27, 2003 1:19 pm

Postby Emery » Sun May 01, 2005 12:48 am

Most work with a series of messages and parameters for that message. For me, the client just sends a move message every time you acctually move. And then that message is braudcasted to everyone that can see that player.

So, the CMSG_MOVE (cmsg = client message, smsg = server message) takes the x and y coordinate to move to parameters. So you receive 4 bytes for the message and than put it through a switch statement to know how much to receive for the parameters. The switch case CMSG_MOVE goes through and you know to receive the x and y coordinates.

At least thats what I do...
--~~~~
User avatar
Emery
 
Posts: 4313
Joined: Sat Mar 19, 2005 9:16 am


Return to Games and Graphics

Who is online

Users browsing this forum: No registered users and 1 guest