Handle players in online games.
Handle players in online games.
Hello, I have some questions about how to handle clients / players in an online game, Will try to tell me briefly about how I have done it right now.
What I have is an array that can store clients, when a new client connects, it adds to the arrays as usual, then when a player login it check so login is valid and binds the loginID from the userdata base to the client that has the same socket.
Then, when you want to manage clients, such as a movement.
Then when a client sends "I want to move" it check the socket which sent the package and look for it in the array and retunerar userPID, if it find that ID then the server knows that it will send to this socket, is this is a good way to handle Players? server side, or do you have any better suggestions?
Thank you very much
What I have is an array that can store clients, when a new client connects, it adds to the arrays as usual, then when a player login it check so login is valid and binds the loginID from the userdata base to the client that has the same socket.
Then, when you want to manage clients, such as a movement.
Then when a client sends "I want to move" it check the socket which sent the package and look for it in the array and retunerar userPID, if it find that ID then the server knows that it will send to this socket, is this is a good way to handle Players? server side, or do you have any better suggestions?
Thank you very much
I also have another question about how the best way is to deal with "Enter World" and when other players that join the world.
Right now, my concept is like this, when a "new player" has logged in send a "list" of all the characters in the database that have the same PID as login PID, then list them on the client, then the player select one of them and then send the selected user_id to the server, then check the server for this PID match any of characters. if it does then send the info about this character and switch to the "InGame" and add it to the client InViewList, then when a new player connects and login it will be added to his InRangeList if the new current players is inrange of me. Is this a good way to deal with players in the game world itself? To avoid to update the players outside InViewListen etc, also they get deleted when they get outside of the range.
Hope you understand what I mean
Thank you!
Right now, my concept is like this, when a "new player" has logged in send a "list" of all the characters in the database that have the same PID as login PID, then list them on the client, then the player select one of them and then send the selected user_id to the server, then check the server for this PID match any of characters. if it does then send the info about this character and switch to the "InGame" and add it to the client InViewList, then when a new player connects and login it will be added to his InRangeList if the new current players is inrange of me. Is this a good way to deal with players in the game world itself? To avoid to update the players outside InViewListen etc, also they get deleted when they get outside of the range.
Hope you understand what I mean
Thank you!
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Re: Handle players in online games.
[Moved to Game Programming as it's not Irrlicht related]
Just be careful what you mean by a "socket".
TCP sockets are connection oriented, but a single UDP socket on your server will generally receive packets from all clients. In this case, you want to use the source address in the recvfrom() to identify the client. Unfortunately, source addresses can be spoofed, so it's not 100% reliable.
A decent network library like Raknet will abstract this for you. I'd recommend going with that rather than writing your own socket handling code.
I can't really (with my Lunchtime Brain) follow your question about the "enter world" condition. I'd suggest that you arrange it as a flowchart or similar diagram.
Yes, that's fine. You have to map the network address to a player. Whether you do it with an actual map, or a list, array or whatever is entirely up to you.xsocom wrote:Then when a client sends "I want to move" it check the socket which sent the package and look for it in the array and retunerar userPID, if it find that ID then the server knows that it will send to this socket, is this is a good way to handle Players?
Just be careful what you mean by a "socket".
TCP sockets are connection oriented, but a single UDP socket on your server will generally receive packets from all clients. In this case, you want to use the source address in the recvfrom() to identify the client. Unfortunately, source addresses can be spoofed, so it's not 100% reliable.
A decent network library like Raknet will abstract this for you. I'd recommend going with that rather than writing your own socket handling code.
I can't really (with my Lunchtime Brain) follow your question about the "enter world" condition. I'd suggest that you arrange it as a flowchart or similar diagram.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Enet and TCP sockets?
The Enet FAQ wrote:Isn't ENet just re-inventing TCP?! What's the point?
In a perfect world, that would be true. But as many have found, using TCP either in lieu of or in conjunction with UDP can lead to all kinds of nightmares. TCP is a good, solid protocol, however it simply isn't up to the task of real-time games. Too much of TCP's implementation dictates a policy that isn't practical for games. If you want to use TCP, then do so -- this library is for people that either don't want to use TCP or have tried and ended up being discouraged with the performance.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Go read the license, mate. It only costs if you make a commercial game with it AND the creator of the lib. supports in all way and forms just building the app. first THEN paying for it if you like it. Furthermore, if I remember correctly, it's 100$ and up (for support or things like that, I think), so if you aim for a commercial game but think a networking lib. of 100$ is too much, you're way out of league. If not, go for it, use it, enjoy.
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Enet and Raknet both use UDP only.
Enet is a decent library; I've used it myself. Raknet is more fully featured though, and comes with a lot of examples.
Raknet is free to use for non-commercial projects.
If you go on to make a commercial release, then and only then are you asked to contribute to Raknet's authors.
I think that "Choose what to pay based on what you can afford by the value RakNet has brought to your development." is about the fairest pricing that I've ever seen. The minimum commercial license price is $100. Since that's about one hour of a contractor's time, it's astonishing value for money, and remember: you're only asked to pay if its helped you to succeed.
Enet is a decent library; I've used it myself. Raknet is more fully featured though, and comes with a lot of examples.
Raknet is free to use for non-commercial projects.
If you go on to make a commercial release, then and only then are you asked to contribute to Raknet's authors.
I think that "Choose what to pay based on what you can afford by the value RakNet has brought to your development." is about the fairest pricing that I've ever seen. The minimum commercial license price is $100. Since that's about one hour of a contractor's time, it's astonishing value for money, and remember: you're only asked to pay if its helped you to succeed.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Thanks all for your replys.
Well Im doing an orpg so I prefer TCP, So any idea on what sort of network libary I can use for that if enet and raknet both use only UDP.
Also read this:
http://www.gamedev.net/features/reviews ... ductid=220
Freeware License (free) - 31 client connections, Unlimited freeware distribution.
Shareware License ($99) - Unlimited connections, commercial distribution (electronic only)
Commercial License ($1995) - Unlimited connections, unlimited distribution, full source code
though. Namely, your data isn't guaranteed to get there, and if it does get there, your chunks of data are not guaranteed to be in the same order that they were sent. Thankfully, RakNet takes care of those problems at a deeper level than you're going to be working at, so you can just forget the disadvantages and enjoy sending chunks of data around at your leisure.
So this mean's its limited to 31 connections? and UDP based so some packets maybe get lost? or does it fix that and resend the packet that dident got recved by client?
And Im not doing an commercial game, Just for learning.
So an fast and easy question, will this be a good choice for a Online RPG Game?
Thanks.
Well Im doing an orpg so I prefer TCP, So any idea on what sort of network libary I can use for that if enet and raknet both use only UDP.
Also read this:
http://www.gamedev.net/features/reviews ... ductid=220
Freeware License (free) - 31 client connections, Unlimited freeware distribution.
Shareware License ($99) - Unlimited connections, commercial distribution (electronic only)
Commercial License ($1995) - Unlimited connections, unlimited distribution, full source code
though. Namely, your data isn't guaranteed to get there, and if it does get there, your chunks of data are not guaranteed to be in the same order that they were sent. Thankfully, RakNet takes care of those problems at a deeper level than you're going to be working at, so you can just forget the disadvantages and enjoy sending chunks of data around at your leisure.
So this mean's its limited to 31 connections? and UDP based so some packets maybe get lost? or does it fix that and resend the packet that dident got recved by client?
And Im not doing an commercial game, Just for learning.
So an fast and easy question, will this be a good choice for a Online RPG Game?
Thanks.
I have working ReplicaManager here.
It works and I'm happy with it. I really don't care about penis size at the moment because we're both studying it. Don't get too excited about specs and stats, because the reason is simple: You. Me. Are. n00bs.
If you keep shuffling here to there and back, that will not get you anywhere.
Just a suggestion, get your feet wet on Raknet first.
It works and I'm happy with it. I really don't care about penis size at the moment because we're both studying it. Don't get too excited about specs and stats, because the reason is simple: You. Me. Are. n00bs.
If you keep shuffling here to there and back, that will not get you anywhere.
Just a suggestion, get your feet wet on Raknet first.