Sign in to follow this  
sofakng

Why don't any 2D engines/libraries have automatic network synchronization?

Recommended Posts

I'm trying to use SFML (for .NET) along with Lidgren (networking library) to create my own engine and I'm finding it difficult to synchronize player movement and other such things (I've posted here for help and have read many, many articles). ...but I'm wondering why nothing like this already exists? Sure there is RakNet which I suppose is the closest thing, but why doesn't any 2D engine exist that synchronizes player movement? In a 2D game the player typically only has three variables: rotation, position, and velocity. On top of that, I can see a general framework allowing you specify certain variables or entire objects and use reflection (.NET) to synchronize them across the network. It's not that I don't enjoy programming. I often really enjoy it but I don't enjoy creating the game engine. I just wish something existed for 2D that took care of mostly everything and let me create the "game". (I know many non-multiplayer engines exist but I want the networking/multiplayer aspect). [Edited by - sofakng on January 18, 2009 6:40:55 PM]

Share this post


Link to post
Share on other sites
Game Maker does something similar to you're talking about, but in general that kind of thing is nearly impossible to implement well. Every game utilizes the network conenction in a completely different way, so creating a general purpose solution is at best highly inefficient in terms of network traffic and at worst affects gameplay or visual appeal -- extrapolates when it shouldn't, doesn't when it should, etc.

2d sprites may only have a position rotation and velocity, but that move in a wide variety of ways, sometimes even within the same game. It's impossible to account for all the methods of locomotion and various contingencies in a sensible manner. Not only that, but it's often more efficient to synchronize based on input rather than variables like position and rotation, especially in anything more action oriented than an RPG.

Honestly if you look there are probably libraries out there that attempt the kind of thing you're asking for, but they're unlikely to be practical in most applications.

Share this post


Link to post
Share on other sites
Quote:
Original post by sofakng
I'm trying to use SFML (for .NET) along with Lidgren (networking library) to create my own engine and I'm finding it difficult to synchronize player movement and other such things (I've posted here for help and have read many, many articles).

...but I'm wondering why nothing like this already exists? Sure there is RakNet which I suppose is the closest thing, but why doesn't any 2D engine exist that synchronizes player movement? In a 2D game the player typically only has three variables: rotation, position, and velocity. On top of that, I can see a general framework allowing you specify certain variables or entire objects and use reflection (.NET) to synchronize them across the network.

It's not that I don't enjoy programming. I often really enjoy it but I don't enjoy creating the game engine. I just wish something existed for 2D that took care of mostly everything and let me create the "game". (I know many non-multiplayer engines exist but I want the networking/multiplayer aspect).


It's too complicated to create a generalized solution.

Share this post


Link to post
Share on other sites
Quote:
Original post by mpipe
It's too complicated to create a generalized solution.

More specifically, it's hard to optimize a generalized solution well for performance (by that, I mean latency and bandwidth use type of performance... or simply put, how responsive your game feels during adverse network conditions).

In any case, I'm planning to try to make the game I'm working on (2d, networked) very friendly to modding, so it can be used for this kind of purpose. The only downside is, it's probably not gonna be done for a while (I only have the networked movement part down so far, weapon shooting is not yet done).

Share this post


Link to post
Share on other sites
Quote:
Original post by Puck
2d sprites may only have a position rotation and velocity, but that move in a wide variety of ways, sometimes even within the same game. It's impossible to account for all the methods of locomotion and various contingencies in a sensible manner.

Why does it matter how the objects move? If you are synchronizing position/rotation then isn't that all that matters? Furthermore, if you use interpolation all you're doing is moving between two points so would you really need to know _how_ the objects are moving to update the position/rotation?

I guess I just don't understand. It seems like keeping position/rotation (and even other variables) synchronized across a network would be possible in a general manner. Sure, it might be absolutely 100% fluid in every case, but I would guess that it would work for many, many, many games out there...

Share this post


Link to post
Share on other sites
It's not practical to synchronize rotation/position for all types of games, which is what everyone is telling you. Take a soccer, or football game for instance, you have 22 players, all of which would need to be synchronized over the network, which is a waste of bandwidth (and would probably result in slowing the game down) to send over positional, rotational information. In a two player game, just pass inputs and synchronize on that. Not to mention synchronizing on position and rotation says nothing about animation states.

With that said, certain games make more sense to synchronize on position/rotation of your characters.

Share this post


Link to post
Share on other sites
Quote:
Original post by sofakng
Why does it matter how the objects move?


Perhaps you're making a platform game and your sprites never rotate, do you still send rotational information? What if most of your objects behave normally, but one certain type of object only needs its initial state and a deterministic simulation handles the rest? If it's a two player competitive network game and the data doesn't match up, who has authority? Would that solution be fair or practical in a different type of game?

As I said before, such a solution would be inefficient in terms of bandwidth as best, and have gameplay side effects at worst. Networking really has to be tailored to each individual game to get good results, there just isn't any way -- at least that we know of -- to create a solution that just works for many different types of games.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this