Networking, Am I right in thinking...

Exams soon, so no Blending for now, but just something I’ve been interested in for a while:

Networking:
-Why do people keep setting up host servers? Why not connect the players directly using the WAN IP? (Any reasons to do with making it work or just the advantages of having a constant host, etc)

-do people make their packets contain names and other unnecasary data?

With those two questions in mind, I will reveal my ideas on a future venture:

A Host script that is operated on the host machine (duh :P)
This will assign the clients their:
player ID (to tell which player on the local machine the data recieved applies to)
Any settings chosen by host (hardcore/normal, game mode, etc)

It will do this once.

It will test the prescence of the clients (IE, player 2 has disconnected, this will only happen when there have been enough consecutive falses, to compensate for any “dropped” packets.) This will use the recieved data described below.

It will perform integrity checks, etc on the data (to ensure the data is not corrupt, mainly from the protocol defined structure (to be described below)

finally, it will distribute the recieved data to all clients using the below section “standard”. maybe some maths could prevent the host sending a client it’s own data.

The Clients will send their data, UDP, in packets which are built by a script, in the stndard IP protocol, with address headers, contents, etc. Then the contents will contain data from my proposed “protocol”.

Standard:
Using 4-byte floats for any informtion.
instead of naming this data using python dictionary indexes, property names, etc, It will merely be assumed by a standard.
For example:
the first byte could represent the player ID, the host and clients will use this data to tell which player to apply the data to.
then the player data;
position, as 3 consecutive floats.

orientation, perhaps a “hacky” method could involve a track-to actutor, and orienttion would be the position of a tracking object, else the matrix maths could be done - though the overhead would have to be considered in the decision of which method to use.

current action - using a byte or 2 to represent an ID, each of which represents a specified action for the players to be using.

any other important data like a flag for shooting, etc, (ammo shouldn’t matter to any machines but the player whose ammo is in question)

using the “assumed” data representations, there is a higher, (but still minimal?), risk of data being read incorrectly, but it greatly decreases the packet size by eliminating information which is only to make scripting easier. More work behind the scenes - less work on the scene.

The reason people have host ‘servers’ is because of NAT blocking.
Your router firewall (which most people don’t want to change) blocks incoming connections, such as those using the direct IP.
What an external server does is:
has no firewall, so allows all connections
Deals with all logic, positioning etc.
Sends the ‘decoded’ data to the clients.
You’re right in some respects to packet size.
The demo that i have created in the networking component uses too much data, that is because it is JUST a demo.
The next update will tackle data issues, so that only information that is required is sent to the client(s).

If you have any queries, PM me.

ah, thanks for clearing that up.
I’ve experience in quite a large portion of computer science, but not web/networking stuff, because it requires alot more (hardware, web domains, etc) than, for example, download an SDK and starting…

Well, generally speaking, networking is a matter of:

  • synchronisation
  • compression
  • relativity
  • bit rate
    First, you must (as you’ve rightly said) send only the minimum data required
    Second, you must find a way of sending only the relevant data to the relevant client.
    Third, you must set the interval of transmission.
    Because UDP (the best standard for FPS games etc) does not allow the user to set the bitrate, one must improvise with a counter system.
    More later

indeed. I think it’s taken so long to start thinking about it because it’s so different from programming a local program which communicates with nothing else.
I just posted this because I know there are people here with experience in this, perhaps they could share their experience, etc.
thanks.

Well, like i said, feel free to have a look at my python component -(Please note, it’s just supposed to work at the moment, the next release (hopefully tonight) will work on code optimisation, and developer defined input)