|
||||||||||||||||||
Add Forum to Favorites | Send Topic To a Friend | View Forum FAQ | Track this topic |
Last Thread Next Thread ![]() |
| How to "network" a single-player game effiently? |
|
![]() michaelth Member since: 12/10/2007 From: Nanjing, China |
||||
|
|
||||
| These days,I have tried making a sing-player game to be a network game. Previously,I proposed a cluster-computing structure for network game and I have finished a FPS game based on this structure.However,I am not satisfied with such a application and I need games of more types to verify the feasibility of this cluster-computing structure. Now,I have aquired a source code of sing-player kart-game from internet and compiled it to a windows-version.This game is funny but not enough so that I hope to design a network version for it.The problem is that the primitive engine of this kart game is low-effient and the frames per second reduce rapidly when more than 8-karts appear on the screen.So I wanna design its server to be a cluster-computing structure.And I let ervery sub-server has a copy of the actual Track and part of karts involved. So Is this idea of a high practicality? |
||||
|
||||
![]() Sirisian Member since: 10/5/2005 From: kalamazoo, MI, United States |
||||
|
|
||||
| That doesn't even make sense to have to use a cluster server for an 8 player game. Also what did you expect each server to compute? Cluster servers are used along with spatial partitioning normally to separate the load for certain areas. The server is only computing collisions and such it's not rendering anything. A server could probably support many more players. It sounds like the client is flawed. |
||||
|
||||
![]() michaelth Member since: 12/10/2007 From: Nanjing, China |
||||
|
|
||||
| I means i need some clustering computing technology if the karts' number become large(more than 20 in on track),and it is not a easy problem just like 8-player game.And the previous 3d render(based on openGL) of this game is low-effient so i need a high-effient Render replaced. Furthermore,the physics simulation is't good enough to make the kart's movement and collsion adequately close to reality.Naturally,I want a high-performance physics engine to replace the previous version.I choose Bullet(a open-source library of high performance) to do physics calculation instead because I have some experience programming a FPS game base on it.However,my FPS programming experience tells that simulation within large number of Objects will eat up a big cpu-time.So I have this idea above(divide the server's job to serveral parts for subservers). Now,I have finished a p2p structure-version of the kart game.But it can just hold 6 karts running on it with acceptable FPS(Frames per second). |
||||
|
||||
![]() hplus0603 Moderator - Multiplayer and Network Programming Member since: 6/3/2003 |
||||
|
|
||||
| If you look at a game like Flatout, you will see it do about 20 cars at very high precision, both in rendering and simulation (the physics is very high detail, the destruction model is fine-grained, etc). Thus, you're probably doing something wrong. Now, can you find and fix everything you are doing wrong? If you could do all of that, then you'd be a star game programmer! The trick for you is to figure out what you actually want to accomplish. It sounds to me as if you want to prove some clustering simulation technology. Draw out a goal, saying "cluster technology proven to do X." Now, try to break that goal down -- how do you get to that point? Why can't you say it's proven right now? Then design SMALL test cases that will show the steps from here, to your goal. Combine more and more of the small test cases, without worrying too much about making a nice game, and you will achieve your goal. If your goal is, instead, to make a fun driving game that supports 20 cars, then chuck your cluster, build a new simulation using best practices, and serve it from a single server. |
||||
|
||||
![]() michaelth Member since: 12/10/2007 From: Nanjing, China |
||||
|
|
||||
| Thank you for your intellectual advice although it sounds to me a little frustration. To persue some fresh technology or to make a funny game is always a problem to me .Maybe my goal is always fuzzy.Adding some new technology and generating some fresh results may bring me a great happiness before.But this didn't last so long. |
||||
|
||||
![]() michaelth Member since: 12/10/2007 From: Nanjing, China |
||||
|
|
||||
| Currently,I find there may be a problem for the P2P structure of the Kart game. For my Kart game,if there are 6 players(karts) in 1 track,every player control its own kart on his own machine and the rest 5 karts's running data are got from other players's machines.I just implement such a structure by using udp broadcast and every machine broadcast its own controlled Kart's running data.Consequently, if 2 kart are running closely to each other and the UDP packet arrives with a bigger delay,the 2 machine will have different game result:machine A believes Kart A is the 1st, machine B believes Kart B is the 1st. In my LAN environment,this bigger delay may happens in a little probability but if this game runs on Internet,the problem may become more serious.If a C/S structure has been used for this game,such problem can be easily avoided.However,Is there good trick to solve this problem under Peer to Peer network structure? |
||||
|
||||
![]() hplus0603 Moderator - Multiplayer and Network Programming Member since: 6/3/2003 |
||||
|
|
||||
| The Forum FAQ actually points at answers to this question. For example, look for the pointers to Source or Counter-Strike networking. In general, you want a server as arbiter of what "really" happens, and you then use various tricks to hide the discrepancies on the client side. |
||||
|
||||
![]() michaelth Member since: 12/10/2007 From: Nanjing, China |
||||
|
|
||||
| Well.You means I shoud use a server to gether the running data of every kart ,gives the game's result and send the final result to every Peer? I have ever considered such a arbiter.But It will result difference between What I have seen in 1 machine and What has really happened. Quote: Can I get such a source?I know the Counter-Strike is a commercial game. |
||||
|
||||
![]() coderx75 GDNet+ Member since: 11/9/2001 From: Brooklyn, NY, United States |
||||
|
|
||||
| You may want to take a close look at what it is you're sending from one user to the next. For instance, a player object may have many properties. Each player may have to send that data out to 20 other players which is highly inefficient. Instead, only send the linear and angular velocities of each object and have each client calculate the movement. Every few frames, you can send actual coordinate and angular data to be sure things stay in sync. How often these are sent could depend on network latency. The more latency, the more each client has to depend on its own calculations. You may still have "lag" under a high network load but should be pretty smooth with 20 or so players. Look into "dead reckoning". |
||||
|
||||
![]() Enrico Member since: 4/5/2004 From: Stuttgart, Germany |
||||
|
|
||||
Quote: Try the Quake3 source code, it is freely available :) |
||||
|
||||
![]() michaelth Member since: 12/10/2007 From: Nanjing, China |
||||
|
|
||||
Quote: Yes,nice idea.I will try it.Actually,to make the every peer's data synchronous,I send the coordinate and velocity data very frame. |
||||
|
||||
![]() hplus0603 Moderator - Multiplayer and Network Programming Member since: 6/3/2003 |
||||
|
|
||||
Quote: That's latency for you. Better learn to deal with it. When I said Source, I meant the Source game engine from Valve. There are articles about how it does networking around. Btw: did you check the references in the Forum FAQ? |
||||
|
||||
![]() michaelth Member since: 12/10/2007 From: Nanjing, China |
||||
|
|
||||
| Thanks.I am reading the "Unreal Networking Architecture" now.Maybe I will find some good trick to solve my problem perfectly.But Why Can't I open the link"QuakeIII"? |
||||
|
||||
![]() nemebean Member since: 3/19/2007 From: Rochester, MN, United States |
||||
|
|
||||
| The Quake 3 link in the FAQ is broken and has been for some time (in retrospect I probably should have reported that to someone when I first noticed, but I got enough out of the other two links that I wasn't too concerned about it). |
||||
|
||||
![]() NineYearCycle Member since: 8/30/2004 From: Nottingham, United Kingdom |
||||
|
|
||||
| There's a blog entry of Shawn Hargreaves you should probably read called Network Compression: Just say no! He was the lead programmer on the MotoGP games. Anyway the point that he's seeming to make in the article is that it can be ok in certain situations for there to be some inaccuracy in your simulations between clients. That means that during the race the exact position will differ between peers due to latency. However this will be corrected with each subsequent update and smoothing can be used to hide the inaccuracy. What is NOT acceptable however is to have inaccruacy with regard to winning or losing. Therefore he gives an example of having the players position be peer-to-peer but having a single authorative machine that determines the true position and winner of the game. Hope that helps someone. Andy |
||||
|
||||
![]() hplus0603 Moderator - Multiplayer and Network Programming Member since: 6/3/2003 |
||||
|
|
||||
| I think Shawn doesn't go far enough in his analysis, though. You can view game networking as a form of interaction, and interaction in turn is a form of communication. You can never get two communicating parties to be 100% in agreement, because they by definition have different reference frames (or they wouldn't be two separate parties). However, you can achieve a "good enough" common understanding. Now, for networked gaming, as long as the players have a common understanding of what happened, then all is good. However, if, on one machine, a car crashes and burns in a cloud of smoke, and on the other machine, it doesn't, then players comparing notes (or using voice communication during the game) will not agree on the communication, and you have removed something important. So, I agree that you should send only the amount of data you need to send to deliver a common understanding of what happens. Context will determine how much that is. However, once you send that data, actually spending a few CPU cycles on making that data take up fewer bytes on the wire is well worth the time. For home networking, it means there's less chance of uplink overload. For hosted games (like MMOs), network usage translates directly to dollars. |
||||
|
||||
![]() michaelth Member since: 12/10/2007 From: Nanjing, China |
||||
|
|
||||
Quote: well,you means I need a arbiter to give the game result,which is fair to every peer.That is just something "hplus0603" has proposed before.I has consider this method before and it naturally has some rationality for its equity.But This trick need extra transmission data because every peer need to send running data to it.And Is it increase the network latency?Or use some optimzing technoligies to reduce it. I always think the Predict/Correct trick is something for cheating Player's eyes.All what this trick done is just to give a more smooth animation.Can Game result(1st or 2rd) be based on the Data which is got by interpolation?Of course not,it finally should be based on your "Postion"and Other peer's "Postion" got from NetWork Packets arrived. |
||||
|
||||
![]() michaelth Member since: 12/10/2007 From: Nanjing, China |
||||
|
|
||||
| Maybe the most important charecteristic of the "arbiter" is that "the sharing of "packtet delay"'s random".This precise word is just what I find in Shawn's Blog |
||||
|
||||
All times are ET (US)![]() |
Last Thread Next Thread ![]() |
|