Hi all
Im trying to figure out what goes on with networking and this is what i have come up with so far.
The basic network I/O seems to be in place and working somewhat well so i opted not to investigate that part too much.
in /net/general there is a lot of files named net_something and that something is most of the time a name of a class in /gs/gameobj.
the purpose of those files seems to be to pack and unpack the corresponding gameobject for net transfer.
Also in /net/general is the class Network. Network acts as the main entrypoint to network activities from the rest of the code where it is instantiated as g_network
Then there is the question: what makes it tick?
I havent really been able to understand that part yet but it has to do with events and is tightly integrated into the normal event operations of the game (wich i have a hard time comprehending as well).
Then how do you go about getting information propagated to the rest of the network?
Heres a few examples:
This peice of code seems to propagate the fact that a wonder has been build from the host.
Couriusly i havent found any place where the client tells the host that it has completed a wonder.
This peice of code contains handling of both the client action and the host propagating it to the rest of the players. This might be the place to correct bug #26 "* Added check for clear queue actions from clients received after they lost the city to another player".
I suspect that the chat functions might be a good place to look if you want to know more about real time data transfer but i hasnt been in my interest.
I hope you will give me some usefull feedback to this
-klaus
Im trying to figure out what goes on with networking and this is what i have come up with so far.
The basic network I/O seems to be in place and working somewhat well so i opted not to investigate that part too much.
in /net/general there is a lot of files named net_something and that something is most of the time a name of a class in /gs/gameobj.
the purpose of those files seems to be to pack and unpack the corresponding gameobject for net transfer.
Also in /net/general is the class Network. Network acts as the main entrypoint to network activities from the rest of the code where it is instantiated as g_network
Then there is the question: what makes it tick?
I havent really been able to understand that part yet but it has to do with events and is tightly integrated into the normal event operations of the game (wich i have a hard time comprehending as well).
Then how do you go about getting information propagated to the rest of the network?
Heres a few examples:
Code:
void WonderTracker::AddBuilt(sint32 which) { m_builtWonders |= (uint64)1 << (uint64)which; if(g_network.IsHost()) { g_network.Enqueue(new NetInfo(NET_INFO_CODE_BUILT_WONDERS, (uint32)(m_builtWonders & 0xffffffff), (uint32)(m_builtWonders >> (uint64)32))); } }
Couriusly i havent found any place where the client tells the host that it has completed a wonder.
Code:
void BuildQueue::Clear(BOOL fromServer) { if(!fromServer && g_network.IsClient() && g_network.IsLocalPlayer(m_owner)) { g_network.SendAction(new NetAction(NET_ACTION_CLEAR_QUEUE, (uint32)m_city)); } else if(g_network.IsHost()) { g_network.Block(m_owner); g_network.Enqueue(new NetInfo(NET_INFO_CODE_CLEAR_QUEUE, (uint32)m_city)); g_network.Unblock(m_owner); } while (m_list->GetHead()) { if (m_list->GetHead()->m_category == k_GAME_OBJ_TYPE_WONDER) { m_wonderStopped = m_list->GetHead()->m_type; g_theWonderTracker->ClearBuildingWonder(m_wonderStopped, m_owner); } delete m_list->RemoveHead(); } Assert(m_list->GetCount() == 0); }
I suspect that the chat functions might be a good place to look if you want to know more about real time data transfer but i hasnt been in my interest.
I hope you will give me some usefull feedback to this
-klaus
Comment