Author Topic: Server coding  (Read 3050 times)

chenmark

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Server coding
« on: September 11, 2013, 01:29:45 AM »
Hello,

Assuming the server is only a message relay machine, and as specified that the server code is available and can be extended.
I was wondering if the server code has(out of the box) any kind of support for UnityEngine classes such as Vectors/Quaternion, can it use the physics for ray casting and such?

If you're using I/O completion ports, does your server is using an asynchronous approach for concurrency to its full extent?
Do you have any means of monkey-patching DB access such as CouchBase/Redis/PostgreSQL, thus minimizing blocking of ongoing connection processing?

Can you share/show some extended implementation on the server side?

Thanks
Chen

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Server coding
« Reply #1 on: September 11, 2013, 07:13:49 AM »
I noticed a lot of developers seem to approach network dev as "must do physics on the server" -- which is exactly the wrong thing to do as it takes way too many resources and involves having a complete physics simulation on the server.

The proper way to do it is to just let clients do their own physics calculations, and with one client being the host, send out updates about things periodically, letting other clients correct their state as needed. That's how TNet works.

Yes, IO completion ports are used on windows. Adding DB access -- you'd need to do that yourself on the server side, TNet has no logic for databases.

With TNet you do all your coding in Unity on the client-side. You do actions by sending remote function calls to other clients in the same channel. You can make certain RFCs get saved on the client. You can make object creation/destruction get saved. You can make the entire state of the channel get saved. Working with TNet requires a different way of thinking -- less server, more client. Coincidently, it's very much like Unity's networking in its design.