Handle players in online games.

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Dark_Kilauea
Posts: 368
Joined: Tue Aug 21, 2007 1:43 am
Location: The Middle of Nowhere

Post by Dark_Kilauea »

RakNet is uniquely optimized for networking for games, that's it's major design principal. It has a simple and rather efficient compression algorithm that you can apply to your data, optimizing the bandwidth usage of your application. It comes with a lot of useful plugins (although I like doing things myself personally) and provides useful debugging tools to help you detect problems with data transmission. Add to that it's heavy cryptography support and it makes a pretty good package for games, especially if you want to stop man in the middle attacks and packet spoofing.

Also, like others have mentioned, you only have to pay after you are finished developing and decide to sell it for profit. The free license is not viral in any way, so you can feel free to statically link to the library (or include the source directly and modify as needed).
rogerborg wrote:Every time someone learns to use a debugger, an angel gets their wings.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

xsocom wrote:Well Im doing an orpg so I prefer TCP
xsocom wrote:Also read this:

http://www.gamedev.net/features/reviews ... ductid=220
The Fine Article wrote: Posted: May 11, 2003
No further comment.

xsocom wrote:So an fast and easy question, will this be a good choice for a Online RPG Game?
Absolutely yes.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
xsocom
Posts: 80
Joined: Thu Sep 13, 2007 8:34 am

Post by xsocom »

Thanks rogerborg, thats all I needed to know.

Cheers
xsocom
Posts: 80
Joined: Thu Sep 13, 2007 8:34 am

Post by xsocom »

rogerborg wrote:
xsocom wrote:Well Im doing an orpg so I prefer TCP
xsocom wrote:Also read this:

http://www.gamedev.net/features/reviews ... ductid=220
The Fine Article wrote: Posted: May 11, 2003
No further comment.

xsocom wrote:So an fast and easy question, will this be a good choice for a Online RPG Game?
Absolutely yes.
After a while now I have been using this raknet and start to get problems with packet losts etc, and you said "Absolutely yes" about my question about if its a good choice to have in an online game? Well its not good to have packet losts in dmg packets and animation changes etc.

I send packets like this.

Code: Select all

bool Server::BroadcastInRange( RakNet::BitStream &OutPacket, CUnit *pUnit )
{
	if( !pUnit )
		return false;

	UnitMap::iterator itr;
	for( itr = mUnits.begin( ); itr != mUnits.end( ); ++ itr )
	{
		if( !itr->second )
			 continue;

		if( itr->second->getDistanceSq(pUnit) <= (UPDATE_DISTANCE*UPDATE_DISTANCE)  )
		{
			pServer->Send(&OutPacket, SYSTEM_PRIORITY, RELIABLE_ORDERED, 0, itr->second->pClient->pSystemAddr, false);
		}
	}
	return true;
}
Is this a bad way sending packets? I used HIGH_PRIORITY and now SYSTEM_PRIORITY but still packet losts.

Any idea?

Thanks.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

What do you mean by "packet loss"? If you're specifying RELIABLE_ORDERED, which you are, Raknet will only fail to deliver packets if there's a total failure of the connection.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
xsocom
Posts: 80
Joined: Thu Sep 13, 2007 8:34 am

Post by xsocom »

How can I explain, "PacketLoss" I mean when someone "hit" an ohter player sometimes the "dmg message" will not appear( not reach the client ), also sometimes the chat messages does not appear, not so often but it happens. It never happens when I used sdl net for a year ago.

Thanks
Daniel FF
Posts: 53
Joined: Tue Feb 19, 2008 7:15 pm

Post by Daniel FF »

If you are sending more then 1 packet per tick raknet will combine packts and you will need handle that or just call sleep(1) after send a packet, that work for me.
Dark_Kilauea
Posts: 368
Joined: Tue Aug 21, 2007 1:43 am
Location: The Middle of Nowhere

Post by Dark_Kilauea »

I don't know what you're doing wrong with raknet, but I've never experienced packet loss from using reliably order.

PLUS YOU SHOULD NEVER NEVER EVER EVER EVER EVER USE SYSTEM PRIORITY. EVER.

Are you running a proper receive loop on the other end to pick up the packet? Are you sending a packet every single frame of you game? Doing this is a great way to clog up the bandwidth and increase latency from having the client fall behind on new packets. I make use of dead reckoning on my servers and clients to both reduce sending of redundant data and adjust my world simulation to account for lag. An update only really needs to go out if there is a big change in the object.
rogerborg wrote:Every time someone learns to use a debugger, an angel gets their wings.
xsocom
Posts: 80
Joined: Thu Sep 13, 2007 8:34 am

Post by xsocom »

I use proper receive loop on the other end to pick up the packets yes, and Im notsending a packet every single frame.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

So, either you've found a bug in Raknet's core functionality that nobody else experiences, or...

Image
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Mirror
Posts: 218
Joined: Sat Dec 01, 2007 4:09 pm

Post by Mirror »

rogerborg wrote:
xsocom wrote:Well Im doing an orpg so I prefer TCP
i totally disagree with rogerborg and the reference to gamaustra x-wing coder guy.

1. for starters that article was written in 1999, when most people had still dial-up connections and the internet reliability ( ISP/routers etc ) wasn't so great. conditions, 9 years after that are ALOT better.

2.) UDP sucks. it's faster but unreliable and can be spoofed easily as it is connection-less.

3.) I know at least one very successful commercial game ( lineage2 ) which works using TCP ( and the same goes i guess for the rest of ncsoft games ). the same goes for WOW : ituses tcp. fast google search : http://us.blizzard.com/support/article. ... ue?rhtml=y look at the end of the page.

Thus i don't see why one should use udp instead of tcp, the only barrier is that tcp is more 'difficult' but provides so much features that udp doesn't and you would eventually need to implement if you woulnd't like for cheats like those in counterstrike to appear..
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

rogerborg wrote:So, either you've found a bug in Raknet's core functionality that nobody else experiences, or...

Image
I guess its PEBKAC....bc u have to call receivePacket in one tick so long until it returns zero.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Mirror wrote:i totally disagree with rogerborg and the reference to gamaustra x-wing coder guy.
I fully respect your right to be wrong. :P

Mirror wrote:1. for starters that article was written in 1999, when most people had still dial-up connections and the internet reliability ( ISP/routers etc ) wasn't so great. conditions, 9 years after that are ALOT better.
Reliability is up? Well, I'm glad you've started out by making an argument in favour of using UDP.

Mirror wrote:2.) UDP sucks. it's faster but unreliable and can be spoofed easily as it is connection-less.
TCP sucks. It's inherently slower, since most routers prioritise UDP traffic. TCP/IP has (at least) 40 bytes of overhead per payload packet, compared to 28 for UDP/IP. TCP can be spoofed easily with a man-in-the-middle attack.

Mirror wrote:3.) I know at least one very successful commercial game ( lineage2 ) which works using TCP ( and the same goes i guess for the rest of ncsoft games ). the same goes for WOW
Oh, sure, TCP is fine for MUDS, or whatever those crazy kids are calling their PBEM games these days.

The main benefit that I can see to TCP is that it's bidirectional, so there's no need to open any incoming sockets. This is significant, but it's a very different argument to efficiency, ease of (developer) use, or security.

Mirror wrote:Thus i don't see why one should use udp
Maybe one isn't writing a MUD and one would like to use a protocol designed for real time communication to perform real time communication? Perhaps one doesn't need all of one's communication to be reliable, and would prefer to avoid the inherent overhead of TCP and the unavoidable overhead of invisible resends?

Mirror wrote:the only barrier is that tcp is more 'difficult'
TCP is far easier, since it deals with sequencing and reliability internally. That's why libraries like Raknet and more specifically Enet exist, to implement reliable UDP that's as simple to use as TCP.

Mirror wrote:you would eventually need to implement [TCP] you woulnd't like for cheats like those in counterstrike to appear..
Counterstrike? Y'all from the future? Time from an anecdote, from the Early Olden Days.

'Roger' was my original Netrek handle from the early 1990s. I changed it to 'Rogerborg' when I wrote a (cy)borg client that successfully hacked its way into the server, using (can you guess?) a man-in-the-middle attack on the TCP communication between client and server.

I wouldn't call it trivial, but it's not far off.

Any argument that a TCP communication can be authenticated, well... I'm in the middle. The slave client is going to authenticate it for me. The communication has to be encrypted to be secure from a MitM TCP attack, and if it is, then that makes it equally secure from UDP spoofing, doesn't it?

Your turn. ;)
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
aanderse
Posts: 155
Joined: Sun Aug 10, 2008 2:02 pm
Location: Canada

Post by aanderse »

Image

LOL
xsocom
Posts: 80
Joined: Thu Sep 13, 2007 8:34 am

Post by xsocom »

rogerborg wrote:So, either you've found a bug in Raknet's core functionality that nobody else experiences, or...
Well I dont know then, All I say is that sometimes a packet does not arrive. I tryed the sdl net tcp connection and all packet arrived, but I wanted to try the raknet.
Post Reply