How should I implement hit detection netcode for AI enemies in a co op first person shooter? I'm working on a FPS sandbox game that has multiplayer but no PvP. Since the game has no PvP, I'm trying to make the networking code favor the player as much as possible. For example, I allow the game clients to decide whether a shot hit missed an enemy, rather than having the game server verify. I also allow the game clients to decide where they are on the map with no verification from the server. This opens the doors for cheaters, but in a PvE game I don't care so much. However, I don't know how to design the enemy AI. If a player is lagging, the server doesn't know that player's real location, so how could I ensure that the player actually saw himself get attacked by an enemy (for example, a Zombie) before the server registered a hit on the player?


How do I organize my class structure for networking? In my gameclient I have the following classes(compontents) Game, GameScreen, GameWorld, Player. They are structured like this Game has two GameScreens MenuScreen and MainScreen. MenuScreen has an instance of GameWorld. GameWorld has an instance of Player. Now I wanted to add a multiplayer mode to my game. For this I have a class "NetworkConnection". For the problem keep in mind that this class needs to access individual objects in the game world, as well as vice versa. Meaning that individual objects (as a simple example the player) need to send messages to the class. It could look like this for example networkConnection.SendPlayerPositionUpdate(x, y, playerID) The problem Where do I put my NetworkConnection? I thought about adding it to "Game" because it is a part of the game (duh). But when I want the player to tell its position to the server I have to do this (Inside the player class) world.screen.game.networkConnection.SendPositionUpdate(...) The otherway around (when messages are being received from the server) (Inside the network class) game.currentScreen.world.player.SetHealthPoints(receivedHealth) Where should I place NetworkConnection? Should I make NetworkConnection a global singelton ?


Websocket server thread per connection I'm creating an html5 multiplayer game and am looking at how to create a websocket server. I've been looking at various libraries and one thing I noticed is that each one will create a new thread for every client that connects. Now I'm fairly new to websockets, but I know that in the past when it came to game server design that a thread per connection was bad practice. Is that true for websockets? Why is there a need to a new thread for every connection?


Handling incoming packets immediately or queuing them I'm using Golang to write a game server. I was wondering what the advantages of queuing the incoming packets for processing over processing them immediately. For example (processing immediately) each new connection client a new goroutine coroutine is created and within that goroutine a loop that reads from the network socket and has a switch statement that routes and handles each packet. Or (queuing) each new connection client a new goroutine is created and within that goroutine a loop that reads from the network socket and passes it to a queue. A second dedicated goroutine for this connection client has a loop that process the packets in the queue. Is this a pre optimization? How are MMORPG's (server side) packet recv handling handled in principle? I'm using TCP.


game multiplayer service development I'm currently working on a multiplayer game. I've looked at a number of multiplayer services(player.io, playphone, gamespy, and others) but nothing really hits the mark. They are missing features, lack platform support or cost too much. What I'm looking for is a simple poor man's version of steam or xbox live. Not the game marketplace side of those two but the multiplayer services. User accounts, profiles, presence info, friends, game stats, invites, on offline messaging. Basically I'm looking for a unified multiplayer platform for all my games across devices. Since I can't find what I'm planning to roll my own piece by piece. I plan to save on server resources by making most of the communication p2p. Things like game data and voice chat can be handled between peers and the server keeps track of user presence and only send updates when needed or requested. I know this runs the risk of cheating but that isn't a concern right now. I plan to run this on a Amazon ec2 micro server for development then move to a small to large instance when finished. I figure user accounts would be the simplest to start with. Users can create accounts online or using in game dialog, login out, change profile info. The user can access this info online or in game. I will need user authentication and secure communication between server and client. I figure all info will be stored in a database but I dont know how it can be stored securely and accessed from webserver and game services. I would appreciate and links to tutorials, info or advice anyone could provide to get me started. Any programming language is fine but I plan to use c on the server and c c on devices. I would like to get started right away but I'm in no hurry to get it finished just yet. If you know of a service that already fits my requirements please let me know.


In a 2D multiplayer game should I send the position of user to the server all the time? In a 2D game where the user moves with the keyboard arrows, should the user send all the time he moves his position (x, y)?. If the user has some speed, the user would send (x, y) like 50 times pixel by pixel in just a second.


Game synchronisation in peer to peer online multiplayer game I am developing an online real time multiplayer game using Google Play Game Service and Cocos2D X. The game has two players where each player control their own ball. The each player sends their own ball s velocity and position to the other connected device. In my game, all the physics calculations are done locally on each devices i.e. ball velocities after physical calculations are calculated locally on each devices. Issue When fast moving ball collides wth the opponent s ball, there is no change in the movement velocity of the opponent s ball. (According to real world physics, the fast moving ball should be able to push the opponent s slowly moving ball.) Reason During my code analysis, I understood that the velocity calculated by the local physics engine are overwritten by the data received from the opponent s device. For e.g. Solution I tried To fix the problem, whenever the collision between balls occurs I am creating one of the device as server and other device as client. All the physics calculations occurs on the server device and data is send to the client device. I have following questions Is the solution tried by me is optimal solution to fix the issue? What other approaches can be tried to fix such type of issue? I would appreciate any suggestions thoughts on this topic. Thank you.


How do I create game rooms using Kryonet? I'm currently about to create my first networking game, and it's supposed to be two player and turn based. I wrote the client using the LibGDX library, and the server with Kryonet. It should be possible for multiple users to play the games, at once, I feel the need to create something like a "game room". I thought about creating a class with two connections (the two players), adding a listener to each, and to handle the messages within the game room. However, I am not sure how to permanently update the game rooms. At the moment, my server only listens for new connections, and registers them in a list of connected clients. Maybe, I should create a new thread for each match? How do I create such game rooms within the game server, itself? Edit So after doing some more research, this is how I currently do it I store the players, that are currently searching for a game in a LinkedList (more precise, their Connections) and once there are more than two, I do this in my Server class if (connectedPlayers.size() gt 2) GameRoom newGame new GameRoom(connectedPlayers.removeFirst(), connectedPlayers.removeFirst()) gameRooms.add(newGame) some list, storing all the current games newGame.start() and my GameRoom looks like this public class GameRoom implements Runnable Thread t Connection playerOne Connection playerTwo more variables your GameRoom might need public GameRoom(Connection playerOne, Connection playerTwo) this.playerOne playerOne this.playerTwo playerTwo whatever more variables you need to use can be declared here, e.g. Override public void run() while (true) Game logic goes here public void start() t new Thread(this) t.start() I am not really into threading and this is what I set up after a little more reading into that topic, but I assume this is not really scaleable because 1000 games would mean 1000 more threads, which I think is not so good. Please let me know, whether this is the correct approach and if not, just stick to my question and help me with it, if you can and feel like it.


Which server platform to choose I'm going to write a server for an online multiplayer with these requirements Pretty simple turn based game (think a card game) that is played entirely on the server (security reasons) Must be able to run multiple games (tables) with 4 players per table, but no lobby system required (another server takes care of that) Can support as many players at once as possible Might need multiple servers Chat between players Socket connection to a Flash AIR client Must be able to communicate with other servers (for player accounts and such) Now, I'm considering two options Smartfox (or equivalent) A custom Java solution in something like Tomcat Why Smartfox? It handles multiple rooms and chat natively It presumably has solutions for well known multiplayer gaming issues Why custom? Smartfox has many unneeded functions, bad for performance Smartfox communicates with an XML based format, I could use a more efficient binary one. Don't know if running the entire game model on the server is convenient with Smartfox' extension mechanism Multiple rooms and chat are easy to reimplement Tomcat or a lightweight container is easier to deploy than Smartfox Better IDE support for developing on Tomcat (automatic deploy, etc) What do you think? Are my assumptions correct? Do you have anything to add? What option should I choose (or maybe a different one entirely)?


Is state change command less reliable than sending the entire state? I'm asking for a game that I develop right now. The game is using TCP communication, there's server and multiple clients. While players in a room are playing the game, I send state update commands in a custom binary protocol every 33 ms. (30 FPS) Problem is those states are huge there are players moving, objects spawning and also destructible blocks. If I were to send all this data a single state update to every player will be huge, resulting in huge bandwidth. So I'm thinking different approach Initially send the huge state with all moving and stationary objects, when the room starts Do the state update commands every 33 ms, but include just the moving objects, and not include the state and location of the stationary objects. For stationary objects, issue separate commands to tell they are destroyed or spawned and expect clients to update their copy of the state. My concern is that it may somehow happen that due to not including the stationary objects in every state update, clients may somehow miss the separate commands that update on those and not reflect that change in their copy of the state. Here is a visual representation of what I imagine Less bandwidth (is it less reliable?) game started gt obj1 id,location , obj2 id,location , obj3 id,location state update 1 gt obj1 id,location , obj2 id,location assumes obj3 is there state update 2 gt obj1 id,location , obj2 id,location assumes obj3 is there state update 3 gt obj1 id,location , obj2 id,location assumes obj3 is there object removed gt obj3 removing the object locally state update 4 gt obj1 id,location , obj2 id,location obj3 not present at this point More bandwidth include all objects in every state update and assume if something is not present, it has been removed (is it more reliable?) game started gt obj1 id,location , obj2 id,location , obj3 id,location state update 1 gt obj1 id,location , obj2 id,location , obj3 id,location state update 2 gt obj1 id,location , obj2 id,location , obj3 id,location state update 3 gt obj1 id,location , obj2 id,location obj3 is not here, so removing it locally state update 4 gt obj1 id,location , obj2 id,location obj3 not present at this point


P2P network hiding positions? I have been working on a P2P architecture for secure gaming and I have divided the problem into five sub problems Unlawful modification of sent game state Accurately drop cheaters Agreeing on a game state Avoiding "look ahead" cheat Hiding sensitive information from opponents The first four I have pretty much all solved but it is the last one which I am having trouble with. Before I go into details I just want to ask if there's anything I've missed in my list of making a "cheat proof" p2p network. I am not interested in cheats such as using aimbots, I am only interested in making the p2p network as secure as a centralized server. So in my effort so far on hiding sensitive information I've focused on the position of players in a game where the position of your opponent should not always be known. The problem then becomes how to determine if you should send you position to your opponent without knowing the position of your opponent. I have ruled out methods such as the opponent sending multiple false positions for you to compare yours too since your opponent can easily abuse such a system since he will get your position if one of the false positions happened to be "visible" from your position. The method I have been focusing on one in which you receive a "visual field" from your opponent and can thereby determine if you should send your position or not. This is however a problem in games such as League of Legends where the visual field of your opponent is also highly sensitive information. I have tried to solve this by transforming the visual field using a singular matrix meaning you cannot go from the transformed version of the visual field back to the original version, but since it is a linear transformation you can still figure out if your position is inside the visual field or not. This does not however work perfectly, the exact visual field cannot be restored after transformation, but information about the "slopes" in the visual field (the visual field is constructed by several lines, and the slope of each line can be determined) can be restored and this can be used to relatively inexpensively reconstruct the original visual field. In essence, what I need is a function which can determine if a position is "visible" or not, and reconstructing this function visual field has to be so computationally demanding that once you are done reconstructing the visual field it is no longer relevant for the game in action. Is there any super smart person out there who happens to know of such a method? Edit People seam kind of confused about the whole "vision field" so I aim to give a more detailed explanation here. The vision field consists groups of a set of lines, you can easily check if a position is inside one of these groups by just checking which side of the line your position is, if it's on the same side for all lines in that group you know it's inside that group and thus inside the vision field. The information being sent however is not this line, but a transformation of the line and the transformation (2 by 2 singular a matrix), you can still check which side of the line your position is on by first transforming it using the transformation you received and comparing that value to the transformed line. The key here is that the transformation is singular, meaning it is impossible to find an inverse to go back to the original line. However it is possible to determine the slope of the line which makes reconstructing the line by just checking on which side of the transformed line a lot of points lie until you have pinpointed the origin of the line a lot computationally cheaper than if you did not know the slope of the line. What I am looking for is a method for determining if a point is inside of an area, where reconstructing the area from the method is either impossible (which I doubt exists since you can always brute force it) or very computationally heavy.


How can I stop the player from drifting due to local input prediction when they stop? I'm working on a 2D server client multiplayer game engine (which you can try here). It uses WebRTC DataChannels. (The connections are peer to peer, but the host peer still acts as a server.) The biggest problem (apart from connectivity) is the local input prediction. We do the usual On key press, players move instantly, tell the host what keys are pressed, receive data back from the host and compare it to the historical position. The position is corrected over time if there is a difference. This works well with low packet loss or PDV, even if the ping is high. If there is loss or PDV, the deviation can be larger. I think this is because if the first packet indicating a change of input is delayed or dropped, the host finds out later, and starts changing that player later than their local input prediciton shows. If the player is moving, we crank up the amount of applied correction, since it's less noticable. This seems to cover up gaps when starting to move and while moving. However, any correction is more noticable if they come to an abrupt stop. Then if the PDV or loss means the host thinks they stopped later, the host overshoots, sends back data saying they're a bit further ahead, and the correction makes the player drift a little. On flaky connections, players often noticably drift after coming to a stop. I've not noticed this in other games. How can this be mitigated?


I wanted to create a simple mobile online game for me and my mates. How should I handle the networking? I've made a few simple games and one multiplayer game where you connect through LAN but for this one I wanted to learn something new. I have the game concept working on my computer, it's just waiting for the networking. I was looking to create networking similar to mobile online quiz games, where you use your Store account as the game account you are not restricted to LAN or same WiFi network, but rather everything goes through an external server you have a Friends list,Recently Played list where you can see who's online right now you can invite a random player to a match or search for particular player to play with them add them to your Friends list Something like that. I don't know if you can host servers for a match on mobile devices, or how feasible it would be, given mobile internet isn't free, but it would make for a nice addition if the external server was only for handling information about who's online. I'm working in Unity btw. so any recommendation for package from Asset Store is welcomed Thanks in advance! )


How to organize messages queue in a fast paced multiplayer game I'm trying to develop a fast paced multiplayer game. I decided to build my own protocol over UDP and now I'm stuck with the following question. The idea of the protocol is very basic and it's similar to many others Client does NOT do any game logic except of some predictions (like smooth walking). It just sends 'ping', 'connect', 'disconnect' and 'keypressed' 'keyreleased' actions to the server. On contrary, the server does game logic based on the users inputs and sends diffs to each client every 30 ms As I already mentioned, the client sends 'ping' messages (to notify server that we're still alive when there's no other messages in some period of time) as well as 'keypressed' 'keyreleased' stuff. I thought that the 'ping' messages can be unrelirable the client sends them at steady intervals anyway, so if one was lost, nothing bad will happen. However, such messages like 'keypressed' and 'keyreleased' should be reliable. By this I mean that the client should resend them in case of any failure and they should appear on the server in the same order they were sent (otherwise 'keyreleased' message could arrive before 'keypressed' resulting in the incorrect game behavior). So, the questions is how is it usually handled? I mean, what is the right way to implement such logic on the server? Should I queue all incoming reliable messages in some container and wait until messages with smaller sequence IDs also arrive? If so, what should I do with unrelirable messages then? Because I definitely shouldn't wait before 'ping' message arrived (and there's a chance that it won't arrive at all). Should I use a distinct sequence numbers for unrelirable messages or should I make 'ping' messages reliable as well?


How does OnLive work, and is there anything special Game Developers need to do? The OnLive service works by "cloud rendering", which is very different from the traditional model of "on premise rendering" that we are all familiar with. How does this work at a technical level, and is there anything special game developers or artists need to do to optimize their game for the platform? As a developer, I'm a bit skeptical that everything is as magically working as they seem to suggest.


How do I avoid losing prediction responsiveness due to client interpolation? In my online game, I am using client prediction and client interpolation to give the illusion of responsiveness over a networked connection. The client prediction applies inputs that haven't yet been acknowledged by the server to incoming server states. When the input is acknowledged, the client's entity will already be in the final position. The client interpolation works by buffering world snapshots and rendering the entities 100 ms in the past. While new snapshots arrive within the next 100 ms, there will always be valid data to interpolate between. My problem is that the responsiveness gained from client prediction is lost due to client interpolation. The client's local inputs are applied to incoming server states. However, those incoming states aren't actually rendered on the client until 100 ms later, due to the client interpolation. The result is that there is always a 100 ms lag between pressing a key and rendering the change to the screen. How can I get the best of both worlds, rendering entities in the past, but rendering the client's inputs instantly?


Server hosting and costs I'm developing a game that will require renting a server. The server will be used to host scores, clans, friends(on off), match making, lobby, and chat. The game match will be hosted by each player (to lower the cost). How much would a server like this cost? Any hosting recommendation? How much would it cost if the server hosts the games matches too? I want to know a base price (imagine a card game or turn based RPG, even though my game is real time).


Can networking be platform independent in a libgdx game? LibGDX supports Desktop (Windows, Linux and Mac), Android and web applications. Can i code the network part of an online game without taking care of what kind a of application i'm running? i.e coding the network engine interdependently of the application type.


Need help choosing the right networking approach platform for an RTS I have been thinking for a while about making an online 2D RTS like game. (2 6 players in a match, up to 50 60 units, no AI). The key thing here is that I want the game to be playable in a browser, so it'll have to be either flash or java applet, both using TCP sockets. At first I was entirely focused on flash because of a higher market penetration and accessibility. However, after reviewing different networking approaches I am unable to make a choice. I really liked lock step simulation approach where server and every client are running the exact same simulation, until I realized that it's going to be tough as hell (if not impossible) to implement exactly the same logic in two different languages, one of them being actionscript. This is where java comes in. With java client and server can share simulation related code that may as well cut the development time in half. But then there is another approach, where clients try to simulate (or rather extrapolate) the game state correctly as long as possible, but they don't have to do it right at some point they are going to receive the full state snapshot an adjust accordingly. Flash looks like a viable option again, but still, lock step simulation seems so much more straightforward, as there is no "adjusting" part. So are my assumptions correct? What would you suggest?


How can I make a peer to peer multiplayer game? How can I make a p2p multiplayer game? I would like to have a server less multiplayer game. But then, how all the clients know each other? Why the p2p protocol is so famous in file transfer but not in multiplayer games?


How do I keep an MMO synchronized? I'm making a 2D, top down MMO game. ATM I can connect a player to a server and they get the map data from a DB. They can move around and hit some stuff and if they move near a viewport edge, the server sends new data etc. Even a few players can do this, but since I don't have an, lets call it, "update manager" which tells the players where they are and the DB that the map has been altered. It's just a read only game at the moment. My idea is, to tell the server where a player is and how big his viewport is. Then if any other player is in this viewport, the server will distribute the updates to each other player. So I wouldn't have to tell the whole world what's going on. The problem, however, is the ping. If I have a ping of 300ms, every other player would probably "jump" over the map, and not move smoothly. I could keep this synchronized with vector clocks, but it would still lag. Also, how to keep the players from cheating? All ideas I got, don't really work. The only "safe" thing seems to be to calculate the game on the server and client, then throw away all data when the calculations are wrong. But this seems rather excessive to me. Edit Ok, I had some ideas after I read the comments. I will send an absolute state to the server for ever game entity I have. This state object will consist of the position, orientation, speed and an "action", which can be anything someone can do. I'm gonna keep the clients seperated in "small" arrays, each representing a area of the map. So I can calculate which client is near or in my viewport and needs to get my information. I have to find out if it's possible to get a timestamp of the request, to use it for sanity checking, so no player can send me actions from an invalid time range to get his actions evaluated before the other players. Only only updates from other clients and errors from the server get sent to the client, if everything is ok the server just takes the informations.


Reliability and suitability of 3G connection for client server turn based non asynchronous game I am working on an iOS turn based client server game and I am concerned with the reliability of the connection and the length of time it takes to establish the connection. The game is turn based but is not asynchronous, so both players must finish their game in one sitting. If one side of the connection is lost, the person who loses connection will lose. As such this is a big concern for me. I see applications like WhatsApp losing connection quite often even with full bar of data and it takes about 2 3 seconds every time I launch or resume the application to establish a connection. Is this the norm and is there any way to keep the connection from disconnecting from the server as long as the player has 3G connection? What are some things that I can do to improve the play experience given this condition?


FPS networking with server sending input instead of gamestate Why do all fps games have the server send gamestate instead of input which is smaller? One reason I can sort of see is that if the server sends input to the clients and a packet gets dropped then the client will not be able to gave an accurate simulation until a resend of that packet occurs which could be an entire timeout plus one way trip latency. Presumably this is considered unreasonable for a real time fps game. But what if at time T the server sends the input processed at time T to the client and at time T 1 the server sends the input processed at time T and time T 1. This way if the packet containing the input processed at time T is dropped the client will get the next packet sent by the server which contains the input processed at time T and time T 1. Thus the client will not stall on the simulation because the server is redundantly sending previous input. The server stops sending a previous input when it gets an ack from the client. This seems to avoid sending the entire game state. Can someone tell me why this idea is just bad and why no fps games use it?


Is it feasible to use a DHT to span an MMO over many servers for improving reliability? At the moment I have an idea for how to handle distributing MMO servers. At the core is a bunch of worker nodes that all share the same set of distributed hash tables. Each DHT stores a specific game component. Each frame a coordinator server (which there can also be many of) pushes work out to all of the connected worker nodes and wait for them to complete all of the assigned tasks. The system is also divided up into four parts the client, which obviously the player uses. The proxy server that sits behind load balancers and users connect to. All they do is process incoming user packets, verify them and passes the request to the work cluster. The work cluster receives packets from proxies and append them to a process queue and wait for the frame event from the controller node to process them. I just want to know if adding a DHT to the worker nodes like this would be feasible? This should allow redundency and high availability out of the box as DHT's are quite good at that.


How to prevent game client version spoofing Basically I have a c server that will use a binary protocol to talk to my client (unity game). As part of the login process I want to send the client version to the server. The server then responds saying (assuming login credentials are correct) they are okay to connect, or if the client version is outdated it returns a client version outdated. My question is, how can I prevent people using old client versions and spoofing as the latest version. As this could potentially lead to server bugs as it is handling an outdated client thinking it is up to date... Thank you )


How do network applications get around firewalls? Forgive me if this comes off as naive I've only a cursory understanding of network communications. My work has a public and very restrictive network (they appear to block everything that isn't approved) and yet I've seen people accessing many games (World of Warcraft for example). I don't imagine that the network admins made any explicit exceptions for these applications but when I tried to develop a networked prototype with services like 'Photon Server' or 'Adobe's RTMFP' they all fail from the office due to the network restrictions (can't establish connection). Is there some kind of work around that applications like WoW employ that distinguish them from an anonymous networked app I've built myself? (Some kind of fallback channel maybe?) I appreciate that there might not be enough information here for an answer, but any insights would be welcome. Thank you!


RTS Style Game With Client Side Prediction So, I am currently working on an RTS like multiplayer game. Units are not controllable by players (they attack move to a location automatically). I decided not to go full lockstep but instead do a state based prediction hybrid. The game is fully simulated on the client with a state packet for every unit distributed only once per second (Position, health etc.). I've read that this is quite a common method of doing things these days but i'm having major issues with it. One clear problem is with health syncing. Damage is dealt locally on every client machine and corrected via the state packet. This results in issues similar to this Projectile hits a unit on a client machine, taking him from 100 health down to 50. Client only then receives a state packet from the server saying he is on 100 health which spikes it back up. Of course he will receive another corrective packet later on taking him back down to 50 but this causes really bad visual spikes. This issue gets even worse if you consider the impact of ability damage and such. Have I completely misunderstood what is required to create a client predicted game or do I just need to treat every variable on a case by case basis? (I.E. Put in silly hacks to make the health not look bad).


Input and packets handling when using render interpolation I'm implementing valve's networking model for my simple top down game but I have some design problems and I just can't think of good solutions. The one of the main ideas that there is a render time separate from simulation time. So for example I have interpolation time of 50ms (as my server update rate is 20Hz). So, on client my simulation time is 1000ms and render time is 950ms. But I have some design problems... When the user presses a key (in example cast spell), the logical choice is to trigger it in the render time (950ms), but that's impossible since my simulation is in 1000ms already. I think that the solution may be to trigger input using simulation time (and use "lag compensation", so if spell casting time is 100ms, user casts it at the time when render is at 950ms, and it will start in simulation at time 1000ms as 50 casted spell). However I'm not sure, is it a good solution? The second problem is about sending packets. So If my solution for the first problem is good, then I will send the newest packet from simulation (and don't bother with render time when sending packets). Is it good or should I send packets using render time (ie when simulation time is 1000ms I send to server packet from 950ms)? The third problem is about receiving packets. When I receive packet when the simulation time is 1000ms, should I save it as packet received in 1000ms or 950ms? In valve networking model (which I use as I said), when server receives info "started casting spell" at server time 250ms, it is compensated by rtt 2 AND by client interpolation time... So I don't know how valve clients handle input, looks like they handle it at render time which I don't understand. Anyway, as I want to use my solution for handling input, I think that I shouldn't compensate for interpolation on server, yes? Or maybe I should compensate on server also by client interpolation time? I hope that you can help me with my 3 questions. Thanks in advance!


I know that my super simple multiplayer setup is probably not a good idea, but why? I'm making a simple little MOBA just for fun. I was making everything single player then I realized "oh crap I should probably add multiplayer, huh." I've never done anything with networking before, so learning how to integrate Lidgren into my game was fun and awesome. The thing is, I pretty much know the way I'm doing things is wrong, because it's not robust enough for mainstream games to use, as far as I know, but what's wrong with it? What I'm doing is, basically, whenever a player does an action, it sends a message to the server saying "hey, I just did this thing." The server and the client are both running the same simulation. The server then sends a message to all other clients telling them that that guy did that thing. For the most part, except in a few cases, when a player does a thing, the client assumes it's cool and goes ahead with it on its own. So when you right click somewhere to move there, that player's client just starts moving his guy there, and then sends a message to the server telling it about it. So basically Player 1 casts a spell to make him move 100 faster for six seconds Player 1's local client adds that buff to his Unit object Player 1's client sends a message to the server saying "hey I just cast this spell" The server makes sure he really did have enough mana to cast that spell, and if so, adds that buff to the server's copy of that Unit object The server sends a message to all other clients saying "hey this guy just cast this spell" Every other client receives the message and goes "ah okay cool," and adds that buff to their local Unit object for that player I've been skimming through stuff to see how big games do multiplayer, and it's kind of confusing for someone who's just starting to dabble in this stuff, but it looks like the Source engine sends a packet containing all of the changes to everything in the world every tick? Again, totally new to this stuff, but can you really push that much data that frequently? Sorry if this is a bit rambly, but basically, I was wondering why my simpler system isn't the right way to go, because if it was, other games would use it, right?


Implementing The Command Pattern Undo And Entity References I am trying to implement a replay undo system for a turn based strategy game I am currently working on. A sample move could go as follows 1. A players select a pawn and gives it an attack command. 2. The attacked unit dies. 3. The dead unit is removed from the map and the controlling player. 4. The controlling player takes some damage. 5. The attacking unit gains a survivor strength power up for the remainder of the game. The rest of the game plays similarly to a Fire Emblem type game, but the point is a single command like attacking yields multiple effects to various game entities. Eventually I want to make the game networked, but for now everything is local play. After doing some research, I came across several resources discussing the command pattern and feel it is the solution to my replay and undo system. I ended up using an interface similar to https gamedev.stackexchange.com a 37684 41499 but I am confused on some of the implementation details. Do I make commands to update each component of my game separately (i.e. AtkUnitCmd, RmvUnitFromMapCmd, RmvUnitFromPlayerCmd, InflictPlayerDmgCmd, etc.) or should my AtkUnitCmd handle all updates of entity state internally? How do I handle dead units? I can store a reference to the dead unit, but this would likely need to change when networking is implemented as the object itself would not be transmitted over the network correct? Each command has some animation involved for example when a unit moves an animation needs to play. I may choose to skip the animations while other times leave them on. Do I bake the animations into the commands themselves or should I separate the animation code and call it somehow when the command is played? Any thoughts?


Game clock Synchronization in python I am working on a network game project in python which we want to keep synchronized. I would assume we should use Network Time Protocol to cater for different levels of lag. That being the case, is there an implementation for Network Time Protocol in python?


P2P synchronization can a player update fields of other players? I know that synchronization is a huge topic, so I have minimized the problem to this example case. Let's say, Alice and Bob are playing a P2P game, fighting against each other. If Alice hits Bob, how should I do the network component to make Bob's HP decrease? I can think of two approaches Alice perform a Bob.HP , then send Bob's reduced HP to Bob. Alice send a "I just hit Bob" signal to Bob. Bob checks it, and reduce its own HP, then send his new HP to everyone including Alice. I think the second approach is better because I don't think a player in a P2P game should be able to modify other players' private fields. Otherwise cheating would be too easy, right? My philosophy is that in a P2P game especially, a player's attributes and all attributes of its belonging objects should only be updated by the player himself. However, I can't prove that this is right. Could someone give me some evidence? Thanks )


Using Unity's uNet to create a turn based RPG I've been checking some tutorials about uNet and it seems pretty powerful. The NetworkManager is a great tool when you want to make generic games, but what is troubling me about it is the need of spawning a "Player". I intend to create a turn based RPG, and for that, during the battle there's not a "physical player entity", there's two players which have a set of monsters and the players can select a monster to attack the opponents', but the player itself doesn't exist, in the end it sums up to a trade of commands between the clients. How can I achieve such an architecture with uNet? Should I discard the use of the default NetworkManager? Should I simply create a bodyless Player and go along with it?


Can Google App Engine communicate with a stand alone program? If I create a client program using say C , or develop something for the Android or Iphone, can I use Google App Engine for the server and communicate with the client application mentioned above?


How does delta compression reduce the amount of data sent over the network? Many games use the technique of delta compression in order to lower the data load sent. I fail to understand how this technique actually lowers the data load? For example, let's say I want to send a position. Without delta compression I send a vector3 with the exact position of the entity, for instance (30, 2, 19). With delta compression I send a vector3 with smaller numbers (0.2, 0.1, 0.04). I don't understand how it lowers the data load if both of the messages are vector3 32 bit for each float 32 3 96 bits! I know you can convert each float to a byte and then convert it back from a byte to float but it causes precision errors which are visible.


How to open auto detect LAN connections? After sucessfully creating my first online multiplayer with servers and clients in UDP, I am wondering how LAN connections works. As it is right now, I need to open a server and forward the ports for the server if public. In LAN, they connection is possible but requires the local IP address. However, if we take Minecraft or Starcraft, the game is able to auto detects servers on your local network. How are they achieving this ?


UDP RUDP or UDP TCP? I made a library that enables client server communication using both TCP and UDP protocols. When game developers on the gamedev IRC channel (Freenode) knew that, they totally refused the idea. They recommended RUDP instead of TCP. Should I remove the TCP communication and use RUDP instead?


UDP vs TCP in multiplayer mobile game I'm working on a networked multiplayer game, initially for iOS. Even with TCP NODELAY there are large fluctuations in latency. I can't be sure of the reason, but I would not be surprised if it was resends on packet loss due to flaky connections. Having done no real life server work with UDP as opposed to TCP (which I have lots of experience with), I wonder if there are any significant gains to trying a UDP based architecture. Client packets are typically only a few bytes, sent rarely, except when moving, when the player might issue 2 8 commands s. Server packets are slightly larger and mostly sent as response to a client command. Connections need to be reliable and ordered. ADDITIONAL INFO Very early on I did some exploratory tests with TCP versus UDP. I would run connections Phone gt 3G gt External static IP of router gt Wifi gt Development computer and Phone gt Wifi gt Router gt Wifi gt Development computer. What I wanted to improve was mainly the very uneven lag one would experience moving around on the map with a non local connection. Obviously starting animations can help, but there are (rare but valid) reasons why a move command might be rejected that the client have no way to predict. In addition, much data is hidden from the client, which again gives very little room for predictive responses. Anyway, my results was the UDP and TCP gave pretty much the same average latency when sending data. What I didn't look at was the actual spread for example the maximum TCP latency in face of packet loss. I would have have needed to do some packet recovery mechanism in UDP to figure out if UDP could do better. So again the results I see today with TCP is that usually it works fine, then suddenly a slowdown and a burst of movement as all the other buffered packets are more or less executed at the same time.


game multiplayer service development I'm currently working on a multiplayer game. I've looked at a number of multiplayer services(player.io, playphone, gamespy, and others) but nothing really hits the mark. They are missing features, lack platform support or cost too much. What I'm looking for is a simple poor man's version of steam or xbox live. Not the game marketplace side of those two but the multiplayer services. User accounts, profiles, presence info, friends, game stats, invites, on offline messaging. Basically I'm looking for a unified multiplayer platform for all my games across devices. Since I can't find what I'm planning to roll my own piece by piece. I plan to save on server resources by making most of the communication p2p. Things like game data and voice chat can be handled between peers and the server keeps track of user presence and only send updates when needed or requested. I know this runs the risk of cheating but that isn't a concern right now. I plan to run this on a Amazon ec2 micro server for development then move to a small to large instance when finished. I figure user accounts would be the simplest to start with. Users can create accounts online or using in game dialog, login out, change profile info. The user can access this info online or in game. I will need user authentication and secure communication between server and client. I figure all info will be stored in a database but I dont know how it can be stored securely and accessed from webserver and game services. I would appreciate and links to tutorials, info or advice anyone could provide to get me started. Any programming language is fine but I plan to use c on the server and c c on devices. I would like to get started right away but I'm in no hurry to get it finished just yet. If you know of a service that already fits my requirements please let me know.


How do I sync multiplayer game state more efficiently than full state updates? I've done a little game network coding before, but primarily with TCP for games without real time needs. I am working on a 2D Java game with networked multiplayer. For learning, I want to do this myself, without an existing network API. How do I efficiently represent the game state sent to clients from a server? There is the most obvious but probably least efficient way, which would be to create some sort of game state context object with each player's location, animation state, etc., and send that out to each player every update. That doesn't seem terribly difficult to implement, but would probably be too large to achieve anything close to real time interaction (of course my experience with this is limited so I may be incorrect). Is there a solid way any of you have used before to only transmit changes in state, and is there even a large enough disparity in performance that it is worth the extra work?


How do MMO servers handle a large concentrated number of players? I have a pretty good understanding of how to scale servers but there's one thing I can't quite be sure about is how to manage a lot of players in a concentrated area. If I have a server which is using multiple threads and processes as long as you limit the amount of players that can join a single game instance then this can scale indefinitely by adding more servers and placing it behind a load balancer. But MMO games don't work that way because it's broken down into zones that anyone can connect to. So if a massive amount of players all decided to connect to the same zone it would put all of the stress on 1 server. If you tried to spread the load across multiple servers then you'd run into problems of having to share information between the servers (Such as if player X was connected to sever 1 then all of his movements would also have to be passed on to the players connected to server 2 since server 1 and 2 are managing the load for the same zone). So I was wondering how do you go about solving this problem? Do you just keep on ramping up the specs for the server on heavily populated zones? Or is there a fast and efficient way for multiple servers to manage the load for the same zone and efficiently share data between the two servers?


Can packet latency fluctuate? Can the time it takes for a packet to be transmitted from a client to the server fluctuate?


Solution for lightweight LAN peer discovering? I built a library for purely cross platform programming. My games made with it run fine in Android , Pc, Linux, Mac etc. The networking capabilities are provided by ENET library, therefore all communication between my apps is not TCP or UDP compatible, but only in the custom protocol, even tough its based on the UDP ultimately. I don't think its possible to do what i want with ENET, thats why I ask here for help! Lets say I have the same game running in my Android phone, my laptop and my pc. They are all in the same wifi network, and therefore in a LAN, whether its Wifi hotspot(?) or the household router. I need each of those 3 peers to discover the other two in the network. This is meant only to find the IP of alive apps in the LAN network, to be able to host multiplayer games between them. I can only think of one effective way to do this, UDP broadcast, wait responses, but if that is the solution, i need something small, since its the only purpose of the implementation. Other way could be to try to connect to all IPs in the LAN address subrange, but I don't think the OS would be with me on this one p


How to make a multiplayer game work reliably behind NAT? Even games that are 100 client server sometimes have issues when the client is behind NAT. Peee peer games are even a bigger issues. Some games need to use multiple transports (such as UDP and TCP) or multiple connections (such as a different UDP port for voice). What are some ways to make sure a game works reliably when running behind a NAT router? Peer Peer No centralized server exists. Player A starts a game and Player B wants to join Client Server A centralized server on a well known address (hostname) accepts all incoming connections. Each client only communicates with that server. Combo Where the server is just matchmaking, but game updates are peer peer. Different peers may see each player with a different IP port potentially (e.g. some clients are behind the same NAT and some are on a different router)


Only send moves for P2P 2 player LAN game? I am making a 2D network game. The concept is simple, a player have to shoot the other player to win. I'd like to improve this game ( add a map, items, monsters, w e ), but later. This is my first network programming experience. I have little theorical knowledges about packets, sockets, client server side, what is dangerous to do client sided, but I've never really used them. Goals set This is a 2 players LAN game, no more no less. No server. Player 1 starts the game waiting for player 2... ... which leads the game open for reverse engineering or packet editing, but w e, for this kind of game I prefer simplicity over security. Pretty basic. For a first network game that will never be shared, I take off problems and will see later. This is where I am each player is a square that can move in four directions. The approach TCP Packets. Each movement ( each frame a key is pressed to be accurate ), a packet is sent to the other player with his position. Packets are received each frames before drawing and updating game elements, in the same thread, with a non blocking receive() function. And that's it. My questions Is sending a packet for each moves overkill? Will I have problems with this later? What kind of problem can I meet? mono thread non blocking function will be a problem later, assuming the goals I've set?


Character appearance synchronization in open world multiplayer game I am working on a multiplayer open world game where you can equip handhelds and armor pieces. In my architecture, there are clients and an authoritative server. Every equipable item is crafted by a user. They can be different in shape, so it's important that I synchronize shape information. This is expensive data to send (basically an outline plus some more info). Together with this, I also want to synchronize any equipment event that occurs, so when a user meets another user, they can see each other's gear. The easiest solution I've found is to force send gear on equipment, but it will use bandwidth even when two players are far away. This feels like a problem that has been solved a thousand times, so I don't want to reinvent the wheel. Do you know of any best practice known strategy that suits my situation?


Would adding delay to inbound traffic give you an advantage in online games? Wouldn't adding a latency delay to inbound traffic and limiting your download speeds to a low but playable standard give you an advantage in online games, especially shooters? Because wouldn't your shots be registering as normal (using upload outbound) while anything that attempts to hit you (download inbound) would be delayed and or slow?


TCP vs. Reliable UDP? Sending Reliable Packets in Fast paced Multiplayer Games? I'm currently working on a networking framework for Unity3D in order to simplify making multiplayer games. I'm using UDP for any kind of synchronisation and unimportant data. My question is how do I send reliable packets such as RPCs or object instantiation? Should I use TCP for that or should I go about writing my own reliable protocol on top of UDP? Thanks in advance!


How are UDP packets verified as authentic? Hey I'm writing a game and have the backend written using a sometimes reliable UDP scheme. I want to verify that inbound packets are actually originating from the player specified in the packets. My idea (not original by any means) was to have the player register an account once and then, once per "session", login over HTTPS SSL by sending username password to a simple web service. The game client would check validity of my site's SSL certificate to disallow impersonation. The username and password are submitted and the response is a generated random "secret session key". Matchmaking happens blah blah... Then, when playing a match game, the game client sends packets using UDP and attaches a HMAC SHA1 of the packet payload using the secret session key as secret. I don't care if people can see the contents of the packet there's nothing secret there so symmetric encryption isn't needed. I don't see how the packets can be spoofed since the secret session key was transmitted to the game client over a secure channel but I don't know what I don't know, you know? Thanks for any insights.


How do I get an unique hardware id with gdscript? Using Godot Engine, I'm trying to implement digital rights management (DRM) using an uuid, and I want to get the user's MAC address. Is there an easy way to do this with gdscript? On Linux, I could call OS.execute to run quot ip link show quot and parse out mac addresses from the output. However, I would rather not maintain platform specific versions. I also hope to avoid having to compile in native code.


P2P network hiding positions? I have been working on a P2P architecture for secure gaming and I have divided the problem into five sub problems Unlawful modification of sent game state Accurately drop cheaters Agreeing on a game state Avoiding "look ahead" cheat Hiding sensitive information from opponents The first four I have pretty much all solved but it is the last one which I am having trouble with. Before I go into details I just want to ask if there's anything I've missed in my list of making a "cheat proof" p2p network. I am not interested in cheats such as using aimbots, I am only interested in making the p2p network as secure as a centralized server. So in my effort so far on hiding sensitive information I've focused on the position of players in a game where the position of your opponent should not always be known. The problem then becomes how to determine if you should send you position to your opponent without knowing the position of your opponent. I have ruled out methods such as the opponent sending multiple false positions for you to compare yours too since your opponent can easily abuse such a system since he will get your position if one of the false positions happened to be "visible" from your position. The method I have been focusing on one in which you receive a "visual field" from your opponent and can thereby determine if you should send your position or not. This is however a problem in games such as League of Legends where the visual field of your opponent is also highly sensitive information. I have tried to solve this by transforming the visual field using a singular matrix meaning you cannot go from the transformed version of the visual field back to the original version, but since it is a linear transformation you can still figure out if your position is inside the visual field or not. This does not however work perfectly, the exact visual field cannot be restored after transformation, but information about the "slopes" in the visual field (the visual field is constructed by several lines, and the slope of each line can be determined) can be restored and this can be used to relatively inexpensively reconstruct the original visual field. In essence, what I need is a function which can determine if a position is "visible" or not, and reconstructing this function visual field has to be so computationally demanding that once you are done reconstructing the visual field it is no longer relevant for the game in action. Is there any super smart person out there who happens to know of such a method? Edit People seam kind of confused about the whole "vision field" so I aim to give a more detailed explanation here. The vision field consists groups of a set of lines, you can easily check if a position is inside one of these groups by just checking which side of the line your position is, if it's on the same side for all lines in that group you know it's inside that group and thus inside the vision field. The information being sent however is not this line, but a transformation of the line and the transformation (2 by 2 singular a matrix), you can still check which side of the line your position is on by first transforming it using the transformation you received and comparing that value to the transformed line. The key here is that the transformation is singular, meaning it is impossible to find an inverse to go back to the original line. However it is possible to determine the slope of the line which makes reconstructing the line by just checking on which side of the transformed line a lot of points lie until you have pinpointed the origin of the line a lot computationally cheaper than if you did not know the slope of the line. What I am looking for is a method for determining if a point is inside of an area, where reconstructing the area from the method is either impossible (which I doubt exists since you can always brute force it) or very computationally heavy.


Lag compensation in rocket game context I have read a lot of papers recently to understand the lag compensation concept recently. They were all about the same context shooter game where bullets move in infinite velocity. The most important thing is checking what was in the crosshair when the client created the fire command. If another player was there at that time, then s he's damaged. That is done by checking the world state at that time by finding a snapshot and executing commands until the fire command. How about firing a rocket? That is slow (not to mention other differences ignition time and area damage). That means, I cannot only check what was on the crosshair of the client at the command creation time. If I go back and check the world state at that time (with same method above), it wouldn't be enough. I would still need to do the simulation for the next snapshots until the most recent one (server's present). That would mean, if I have a time step of 15ms (tick rate 66) and I want to discard a command if it is older than 1.5 seconds, I need to keep the most recent 100 (1500 15) snapshots of the world. And every time a delayed command comes, I have to re simulate the world from that command's timestamp to present including reprocessing the commands with timestamps after that one. This sounds too much work on the CPU to me. Is this the same in the first scenario (infinite speed bullet)? What about lag compensation for movement commands? Would that be different? Or did I misunderstand something many things?


Running both the server and the client within the same process Question I have just started working with Lidgren and networking for the first time, and I've come to the realisation that it is possible to run both the server and the client within the same process. Is this practice discouraged for any reason? Context The reason I'm asking is because I theorized that this concept might allow me to treat both singleplayer and multiplayer modes as one and the same, which would be very helpful. Following my line of thought, this is the distribution I had in mind Singleplayer 1 server 1 client in the same process. How fast are the communications? Multiplayer Same as singleplayer for the host 1 aditional client for each other player. The execution flow I'm picturing is for clients to recieve user input and send a notification to the server. Then the server validates it, and broadcasts an action to be executed by all the clients. It shouldn't matter if there is only one client (i.e. singleplayer) or multiple clients (i.e. multiplayer).


What is a good balance between client and server actions? I'm working on a voxel based game right now which will have a lot of events, like clicking a block or object. Say I want to open an interface when I click a certain block. Should I handle this on the client, or send a packet to the server with the action and it's details such as what the ID of the block is, its position et cetera, and then send a packet back to the client with the action OpenInterface with the interface ID?


RTS game How to handle disconnects in a fully connected peer to peer architecture? I'm currently working on a game in which I am considering implementing a networking architecture as described in this article http www.gamasutra.com view feature 131503 1500 archers on a 288 network .php In order for the implementation as described in the article to work, all peers need to be interconnected without any exceptions. Like so This works fine when everything is well. But I am wondering how to agree on disconnects in such a network. (Sadly something the article does not go into). It is relatively easy if one client goes down. Just give every client a timeout, and if a client does not respond for a certain time, it is removed from that client. However, how should the system solve a case in which one client does not respond to another, but still responds to all others. In such a system the following could happen, resulting in a invalid state Of course this can be solved by giving one of the clients some kind of "master" role. It being the only one that can decide whether or not to disconnect other clients. But I'm wondering if it can be achieved in a pure p2p network. Note I realize this case is not one that can likely occur "naturally". But I want to prevent players from being able to ruin a networking game for others by playing a trick like this by using the firewall for example.


TCP Slow Start in Network Games I'm getting latency issues in bandwidth intensive level transitions part of my game that are proportional to the distance to the server. I believe I'm hitting TCP Slow Start issues. It's also fine when I spam level transitions in quick succession but the problems re appears. Note that I'm not breaking the TCP connection. Effectively the transfer rate of my game is very bursty and remote users are experiencing a high latency (0.8 second) during these events. Some of the data I need to send during these bursts are dynamic so I can't pre exchange it. Is there anything I can do to mitigate the problem? Sending dummy data to keep the TCP window size is pretty much not a solution. All the data needs to be received in order so UDP isn't really appropriate here.


Lightwight cross browser library for server side push? I am looking for a lightweight javascript library that allows the server to push update information to the client reliably and regularly. We use a fixed turn time of 300ms and often there are only about 20 bytes of changes. So doing polling using XMLHttpRequest would imply a huge overhead (3 way tcp handshake, http request headers, http response header). There area number of alternatives, but they have limited browser support streaming lt script gt tags in another frame (does this work on IE?) MIME multipart x mixed replace responses (Firefox, Safari, Opera only?) WebSockets (removed from recent beta version of Firefox and announced to be removed from Opera 11 because of security issues) Server sent events (only Opera?) Java Flash relays (requires the users to have those plugins installed) Polling using XMLHttpRequest (huge overhead) Is there a website which has recent information on which technology works in which browser? Are there javascript libraries which provide a common cross browser interface that hides the messy details? (Yes, i know that it still requires me to write multiple server sides, but that is rather easy. And more important it is easy to write automatic tests for the server sides).


How do multiplayer servers handle receiving, handling, and sending packets? I want to make a fighter jet simulator game. The server (authoritative) and client communicate over udp. The server sends out updates about the gamestate at a fixed rate. Think of plane positions, speeds, rotation, basically anything to do with physics. On demand, the server sends out packets for spawning bullets and applying damage. So this is not at a fixed tickrate. This is done to sidestep the problem of superbullets and syncing fire rates with tick rates entirely. This class of packets also include chat messages. How do I go about implementing this? I am using c c , programming raw sockets. I am running into the issue where the recvfrom function is blocking. I can set it to non blocking using fnctl, yes, but that spams error messages because sometimes there are no packets waiting to be handled (I could handle it but egh, inelegant). Ideally I would like to prevent multithreading, but given that there seems to be no native event driven or interrupt driven way of receiving packets it seems I need to do that. How do other game servers, like quake arena, set up their threads? My idea Main thread calculates game state, sends out packets at a fixed rate 1 child thread for listening for new packets (recvfrom loop) If the incoming packet is a quot i am shooting quot packet, it performs checks, and broadcasts to every client that a bullet has spawned. It adds the bullet to the world, and the main thread will calculate the continued trajectory in the next or current tickcycle, using the time difference and initial spawn data. if the incoming packet is a chat message, perform checks and just broadcast it across clients. if the incoming packet is any other kind of packet, put it in a queue for the main thread to handle (the queue is mutexxed) Is this how I should make the child and main communicate?


Game Networking Client request or Server Sending I'm trying to implement a basic client server setup for my game. But what confused me was how I would approach sending updates. Would I do Server has a tickrate, let's say at 20ms. Each tick would sends an UDP package to EVERY connection with the current game state and it's entities. OR Client request an update from the server and the server respond with the update. When the client receives it, it asks for another update and so on. Pro cons Con Sends a package every tickrate and in this case 20ms. What if a clients broadband connection has a triptime at 300ms? Wouldn't that overload that client and his broadband? Pro Consistent and fast? Con Requesting is done via TCP which is slower because the client has to wait before sending the next request. Pro no overload? So my question would be, what I'm I missing and how would I approach sending updates about the current game state? Cheers!


How to properly handle sending arrow key movement data to a authoritative server? I've made a little C server which receives UDP packets and shows me the incoming information. I want to make an authoritative server in C which simulates character movement and interaction in a 2D real time world and sends information back to a Unity game client where the information is then represented. My question is How does my server know how long a button is pressed in real time (example right arrow key to move character right)? My guess is that the client would send a UDP packet to the server on key press saying move this direction. The server would then simulate the character moving and new positional information is constantly sent back. When the Client releases the key a new UDP packet is sent to the server saying the movement key has been released thus stop moving this direction. BUT the problem is UDP unreliability and the lag between letting the key press up, and the server knowing that the key press is up which would make the character keep moving for a period of time after letting go of the key is this solved with proper movement interpolation?. Any ideas or information sources how to properly handle sending arrow key movement data to a authoratative server?


Components in a client server network game? Behavior and logic are executed on the server. The clients are mostly for rendering, audio, and gathering input. It looks as though most of the a components architecture benefits are only realized on the server. Is it still beneficial to design the client with an component based architecture? Or is there a different approach that better fits a client.


Implementing an online database I'd like to get into online games programming. I thought that as a start i'd be a good idea to implement an online database that would store the progress and score for a game i have made, i'll probably want to implement an account system too. My issue is, i can't see to be able to ask google the right question. I don't know where to start. I've touched some on SQL and PHP, HTML and XSL, but, to me they're just languages, i can't see the big picture, how do these things connect to form a working service? I'm not looking for a solution, i just don't know what should i learn. I'm not looking for knowledge on sockets, i'm familiar with network programming, i just don't understand the "modern" process of handling databases. I'd be very happy if somebody could lay out the structure of a database, how you put it out on the web, how you access the information and change it (not in a direct solution, just "this is done by programming a filter in SQL"), what languages are used for it, etc.


Online convertible board game that is not online but based on multiple players I'm wondering how a system can be made compatible with networking operations (client server). By saying quot networking operations quot I mean a system that can handle online operations, multiple user interactions and client server processes. For example, in programming term, lets imagine we created a Board class for our awesome board game and this game is played with multiple players but we don't know how to make this game online (This Board class to be online for multiple users) since we don't know how to convert our board game to online, we decided to make the board game be able to convertible to online board game. For example, you made this game and posted to github.com and someone found your game very interesting and said quot I want to make this online with a game library or engine quot . In that case, the first (positive, good) scenario is that the person that wants to make this game online will say quot Yeah this game's codes can be converted to online so I can do it quot and the second (negative, bad) scenario is that the person will say quot This game is quite nice but the codes are as terrible as that cannot be converted to online quot So if we want first scenario to happen, we have to make the codes convertible to online. But I don't know what the requirements are and how to achieve this. But I have a theory. My theory the board class that represents whole game must be convertible to JSON to transfer the board from server to client or from client to server. So the board that is in client can easily be synchronized with server's board by JSON data transferring. So my board class must represent methods like named quot getBoardAsJSON(), toJSON() quot so the JSON data that is obtained from the board can be carried to client and to server. My questions are What fundamentals, features are needed for my board game to be able to converted to online? Is JSON convertible feature enough for my board game to be online?


Should I use threads to check sockets for multiplayer game? In a multiplayer game does the code to get send info from to sockets reside in the game loop or does it belong in its own thread?


Any good web frameworks for asynchronous multiplayer games? I'm trying to craft a site for web based (original) board games, and my client (currently written in Actionscript, but that's highly fungible) works fine I can play solitaire games in the client but it has nothing to connect to. What I'm looking for is a server framework for handling accounts authentication and game tracking something that would let players log in, show them a list of their current games, let them invite friends to new games, let them make moves in the games they have open, etc. I'm flexible on language obviously I'm going to have to write a lot of server code to handle the actual game logic, but that should be straightforward enough. I'm more concerned with how to handle the user (and game) DBs, though suggestions for a good server framework for communicating with the DBs (and serving up, most likely, JSON for client communications) are also welcome. Right now my leaning is towards Ruby (probably with Rails) but as far as I can determine it would be a pretty good chunk of effort to set up the necessary databases, so having something automagically handle that or even just having a good example project that I can check out for a how to would be really useful to me.


Secure login for a game that is open source I am making a game which i will be open sourcing. Its a simple arcade like game but requires a network connection because it is meant to be played with other people. The thing i am worrying about is how would i be sure that the client is the one that i put out for the end user to play with? Kind of a like of sv pure for Team Fortress 2. I was thinking of different ways to combat this such as the server requesting the client's version or even it's md5 hash but people with simple java knowledge could just force a method to always return what the server wants.


Sending changes to a terrain heightmap over UDP This is a more conceptual, thinking out loud question than a technical one. I have a 3D heightmapped terrain as part of a multiplayer RTS that I would like to terraform over a network. The terraforming will be done by units within the gameworld the player will paint a "target heightmap" that they'd like the current terrain to resemble and units will deform towards that on their own (a la Perimeter). Given my terrain is 257x257 vertices, the naive approach of sending heights when they change will flood the bandwidth very quickly updating a quarter of the terrain every second will hit 66kB s. This is clearly way too much. My next thought was to move to a brush based system, where you send e.g. the centre of a circle, its radius, and some function defining the influence of the brush from the centre going outwards. But even with reliable UDP the "start" and "stop" messages could still be delayed. I guess I could compare timestamps and compensate for this, although it'd likely mean that clients would deform verts too much on their local simulations and then have to smooth them back to the correct heights. I could also send absolute vert heights in the "start" and "stop" messages to guarantee correct data on the clients. Alternatively I could treat brushes in a similar way to units, and do the standard position velocity client side prediction jazz on them, with the added stipulation that they deform terrain within a certain radius around them. The server could then intermittently do a pass and send (a subset of) recently updated verts to clients as and when there's bandwidth to spare. Any other suggestions, or indications that I'm on the right (or wrong!) track with any of these ideas would be greatly appreciated.


What is involved in creating a real time multiplayer platformer game? I'm creating a platformer game that has a "co operative" feature which I'd like to work over networks the internet. Now I've read up on network game programming including articles like What every programmer needs to know about game networking and so I understand the difference between techniques like Peer to Peer lockstep and Server Client prediction architectures I've concluded that for any real time game that is going to be played over the internet, Peer to Peer lockstep simply isn't an option. I'm also concerned that even for a platformer a simple client server architecture (without some sort of client prediction) would result in degraded gameplay due to the delay between action and reaction caused by a round trip to a server. (Having said that I want to eliminate the need for a central server, and so only one of the players, the client, will actually experience this lag). This leaves client prediction, but even for a simple game like a platformer this still sounds pretty complex. How would I go about creating a working client predictive system for a multiplayer platformer game?


4 player arena game networking model dedicated servers? So my question is not technically limited to 4 player games, but there has been a lot of games on steam lately (brawlhalla, duck game etc) that seem to be quite popular lately. My question is, are these games hosted on a separate server, or do one player host the game, and the game developers just providing a match making service? If it's hosted by one of the player, how do they get around with NAT issues? If hosted by some server somewhere that sounds like it's super expensive to run? Also, for these games, what kind of networking model is "standard"? Are there any articles about this I can read?


Sending state diffs (deltas) and unreliable connections We're building a realtime multiplayer game, in which each player is responsible for reporting its state on every iteration of the game loop. The state updates are broadcasted using unreliable UDP. To minimize state data sending, we've come up with a system that will send only deltas (whatever state data that was changed). This method however is flawed, since a lost packet will mean that other players will not receive the delta, making the game behave in an unexpected way. For example Assume that state is comprised of positionX, positionY, health Frame 1 positionX changed gt send a packet with positionX only. Frame 2 health changed lost ! Frame 3 positionY changed gt send a packet with positionY only. Other players don't know about health change. How can one overcome this issue then? sending the entire data is not always feasible.


Networking with UDP, should I keep sockets open on the server I am working on making a 2D platforming game that will have multiplayer functionality. Over the last few days, I have done a lot of reading regarding how to deal with the networking, and believe that I am on the way to implementing some of the concepts I have read about. I have decided to go with an Authoritative server client model, where multiple clients will send actions made by the user to the server, client will predict the players next steps before comparing against the Authoritative reply from the server, etc. This seems to have been suggested in numerous corners of the web regarding games networking, and seems reasonable. Before jumping straight into trying to get snapshots sent from the server, I wanted to make sure that I had an idea of some of the technical nuances of a language, as conceptual knowledge can only get me so far. I have set up a simple Echo Server that has worked rather well for a single client, but now my next step is to have multiple clients connected to the server at a single moment, and have each message that is sent from a client echoed to all clients connected to the server. I feel that the answer might be language dependent, so I will mention now that currently I am using Java for the networking (a little bit of preliminary testing may suggest that Java has significant overhead in its network implementation, so I am open to change upon suggestion). I am using UDP for speed sake (and this seems to be what is predominantly suggested). My question is with the server, should I be keeping each DatagramSocket that represents a connected client open and send DatagramPackets directly out without ever closing them (until the program terminates, client disconnects, etc.), and have them stored in some form of Collection, or should I close them after each message is sent and create a new outgoing socket whenever I need to send a packet? There are obvious performance disadvantages of creating a socket whenever I need to send a message, but is there some fundamental reason that I have not come across that suggests leaving sockets open is not a good idea?


Algorithm for smoothing a network object's movement We are building multiplayer game where there's no central server managing the game. Each player is responsible for sending out its state to all connected players. In addition, all clients run prediction between received packets, to keep all objects moving in between state packets. We also smooth out the positiobs received from remote clients, for example in scenarios where the received oosition is small enough and should be moved smoothly from the current predicted position. The issue I am trying to handle is how should the algorithm behave in case it hasn't finished smoothing out the position yet, and a new state is being received? The smoothing algorithm currently operates for a given configured duration (e.g 80 ms). Should a new incoming state cancel the ongoing smoothing? What is done in such cases? One option is to never reset started smoothing, that is, run for the whole 80 ms, but update the target position in case new state is received. Another option would be to reset (start the 80 ms count all over again. This time with the new start end positions). Both options have their issues. I am wondering whether there's a formal way to deal with this.


How can I handle sharing storage units in multiplayer? I have recently come across a certain problem in programming my MMORPG the synchronization of shared storage units. With shared storage unit I intend something like a "chest" that can be accessed by multiple users. Any user can take items from it or put items in it or even move items around and merge items stacks in the chest. To get the idea, think about the guild chest in WoW. At the moment my approach with non shared storage is to apply any transaction on the client (move split merge they take place instantly on the client) and then communicate to the server the change which also does validation and stuff. This works just fine it's rather impossible that one client issues a transaction that would conflict with another of its transactions as he always sees an updated state of the storage (because he she is the only one issuing transactions on that storage). How do you keep a storage synchronized among its co owners when they share a storage unit and therefore can issue conflicting transactions? For example two players issue at the same time a move transaction of the same item. An approach I was thinking about is scratching client side prediction for shared storage but that adds some overhead to my work as clients at the moment are not aware (code wise) that a storage unit is shared. Is there a smarter way to do it?


NodeJS client gameloop running slightly faster than server gameloop So I'm working on a real time multiplayer game in NodeJs (Client and Server). Both loops handle the same "physics" (movement at a constant rate) and both are running at 40hz or 40 times per second. I am using setInterval on both client and server with a delay of 40ms. The issue is that my server average delta between each tick is 41 and my client average delta between each tick is 40. This leads to results like this See in the last result, there is a difference of 46 ticks meaning the client is rendering about 1.8 seconds ahead of server time. My first guess on solving this is to sync the client every so often but that would lead to it "teleporting" backwards quite often due to how much it is desyncing.


I'm making a networked game for mobile. Should I worry about cheating? I'm in the process of making a racing game for Android iOS. I'm thinking of implementing a server client model, should I worry about cheating and make all players communicate with a server of mine, or will I be good by letting one of the players host the game? I'm not sure how much memory editing or packet editing is possible in Android iOS, and that's the main reason why I'm asking this.


keeping clients up to date with server state in an mmo like game I'm making an online RPG that could classify as an MMO, but I'm keeping the project scope very small by making the game's systems simple, and focusing mostly on what I want to learn real time networking. The problem I'm facing is that that I don't want to update every player about every other player, all the time. This is a huge waste of bandwidth, and may even be impossible without a really beefy connection. My solution is Keep track of which entities are in the client's visibility range Send a "full entity state" packet when the client enters the world Send a "create entity" packet for any entity that enters the visibility range Send a "delete entity" packet for any entity that leaves the visibility range Send a "update entity" packet for any entity that updates within the visibility range I don't like the fact that when the client moves, I have to update the list of entities it can see, because it means I still have to loop over every entity. Is there anything better? Can this solution be improved somehow? If so, could you provide further reading, or possibly even sample implementations?


Why do games use tick rates in their networking and servers instead of an event system? Why do most games limit themselves with a tick rate in their networking? Isn't it better to make something like an even system where for example client A does something then the client sends related info to the server, and same for the server when something happens on it it sends a packet to the client, instead of using a tick rate and sending information only at some specific frequency. Is it cheaper faster to send more data in a single packet or? And the same question goes for server tick rates, some servers limit themselves on specific tick rate frequencies, why do they do that? Why not just make a loop and run each tick after each other instead of having a gap between them or risking one tick to take longer than it should and causing bugs? What's the benefit of the tick rate approach for servers and for networking?


Multiplayer online game engine pipeline I am implementing online multiplayer game where client must be written in AS3 (Flash) to embed game into browser and server in C (abstract part of which is already written and used with other games). Networking models may differ from each other, but currently I'm looking toward game's logic run on both client and server parts but they're written on different languages while it's not the main problem. My previous game (pretty big one was implemented with efforts of 5 programmers in 1.5 years) was mainly "written" within electronic tables as structured objects with implemented inheritance was written standalone tool which generated AS3 and C (languages of platforms to which the game was published) using specified electronic tables file (.xls or .ods). That file contained 50 tables with 50 rows and 50 columns each and was mainly written by game designers which do not know any programming languages. But that game was single player. Having declared problem with my currently implementing MMO, I'm looking toward some vast pipeline, where will be resolved such problems like game objects descriptions (which starships exist within game, how much HP they have, how fast move, what damage deal...) actions descriptions (what players or NPCs can do attack each other, collect resources, build structures, move, teleport, cast spells) actions are transmitted through server between clients influences (what happens when specified action applied on specified object, e.i "Ship A attacked Ship B field "HP" of Ship B reduced by amount of field "damage" of Ship A" Influences can be much more difficult, yes, e.i. "damage is twice it's size when Ship has 5 allies around him in a 200 units range during night" and so on. If to be able to write such logic within some "design document" it will be easily possible to let designers to do their job without programmer's intervention or any bug prone programming validate described logic transfer (transform, convert) to any programming language where it will be executed Did somebody worked on something like that? Is there some tools engines pipelines which concernes with it? How to handle all of this problems simultaneously in a best way or do I properly imagine my tasks and problems to myself?


Character appearance synchronization in open world multiplayer game I am working on a multiplayer open world game where you can equip handhelds and armor pieces. In my architecture, there are clients and an authoritative server. Every equipable item is crafted by a user. They can be different in shape, so it's important that I synchronize shape information. This is expensive data to send (basically an outline plus some more info). Together with this, I also want to synchronize any equipment event that occurs, so when a user meets another user, they can see each other's gear. The easiest solution I've found is to force send gear on equipment, but it will use bandwidth even when two players are far away. This feels like a problem that has been solved a thousand times, so I don't want to reinvent the wheel. Do you know of any best practice known strategy that suits my situation?


Solution for lightweight LAN peer discovering? I built a library for purely cross platform programming. My games made with it run fine in Android , Pc, Linux, Mac etc. The networking capabilities are provided by ENET library, therefore all communication between my apps is not TCP or UDP compatible, but only in the custom protocol, even tough its based on the UDP ultimately. I don't think its possible to do what i want with ENET, thats why I ask here for help! Lets say I have the same game running in my Android phone, my laptop and my pc. They are all in the same wifi network, and therefore in a LAN, whether its Wifi hotspot(?) or the household router. I need each of those 3 peers to discover the other two in the network. This is meant only to find the IP of alive apps in the LAN network, to be able to host multiplayer games between them. I can only think of one effective way to do this, UDP broadcast, wait responses, but if that is the solution, i need something small, since its the only purpose of the implementation. Other way could be to try to connect to all IPs in the LAN address subrange, but I don't think the OS would be with me on this one p


MMO sending player position to other players When it comes to sending data to a player in MMOs, is this what the server is basically doing? (pseudo code) every gametick for each player connected compile string of positions of all other players in range if string different lastString send data to player set lastString to string


Game engine that allows for objects being placed in game I am looking for a game engine with multiplayer support that allows for players to place objects in the terrain. (eg. in TF2 one can place teleporters, etc... or in minecraft one can place blocks). I don't need the placeable objects to be interactive like in TF2, but I just need an engine that won't make me code this from scratch. I have decent knowledge of Python, PHP, HTML, C and C (and a small knowledge of Lua scripting, although I have only been at it for a few months) so I should be able to handle most engines. So far I have looked at UDK and Cryengine, and wasn't thrilled with either.


How do I efficiently send RTS unit selections over the network? I have a multiplayer RTS game with every unit assigned an ID. How can I efficiently send across a network the units selected by a player? For example, Starcraft 2 has upwards of 200 units per player and each player can select a maximum of 255 units at a time. How can I implement such a system with reasonably low response time and bandwidth? Should I bother sending IDs? Should I perhaps send a bitmask with each bit defining whether each unit is selected?


How do I prevent identity spoofing in a multiplayer game? I'm thinking about clients spoofing IP addresses, tricking other clients that they are the server that sort of stuff. (I don't know much about this, so if this is completely wrong, please correct me.) What should I do to prevent this? Because it is a real time game, if I were to use encryption, I would use something fast and secure like RC4. Should I encrypt packet data with a key, that the server gives to the client? If it makes any difference, I'm using UDP.


Multiplayer network architecture why do we need to verify local movements? I'm messing around with a 2D game using UDP. I've read some books and articles on the logic of a dedicated server to clients multiplayer game and I can't wrap my head around one thing What I've read When Client 1 moves, it sends it's input to the SERVER, the SERVER calculates the position, and then sends the new position back to all connected Clients, including Client 1 where the Client 1 player is drawn in the new position. Wouldn't this create a big amount of latency between the local player of Client 1 and their movements? How I think it should work My question is, why not just move the local player based on the movement, and send the new position to the SERVER every time it moves? That what we you press a movement key, it's instant, instead of having to be calculated by the server and sent back and THEN moved. NOTE I'm not worried about anti cheating verification


Check if the vector is behind another or maybe opposite directions? I'm doing a network game and on the client side, i interpolate the client position with the server sent extrapolated position. The client has its own physics simulation wich is corrected by the server in steps. The problem is when it laggs and i 'kick' the ball, the server gets a delayed message and sends me the position backwards of the client position wich makes the ball goes back and forth. I want to ignore those and maybe compensate that on the server, not sure though. The problem is the clock difference on those case are 0.07ms or 0.10 ms wich isn't that high to ignore the message i guess. When i get the server position, i extrapolate with the clock interval serverBallVelocity Can i check if my new ball server position is behind my actual ball vector position? I tried to use the dot product after normalized the two vectors to check if they are opposite but it ain't working properly. Any suggestions on checking that?


Do I need to implement IPv6 support for my game? I'm going to implement network features for the game I'm currently working on, now I'm wondering if I need to implement IPv6 support or just having support for IPv4 is enough?


Online RTS Game Architecture for Mobiles We came up with an idea for a real time strategy game for mobile devices that can play with other players over a network. I'm trying to plan out the architecture protocol required for such as system. Some other related questions (1,2) mention that P2P is the way to go for RTS games. The problem is that most mobile phones cannot open TCP ports to allow incoming connections, so a central server would be required to relay messages between the players. Another issue that is mentioned on the linked questions is the difference in floating point operations and random number generators, etc among different platforms (Our game would run on iOS and Android for example) so running the game simulation on each device may not be optimal. I could run the game simulation on a server and have it broadcast updates, but simulating broadcasting up to 200 units per game would be quite expensive especially when multiple people are using the same server to play games. The server's performance might drop significantly with more than a few hundred people using it. I'm currently thinking the central server would be the best method, but would require a lot of server power. I'm looking for any suggestions on a architecture protocol that would work for this game and any insight on the issues I mentioned with existing protocols.


How frequently do my game server need to message the client? I am writing a game server and a game client. In the client there is a game loop that has a delay of 16ms (because that would be nearly 60fps). All the logic is at the time handled at server side so I need to send the latest frame to the client every 16 ms. Is this a good solution? I know that I probably have to do some game logic at client side just to smooth things out but this is an early version. Is it possible to make the server send frames to the client each 16ms? Each client is handled in different threads (or actors, as the server is written in Erlang).