Photon vs. Lidgren

If I’ve understood correctly, both of these systems offer the communication layer. Photon also offer the “distance” based communication between clients, but I don’t think that it would be needed for our games (since it’s more like separate levels and not a big continent).

So, what would be the main advantages on choosing Photon over Lidgren?

Photon offers a higher level of abstraction than Lidgren, with the end result geared towards an mmo with a centrally hosted sever run by you.

Lidgren is a more low level set of api’s, with the only layer of abstraction being that of the concept of a message. It’s up to you to build your own application protocol on top of that.

You can therefore with lidgren have the users host games themselves. Either from within the game or by a distribute server binary for linux.

reasonably that comparision can’t be done actually.

Lidgren is just a network library that removes the need to directly work with sockets. Thats all it offers.

Photon on the other end is a powerfull and optimized server backend technology which you can expand through own applications etc.

they target pretty different usage patterns and scenarios.

What do you mean by “distance based” communication?

Aside from that, Dreamora is right. Lidgren is probably comparable to Raknet and Enet or something. Photon brings its framework in C# with players, rooms and extendable patterns for concurrent RPC calls (operations).

So far, you would need a Windows Server to host Photon.

You can try Photon for free and even use it up to a certain limit for free.

scratches head
Lidgren is as discussed, Photon and Raknet compare actually, seriously you would need to look at Raknet’s functionality and users. Sony Online Entertainment uses Raknet (and if I am not mistaken, the entire backbone of the PS3 is Raknet, so think global), I am not sure anyone can fully answer your question though, not enough info. From the OP post, I would say you can simply use windows Sockets to do what you want. On the other hand, I am all about scalability, thus Photon is what I finally settled in on. The support alone is well worth it IMHO.

The one to choose is based on your needs, you can use Unity’s version of Raknet to also do what you want, it has everything already there for you, not much work to perform.

Excuse me if I were little bit blunt. I’ve tried to do some research into the topic, but the amount of information is bit overwhelming TBH.

Let me go a bit deeper into my question:

Scroll to the part “C/C+±based Core, Extensible in C#, Reliable UDP”.

Apart from being written in C++, that doesn’t differ much from what I read about lidgren. Both can be “extented” with C# and both offer communication layer. Lidgren also uses UDP and offers the reliable layer on top of that.

There is also the power-ups mentioned, but I failed to find any further info on the site about them.

I mean the interest area thingy that is mentioned in the help file.

Yep, I know about those. I’ve already made the prototype using them :slight_smile: But the feedback from players has been quite clear: it’s too hard to host your own servers. Even with NAT punch through. For me hosting a server isn’t a problem, but for the players it seems to be. People want games they can just pick up and play.

That’s why I am looking at hosting my own central server that would be easy to connect to. It would also help me with cheating and collecting stats and data. I know that this could be done using Unity’s networking as well, but it becomes quite hacky to create multiple “game rooms” so to speak.

Hope this clarifies some points.

Also, I do agree that it is awesome for Exit Games to offer a free version for us to test and play around with, but I do also expect that info like full feature list would be visible on their site (preferably just a few clicks away from the main site).

I think you missread lidgren pretty indepth then.
Lidgren can not be extended.
Lidgren is just a communication layer.
The whole server must be written by you first before it does anything and once you did that you will rewrite it a dozen times until it does so in a performant, multithreaded way, so you can use it for a reasonable amount of users.

At that point you will likely think back and ask yourself why you didn’t use photon which does that out of the box (and faster than your C# server ever will be likely) :wink:
(even if you are advanced to an expert in the field, you won’t be able to come up with something comparable to photon in the amount of time of the money you saved by doing something yourself)

Photon uses ENet for the direct UDP communication layer, which is a lightweight and well proofen open sourcen library itself but its just that, the network layer. thats really the smallest part in photon which offers you the server backend to build upon :slight_smile:

If thats your target, then photon is a worlds stronger solution.
As written above it needs a lot of experience to write a solid, scaleable, multithreading optimal server and thats the base requirement you will have to use it as central server.
Also dataseperation between the game sessions (rooms as you call them) and alike can become a tricky topic if you don’t have experience in the field.

these are things that you get with photon out of the box.

It is, unless it vanished.

It is a solid, scaleable, multithreaded, high performance server backend which you can extend through C# server applications.
In addition there is the (for various licesenses at least) free Mmo Example which adds spatial seperation of the world for more optimized data syncronization patterns (sync with local surrounding / sync with global depending on task and need)

You can build anything with it you want.

What it does not do on the feature page though is a lot of tech talk about network layer capabilities. Unsure if it mentions that it uses ENet but if not, I do so here so you can check out the low level network layer stuff. It won’t touch you though cause you never work with that low level at all (which is why it isn’t mentioned there likely).
What you will work with are reliable and unreliable events, then operations which are always reliable (Photons form of RPCs) and properties, which is a form of temporal persistency (you can make it truely persistent by extending the server application).

Thanks for clearing these things up.

Photon is probably the best way to proceed as you said.

How much does Photon’s “RPC” system differ from Unity’s builtin one? Will I be able to copy most of the logic made in Unity over to Photon without many problems?

Hm. You are right. I used Raknet some years ago when it was just networking but now it has it’s own RPC framework and everything. I tend to forget this.
It’s more C++ oriented and I’m not sure if it offers structures for players and rooms.

Photon is currently not meant to be distributed with a game (for lan support). It would be possible of course but we would need to adjust the license. And: we don’t have local game detection.

The page is a little marketing-biased, agreed. We assumed that most developers want to check it out first hand, start the server and play with the code.

Ah! Right. We have that! :wink:

This is in the “ExitGames-Photon-MMO-Demo_v2-0-5-1.zip” package on the download page. You are right, this won’t match your needs.

The LiteLobby application most likely would be a good base for you. You can open lobbies on the fly, list rooms in it and have your players join these rooms by name. Each room is separated from the others and as long as you don’t modify one from another, they are thread safe.

Actually, all events are just a special case of operations. Photons core just knows operations, the typically often needed types of operations like join, leave and events are delivered by Lite, which builds up on the Photon core as a higher level of abstraction.
Of course operations can be both reliable and unreliable, too, otherwise this would also be not possible for events.
The main difference between events and custom operations is:
One client sends an event to the server and the server just delivers a copy of it to every other client in the the game.
Custom operations are more complex at server side part of development, as you have to tell the server, what it has to do with that custom type of operation, as it is not just delivering it to all clients like with events, but this also makes custom operations much more powerful than events:
You can use operations for direct communication between a certain client and the server, as the server can send operation responses, or you could change the content of the operation before delivering it to other clients and send an update with that changes to the original sender.
An example for an unreliable custom operation for which you can’t use events and should not use reliable custom operations would be sending position updates with server side collision detection authority. If one operation is missing, no problem, you will receive a never one a few frames later anyway, but if it would be reliable, the old one would be sent again and all newer ones have to wait for the old operation, which is outdated anyway.

Technically any kind of communication in photon is an operation, isn’t it :slight_smile:

Properties are just specifically offered operation wrappers around SetProperties / GetProperties and the actor - game specific ones in the Lite case, the Raise Events is nothing else than a nice wrapper around the corresponding RaiseEvent operation.

That being said: Lite is a great place to learn a lot about this stuff as it offers exactly this kind of productivity “wrapping” for you to use, so whenever possible, build your game by expanding Lite, not through working with the lowest level yourself.

Actually I would not recommend to expand the Lite source itself with your own code, but rather set up your custum server code as a seperate project on top of Lite, communicating with Lite only via the lite API, this way you avoid all the merging work, you would have, if expanding the Lite source itself, when you want to update to a newer Photon version.

Thats what I meant with expanding actually.

That you create a new solution for an own application with new classes that explicitely extend LiteXXXX (especially LiteGame and the Dispatcher)