_id
int64 0
49
| text
stringlengths 71
4.19k
|
---|---|
31 | 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. |
31 | 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? |
31 | 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! ) |
31 | 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? |
31 | 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. |
31 | 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? |
31 | 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). |
31 | 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. |
31 | 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? |
31 | 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? |
31 | 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. |
31 | 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? |
31 | 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? |
31 | 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. |
31 | 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 ) |
31 | 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! |
31 | 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). |
31 | 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! |
31 | 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? |
31 | 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? |
31 | 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? |
31 | 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 ) |
31 | 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? |
31 | 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? |
31 | 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. |
31 | 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 ? |
31 | 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? |
31 | 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. |
31 | 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. |
31 | 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? |
31 | 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? |
31 | Can packet latency fluctuate? Can the time it takes for a packet to be transmitted from a client to the server fluctuate? |
31 | 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 |
31 | 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) |
31 | 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? |
31 | 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? |
31 | 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? |
31 | 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! |
31 | 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. |
31 | 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. |
31 | 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. |
31 | 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? |
31 | 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). |
31 | 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? |
31 | 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. |
31 | 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. |
31 | 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). |
31 | 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? |
31 | 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! |
31 | 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? |
31 | 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. |
31 | 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. |
31 | 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? |
31 | 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? |
31 | 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. |
31 | 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. |
31 | 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. |
31 | 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? |
31 | 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? |
31 | 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. |
31 | 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? |
31 | 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. |
31 | 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? |
31 | 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. |
31 | 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. |
31 | 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? |
31 | 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? |
31 | 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? |
31 | 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? |
31 | 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 |
31 | 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 |
31 | 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. |
31 | 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? |
31 | 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. |
31 | 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 |
31 | 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? |
31 | 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? |
31 | 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. |
31 | 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). |
31 | Acknowledgement reliability using UDP I have a question about UDP. For context, I'm working on a real time action game. I've read quite a bit about the differences between UDP and TCP and I feel I understand them quite well, but there's one piece that has never felt correct, and that's reliability, and specifically acknowledgements. I understand that UDP offers no reliability by default (i.e. packets can be dropped or arrive out of order). When some reliability is required, the solution I've seen (which makes sense conceptually) is to use acknowledgements (i.e. the server sends a packet to the client, and when the client receives that message, it sends back an acknowledgement to the server). What happens when the acknowledgement is dropped? In the example above (one server sending a packet to one client), the server handles potential packet loss by re sending packets every frame until acknowledgements are received for those packets. You could still run into issues of bandwidth or out of order messages, but purely from a packet loss perspective, the server is covered. However, if the client sends an acknowledgement that never arrives, the server would have no choice but to eventually stop sending that message, which could break the game if the information contained in that packet was required. You could take a similar approach to the server (i.e. keep sending acknowledgements until you receive an ack for the ack?), but that approach would have you looping back and forth forever (since you'd need an ack for the ack for the ack and so on). I feel my basic logic is correct here, which leaves me with two options. Send a single acknowledgment packet and hope for the best. Send a handful of acknowledgment packets (maybe 3 4) and hope for the best, assuming that not all of them will be dropped. Is there an answer to this problem? Am I fundamentally misunderstanding something? Is there some guarantee of using UDP I'm not aware of? I feel hesitant to move forward with too much networking code until I feel comfortable that my logic is sound. |
31 | POST HttpRequest doesn't send any data I've some trouble for sending a post request to my nodejs server. I can receive data from the server with GET method, but when I try to send data with POST, I've an empty bracket on return on this function func on request completed(result, response code, headers, body) var json JSON.parse(body.get string from utf8()) print(json.result) print(response code) And empty bracket on my JSON console.log on the server too. My code extends CanvasLayer func ready() HTTPRequest.connect("request completed", self, " on request completed") func on Button pressed() var data "name" "Godette" make post request("http localhost 8080 ", data, false) func on request completed(result, response code, headers, body) var json JSON.parse(body.get string from utf8()) print(json.result) print(response code) func on HTTPRequest request completed() pass func make post request(url, data to send, use ssl) Convert data to json string var query JSON.print(data to send) Add 'Content Type' header var headers "Content Type application json" HTTPRequest.request(url, headers, false, HTTPClient.METHOD POST, query) And this code return this in my console 200 Thanks for help ) |
31 | 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. |
31 | Quake style snapshot system for an MMO? I'm making an MMO style game in my spare time for kicks, I've been researching more and more into networking for video games and I've mostly been learning about Quake and Sources networking implementation where they have an authoritative server with a snapshot system where the client receives snapshots that reflect the current state, and the clients will send their input to the server and the server will simulate the game, etc. Is this what most MMO games use in terms of their networking? I ask this because as I'm implementing it, it seems very expensive if you want a lot of players , whereas the networking architecture seems more like it was designed for Quake or Source games where it's mostly shooter type stuff where you only have maybe 10 players at a time, sometimes you have 30 or so. To elaborate here, I mean that having even 10 players it costs a lot to send snapshots back and forth in terms of bandwidth, it can pretty quickly add up to megabytes. Is this normal? Is this expensive? I don't do a lot of network programming so I'm not particularly sure what is cheap or expensive in terms of bandwidth. I've currently implemented most of this system, though I've added regions so that the world is split up into multiple areas so that entities in region A don't care about the events, particles, and other entities, etc. in region B or C, D, and so on. |
31 | 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. |
31 | Is it feasible for a Server to send nothing more than a tile based area to a Client? To start, I have a good amount of background in networking (hardware, routers, ex.) but very little knowledge past the basics of network programming. This may seem like a stupid question, but I want to know what I am getting myself into while fathoming the implementation of multiplayer in my game. I am creating a tile based world, which is generated through a simple 2D Array. Let's say something like World 100 100 , for simplicity's sake. Currently, the render method only renders the tiles based on the resolution of the window, plus one tile (for smooth rendering during movement.) No matter how large the world is, (10x10, 1million x 1million) the rendering is flawless in performance. The gameplay needs nothing more than to know what is in the currently visible (rendered on screen 1) and at the most possibly SOME information of tiles in an area around the player. So anything more sent by the Server wouldn't be the full tile information. Ex. Items laying on the ground, ground type, trees, etc. would not be important in the area outside the player's view, but would only be what the Client Player needs to know about in those tiles. (Ex. Ultima Online's 'incoming names' where players could know a Character player or monster was just beyond the tiles in their rendered view.) I do not know very much about networking, so perhaps as I learn this might answer my question. However, I am curious if this is a feasible solution or if the idea is simply laughable. The information being sent would be about a 10x15 area of tiles, and each tile holds information about what is on the tile. More efficiently, everything would be an Object, where the tile holds all the Objects on the tile. Ex. Tile 4 4 holds Sword 23452, Rock2, Tree5, Player3, Monster4. Empty tiles would send nothing more than terrain type Grass, Sand, Water if not already loaded during Initialization Load. Some tiles would have a handful of objects Tree2, Sword 924, Gold, Corpse, Rock3 . So I cannot imagine that a tile would have very much information to send to the Client from the Server, since the Client mainly only needs to know the Texture that needs to be loaded and Position to place it on screen. Position being only two integers and Texture being one integer for a list of files to tell the client to render. At the craziest, the Server would have to send 150 tiles with information of only a handful of Objects OnLOAD, and from then on update only changes to tiles (if any) and any new tiles (10 to 15 everytime a player moves in a direction) and the direction of movement for characters on screen (so the client can simulate smooth movement between tiles). I assume I am correct in thinking this is an incredibly low amount of information being sent over the internet or between peers, so it should have little problems with performance even over laggy connections? Or am I so ignorant of networking that my mind will be blown when I finally get around to opening up my book on multiplayer networking? If it is a very low amount of information being sent between Client Server, would it make more sense to simply load the entire World on Initialization? Or 'Map' if the World is excessively large. And then after LOAD, send only tiles which are updated? I am still pondering how I should specifically deal with data. The book I am using as reference wants me to have a Linked List, where I add and remove objects, so everything is a bool. "Is there a Character? Is there a Tree?" I was thinking of a different approach, such as a container which holds objects, and Server logic that sends only what is required to tell the Client what to render. Possibly with objects that hold networking information within itself, which is sent out when called for by the Server. |
31 | How can I support direct P2P for mobile devices? I'm Interested in two or more player co op in Godot, via direct P2P without connection to a central server. I have this idea that would utilize two smartphones in proximity to one another. I don't know an awful lot about Bluetooth or networking so please explain simply. |
31 | Is RPC Safe and what is security layer of RPC? We're creating a MMO and I wonder is RPC safe or not ? Isn't RPC easily hackable by injecting to client and what is the security layer of RPC on Unreal Engine ? For example a player is walking and sending that information (new position, rotation etc) to other players, can't that player change movement speed or position with injecting ? What is validating is that movement is valid or it was a hack ? I checked on Google but didn't get answer for my questions. Thanks o |
31 | Real time Debugging Techniques There's nothing quite like the routine of tweaking a variable, compiling code that takes a few minutes, executing the code, realizing that your tweak was in the wrong direction and repeating the process all over again. I would like to start interacting with my game logic while a session is in progress. What are some of the ways you've handled doing this? I would be open to hear solutions for iOS, C C and C XNA. |
31 | Fair dice over network w o trusted 3rd party Though it should be a pretty basic problem, I did not find a solution for it How to play dice over a network without a trusted third party? The M players shall roll N dice, one player after another. No player may "cheat", i.e. change the outcome to his advantage, or "look into the future" before the next roll. Is that possible? I guess the solution would be something like public key crypto, where each player turns in an encrypted message. After all messages were collected you exchange the keys to decode the messages. Then the sha1(joined string of all decrypted messages) mod 6 1 is used to determine the die. The major problem I have since the message c s hould be anything, I don't know how to prevent tampering with the private keys. Esp. the last player to turn in his key could easily cheat (I guess). The game should even stay fair, if all players "conspire" against one player. |
31 | What's the performance benefit of saving all logged in characters in MMOs in regular intervals? The majority of MMORPGS have a Worldsave system that will save all the characters once every X hours. I guess the reason is performance. So why is this better, performance wise, than saving a character on disconnection? |
31 | How do I synchronise real time moves of players on a grid? I'm working on a real time game based on a grid. Each player can move a single square at a time. A server tracks the game state and notifies clients of changes. It's possible for two players to make a conflicting move, such as attempting to move to the same square. How can I fairly resolve such conflicts when they happen? My current approach is First come, first served When the server receives a move, it immediately updates the game state to reflect that. It then discards any conflicting moves it receives later. The problem is that the moment a move was received does not necessarily line up with moment it was sent. Players on a faster network connection will always have an advantage. How can I deal with this? |
31 | Implementing game synchronization between clients and server I'm creating a small online multiplayer game where I have multiple thin clients and an authoritative server. Both the client and the server have a fixed game loop. Now I have a game entity with the following properties X position float Y position float Direction float In the client, the entity is in constant velocity changing its direction based on user input and sends an input event to the server. LEFT, PRESSED Entity moves to the left LEFT, RELEASED Entity moves to the right Every event is queued on the server, and simulated the same way as on the client (calculating the new properties based on trigonometric functions) and the event is send to other players in the room. The other players apply the same simulation to that particular entity (keeping track of what key is pressed for each entity). Now after some time playing, the position and direction start to drift and stop being in sync. I suspect this has to do with floating point arithmetic(?) Is this implementation correct, rather than sending its position and direction every step? How would I solve this problem? I think I need to make the server the single source of truth and send regular state snapshots to the the clients to correct possible mistakes drifting? What would be a good interval to keep the clients up to date? At the moment, I'm broadcasting an event to every player in the room. What would be a nice approach to only send events to players near the entity? Would a quadtree work here (the same I'm using for my collision detection)? |
31 | 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. |
31 | How do games have low tick rates without causing input lag? For example, Minecraft. It updates the gamestate at a rate of only 20 second. And from what I've read, these multiplayer games do the same with their network communication, sending updates at that same speed. So it sounds like the entire game is, internally, running very slow (ignoring the render interpolation to not appear slow). But what I don't understand is how player input doesn't feel laggy as a result. If player input was only being sampled 20 second, you would feel the delay. But that isn't the case in Minecraft, it is extremely responsive. I assume that means player input is being sampled as fast as possible, at renderer speed. But that means the game is gathering input way faster than it can use it. If it updates the gamestate and talks to the server 20 times in a second, but gathers 200 input samples in that same time, how does it handle that? Is it perhaps just faking it locally, taking the latest player input and interpolating the renderer with it to appear responsive, even though that input isn't actually being used anywhere in the game? How does it decide which particular input sample to use when it's comes time to do a gamestate network update without losing information? I don't understand how to resolve the conflict between having too many input samples to use, and having input feel too slow. |
31 | 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? |
31 | Should damage calculation in a competitive multiplayer game be done client sided or server sided? I'm interested in creating a moba style game like League of Legends and need help with a situation. More exactly I have an item that gives the player 50 Attack Damage or an ability that does 50 Attack Damage. Is the information about how much damage the items champion abilities do kept in client side of the game or the server. Option 1 I hit the enemy and the client tells the server to deduct 50HP from the enemy i hit or Option 2 I hit the enemy and the client tells the server only that I hit the enemy, then the server looks at the item I have ability used and based on code on the serves side deducts the 50HP |
31 | Should I consider a cloud based networking solution? In my spare time for the past few years, I have been working on both the front end and back end for a space based online game. This game is initially designed for the PC, and is hopefully able to host thousands of players in a massively playable universe. Along with the development of the game, I have been building the networking solution almost entirely from scratch. The architectural design of the networking solution is based on a fairly traditional master server sub server model. I recently was able to run some fairly decent scale tests on this model and was pleased to see that both my expectations and goals were met. Which leads me to my current fear. The basic idea behind the current solution is that the master server acts as a router. It knows about all of the currently active sub servers, including their load (cpu, memory, bandwidth etc) and what the sub server is assigned to handle. The master server has literally no other purpose. Each sub server is designed to handle one (or more) solar systems. The idea being as a player, you connect to the master server and tell it which solar system you want to go to. The master server looks to see if there is a sub server already assigned to this solar system and sends you there, otherwise it finds the sub server with the least load and assigns that sub server to the solar system before sending you there. The part that I am worried about is that this is pretty much as much as I can get out of this model. Once you have been sent to a solar system, you (and everyone else in that solar system) are on that sub server until you leave that solar system. Although I am happy with my testing so far, and that it looks to be able to handle around 300 fairly active peers, fairly comfortable on a well fitted server, I am worried if I ever end up in the situation where this isn't enough. I discussed this recently with a few acquaintances of mine. The discussion lead to a cloud based network maybe being a better solution than single server machines acting as sub servers. Atmittedly, cloud commputing is fairly unknown territory for me. With that being said I've spent some time looking into this and I am fairly confident with the basics, but I have the following questions I assume that if I were to re design the networking solution to work within a cloud based network, I would no longer need the master server sub server model, since I could build a single application that would handle all solar systems and peers, and that the cloud would scale based on the number of solar systems and peers? Any and all advice is welcome! |
31 | 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? |
31 | Authenticate player on backend server with google login I would like to create a mobile game which communicates with my own backend server. For authentication I want to use google Sign in(https developers.google.com identity sign in android backend auth), so users don't need to create an account. My backendserver uses a TCP connection to communicate with the client and I don't want to send the google login auth code unencrypted over the network. I read alot about SSL encryption, but I'm not sure if it is the thing I need and if this is sufficient. Another question I would like to ask is do I need to encrypt all packets my client is sending to the server. Because when I just do authentication over an encrypted connection, potential hackers could simply perform a man in the middle attack to access the account of a player after they logged in. So what would be the best way to send this token to the server, is SSL sufficient for this and do I need to encrypt the whole traffic my game creates? |
31 | How do I smooth out latency jitter in my netcode? I'm developing a multiplayer game and I'm following some articles I've found online to create an authoritative client server model. Reading this article, Valve says that every time a message is received, the client assumes the "current" time is the time in the latest packet, in the article they state it It is assumed in this paper that the client clock is directly synchronized to the server clock modulo the latency of the connection. In other words, the server sends the client, in each update, the value of the server's clock and the client adopts that value as its clock. Thus, the server and client clocks will always be matched, with the client running the same timing somewhat in the past (the amount in the past is equal to the client's current latency). Smoothing out discrepancies in the client clock can be solved in various ways. And interpolation of remote entities Each update contains the server time stamp for when it was generated From the current client time, the client computes a target time by subtracting the interpolation time delta (100 ms) If the target time is in between the timestamp of the last update and the one before that, then those timestamps determine what fraction of the time gap has passed. This fraction is used to interpolate any values (e.g., position and angles). Now obviously due to jitter, my interpolation looks terrible as I will receive time latency jitter. So my question is, is on this part "Smoothing out discrepancies in the client clock can be solved in various ways." What would be a good way to smooth out any discrepancies? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.