Exams soon, so no Blending for now, but just something I’ve been interested in for a while:
-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”.
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.
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.