emrahsungu / Hes.Socket.Server

A library written in pure C# to replicate all feature of Photon Engine
1 stars 0 forks source link

Been looking for exactly this minus one thing #1

Open MostHated opened 6 years ago

MostHated commented 6 years ago

Hey there, I have been trying to take a game framework that I already have and make it so it doesn't require Photon just as you have here, the only difference is I am wanting all of the server side parts to run within an instance of Unity so that the server can be compiled to Linux and run on a headless server instead of Windows. The thing I am running into is I am not sure how or what to change with the threading / concurrency to make it work within Unity when you Enqueue something. Example being is when a sub server starts up it is able to connect to the Master Server but when it needs to send the Register OperationRequest It will hit "this.requestFiber.Enqueue(Register)"; but then it never actually fires off.

Do you have any plans on trying to implement that, or could you possibly give me some pointers? I have been trying to find information on it, but it is a bit to specific of an issue to try and search considering the message fibers, publishing channels, topics and subscriptions fo the area of interest, and things of that nature. I would definitely appreciate any assistance you might be able to throw my way as that is the last thing I need working for my game!

Thanks, -MH

emrahsungu commented 6 years ago

@MostHated I am sorry for the late reply as I have been really really busy with work. Even though current implementation is far from over, it is supposed to compile on .net core, which you can run on Linux. However, I do not understand the part where you want it to be hosted inside Unity instance. Do you want the Unity instance to be the server? It would not scale :)

Anyways, if "this.requestFiber.Enqueue(Register)"; but then it never actually fires off." Then you are supposed to first check if you called requestFiber.Start().

Fibers Channels Messages are related to "ActorModel" and "retlang", just give it a google search. Feel free to ask more :)

MostHated commented 6 years ago

Hey there, I appreciate the reply. I actually got it all worked out since I posted this. The reason I am hosting things inside Unity primarily are for its use of physics, plus several 3rd party assets I want to use on the server side are made to work within Unity. I, of course, am going to have to do a lot of testing, but I have each server separated, Master, World, Login, Chat, etc so that if I need another World server I can just spin up another one and it will automatically register itself to the Master as another available World server. I just recently bought this asset as well that I am hoping will help keep the Unity instance slimmed down as it allows you to only load / execute the things that you need.

I will just have to see how it all performs. I am just ironing out the last bugs of loading my character into the world because of DB issue, but the rest is working well. : D

Thanks, -MH

emrahsungu commented 6 years ago

I am glad everything is working out on your end :)

The reason I am hosting things inside Unity primarily are for its use of physics, plus several 3rd party assets I want to use on the server side are made to work within Unity.

That is actually pretty interesting and I also want to give it a try now! I also would appreciate if you would let me know how many peers can connect per unity instance etc :) On medium AWS instance i can go up to 3300 peers

MostHated commented 6 years ago

It would probably be quite some time before I get to a point where I would have any peers minus myself, lol. I started making my game single player but then decided to go multi, so I pretty much scrapped what I had and then began working on this project, so for the last 3 months I have just been learning all I can about multiplayer code as well as getting this framework setup and working the way I want. Just last night I got all the major bugs worked out and was the first time I was able to load up and fully login to the game world within Unity, so that was pretty exciting.

Most of the examples and test projects I came across that were similar were setup unfortunately for a single server only, so all the broadcasting and keeping track of multiple server and what not was removed or just never added, so it took a bit of doing to get all that worked out, but I am glad I kept with it, as it will be nice to be able to just fire up new world servers as needed in case running it within Unity doesn't quite yield the results I am wanting, at least I would not be stuck with just that standalone world.