Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Everything posted by honya15

  1. Hello! I couldn't find any good answer about this topic, so I decided to make a new discussion. How do one connect to a client-hosted game reliably? In co-op games, making a dedicated server looks like an overkill, but I need to reliably connect 2 peers together. My game is server-authoritative, not full P2P, but nowadays almost nobody knows how to port-forward, since AAA titles somehow do it manually. The question is, how? Like in Borderlands, I just click on "go online", and suddenly others see my game online, and can join without any problem.   I have a self hosted lobby service( working with database ), the matchmaking is covered, the problem starts when it comes to directly connecting to an IP address. I'm currently using RakNet for networking library, which I feel is a bit overkill, because I don't use any of it's high level features, only connecting-packet sending and receiving. I've tried RakNet's NAT punchthrough, but that's not reliable enough. Often it gives punchthrough failed, which customers don't understand and claiming it's the game's fault that they can't connect, because Diablo 3 works. I, as a developer, of course I know what's the difference, but what can I do to fight this problem?   Is there any middleware solution you know of? How do bigger titles handle it?( like torchlight, borderlands, and other coop games ) I'm even open for paid services, libraries, anything.   Thank you   Edit: I'm using C++, and a self programmed engine
  2. honya15

    Connecting clients

    Thanks for the answers :) Problem is, the bandwidth isn't low, and low ping is needed. For these reasons I don't really trust in forwarding services. It's a fast paced action RPG game, with many units moving around.   Aaand that's when "this game's netcode sucks", "they cant even make multiplayer", "netcode is horrible" reviews coming.. :(   So basically, there is no way to guarantee the connection, only if there are official dedicated servers. Thanks for the help, that clarified things for me.
  3. Hello guys! I have a task to make a fast paced ARPG work in cooperative mode, and with your help, it is working great, but I have another problem. In every action rpg( like diablo, torchlight ) it is possible for the players to go on different maps. #1 player( the server ) goes to the central HUB map, #2 player( client1 ) goes on map1, #3 player( client2 ) goes to map2 and #4 player( client3) goes to map1 with #2 player.   Since there are a lot of movement on one map( more than 100 entity can move simultaneously ), I think it's pretty impossible to make the server handle all the pathfinding, gamelogic, and AI on every map. How would you solve this problem?   My solution was a secondary "server", every time someone is entering a map, the server sends info to the client if there is another player on that server already. If not, then the client creates a "server"( let's call it realm ), and registers it to the server that it's available. If there is another player on that map, this client connets to their realm. This realm is just a logic layer, it isn't necessary to connect directly to this player to be able to play on the same map, the realm will send the message to the server, and then it will relay it to the client. However, it burdens the server a lot, so it tries to open a direct communication channel between the realm owner and the clients.   This solution is actually working, however, there are problems like bandwidth( e.g. the client has less bandwidth available than the server, so if the client enters the map first, then the game can lag to even the server ), sometimes it cant even connect( due to router problems, NAT punchthrough not always working ). Is there a better solution to this problem?   Thanks in advance, and sorry for the bad english
  4. honya15

    Handling multiple maps

    Grief is not really a problem, but yeah, it's so complex, and hard to code.. So I guess this remains in the older games, and in the new ones, I'll write a normal map handling.
  5. honya15

    Handling multiple maps

    All of the above what you've suggested is already done. And really I'm not here to discuss about pathfinding. That's a problem what I won't be able to fix.   So, you are saying that there is no other way to handle multiple maps, just if the host handles them all? This requires a lot of rewriting, because the game is now only handles one map. I mean there are animation based events too, scripts on the maps, etc. I don't think I will be able to pull it off in an already existing code, maybe in the next game...   Thanks for the answers, you've been a great help! :)
  6. honya15

    Handling multiple maps

    About the graphical content and design, that's not my job to decide what to put in, what to cut. My job is only to get it work with network, can't change the whole concept, has to get the best out of the content I have.   All I know about pathfinding that is has been optimalized like hell. Every entities has own timer to find path, there also a "smart pathfinding" and a "dumb" one. Only some of the entities can use smart( slow ) pathfinding for a time, others use a dumber, but faster, and when they found theirs, it gives the privilige to others. But really, I'm not the one who wrote the pathfinding, and I don't really have time to understand it fully, but I'm sure it's pretty much optimalized, just the obstacle net is really detailed, because there are small passages, and so ( I don't really know the reason, but I know that we were using a lot smaller obstacle net before, and it had problems ).   About the RAM usage, things are more complicated.. There was some problem with the largeaddress before with another game( don't know what was it, I just heard ), so we stopped using that, also steam has problems with 64 bit executables( it makes loading files a LOT slower, even contacted steam about it, and they couldn't figure out, but it works fine in 32bit.. ). Ofc 64 is better, but we can't simply drop the 32bit support( also, there isn't 64bit steamlib for mac ), so it has to work.   How does other games do it? How did diablo 2 did it for example? Is this the only way what you described?
  7. honya15

    Handling multiple maps

    Hello! Thanks for the answers, it helps a lot :)   It was discussed in the topic I linked on the first post, that the client can't handle the pathfinding. Even the smallest difference( which will happen ) can lead to totally different paths, then pulling back to the correct place looks ugly, laggish, buggish.   NAT is a pain in the ass. some of the routers support it, some aren't. Sometimes it works, sometimes it doesn't. At least that's what Raknet offers. And I can't get much out of raknet support( all they did was asking for logs, then no more replies )   Servant: About the pathfinding, and collision detecting: I don't really know much about this thing, it wasn't me who wrote it, nor did I work with it. The only thing I know, when 100+ entities moving, colliding with each other, the FPS drops. Even with one map, shit computers, like mac gets really low fps. And since we support mac, we have to work with it.   32 bit executables can only handle 2GB ram, and we are using like 1.7 or more for the graphical content and others. If we only supported 64 bit executables, it would be fine, but that's not the case.   Sorry, maybe I was not clear, but the players host servers. There aren't dedicated servers, you can only join to another player. And the game is already using 3 cores.
  8. honya15

    Handling multiple maps

    Maybe the fault is on our side, but when 400 unit simultaneously trying to find path on a relatively big map, then we often get low fps. On weaker pcs( or mac ) we often get 15-20 fps on one map, imagine that with 4 different maps.. Also, for that, you have to load all those maps in memory( at least the obstacle net ).   Also, this is not an MMO, it's just a coop game, where customers host their own server, simply by choosing "coop" in the menu. That's why there is a problem with the connectivity( shitty routers which are impossible to punch )
  9. honya15

    ENet client problem

    I had this kind of problem when I sent a lot of packets with reliable flag turned on. If you are sending a lot of messages, then use the unreliable method.
  10. Hello! I have a task, to make an ARPG game work on multiplayer at work. Unfortunately the game was developed without considering the networking problems, so I'm in a bit hard situation. Please help me :(   As I said, the game is an ARPG, similar to diablo, there are a lot of moving units at the same time, who are finding paths for themselves, colliding with each other, and attacking the player, or each other. The units communicate with the control with commands. Control can be AI or player input. So, when the player clicks on an enemy, a command structure is created, holding the target unit ID, or the position/direction where the spell will be casted. Looks like something like this: struct SBattleCommand { ECommandType m_eType; // the type of the current command DWORD m_dwUnitID; // the ID of the unit, who is performing this command DWORD m_dwTargetID; // the target ID, may be invalid D3DXVECTOR2 m_vTargetPosition; D3DXVECTOR2 m_vTargetOrient; }; Similar thing happens, when the AI decides to attack the player/cast a spell somewhere or on something. Then the Unit receives this command, stores it, and executes in time.   The pathfinding works in a little tricky way( because there are many units ), it refreshes on a random timer( not really random, has a seed generated from it's ID, what decides when to update the path ). The path finding only looks for a certain depth in one tick, so the whole path may not be found in the frame the command is added. Also, the units are trying to avoid each other when finding a path, also, if something happens, and they collide, they push each other out.   So this is it, this is what I have to synchronize between the server and up to 10 players( usually max 4, but there are game modes which can be played with 10 players ).   My approach was this: When the player inputs a command, it is immediately executes, and when the server receives it, it broadcasts to everyone else. The AI only runs on the server side, when it assigns a command to the unit, it is broadcasted to everyone. The commands are sent with reliable_unsequenced flag, meaning that it is guaranteed that it will arrive, but can arrive out of order, and I handle if one of the packets are too late, it will be dropped. The path finding is done on every client side, because the target position, and the source position is known, and it would be a lot of data, synchronizing. Also, when receiving a command on the client side, the program checks if there is too big difference between the current position of the unit, and the position what is sent with the command, and interpolates if neccessary.   The problem with this is that when there are a lot of units moving in the same direction( e.g. trying to attack the player ), they will collide with each other, and because the positions are not pin-point accurate, the pathfinding may give back different path. Like trying to get around of a group from left, when it's doing it from the right on the server side. Thus, it desynces easily, and the constant position lerping is really ugly.   Is my approach correct? Or should I do it in other way? Please help me! Also, sorry for my English, I'm not native.   Thanks in advance!
  11. Okay, thank you for your answers, it helped me a lot! :)
  12. In the XBOX One documentation, it says 192 kbps is the limit. Currently, after optimalizing the packet size, and frequency, i have now around 56 kbps. I think it's fine, right?
  13. Well, the game will be on PC - xbox - ps platforms, I think it's acceptable if it doesn't work on mobile internet. Users usually talk on Skype, I guess, when playing, but lagging while bittorent is active is acceptable. I don't really know about Korea and Japan, but we have some whiners from russia, who has relatively bad internet connection..
  14. Not predicting makes the game really sloppy( i've tried that in the past ), with like 200 ms latency, the game is unplayable.   So what bandwidth should I aim for? What's the limit? Currently, without really caring about compressing the packages, it was about ~20 kbytes per second, with 100 or more moving units. Ofc I'll do some compressing, also will cut the packets into 2 parts - a reliable packet, which updates things what don't always change, but is essential( like HPs, animations, status ), and an unreliable packet, which will be sent more frequent, but contains only positions, and so, which won't be sent to some users( who wouldn't see it either way ), and doesn't matter if some of the packets are dropped. Am I doing it right?
  15. Thank you for responding!   Yeah, I didn't like the idea either, but this is my job, so I have to do..   I've rewrote a lot of things to be compatible to multiplayer, everything is working, just the interpolating is looking bad.   Also, I don't use Unity engine, I'm using an engine made by my company. Any rework is possible, if neccessary.   So, I should throw out the command synchronization, and just save a state of the close units at every timestep( like 15 ms? ) and just lerp? Shouldn't I predict anything with the units? Only the local player?   Also, what's the ideal bandwidth usage for an ARPG?   Thank you for your help! :)
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!