turican0 / remc2

Recode Binary code of game Magic Carpet2 to C/C++ language(remake MC2 for any platform)
GNU General Public License v3.0
111 stars 11 forks source link

Network - make ID from port and IP #154

Closed turican0 closed 2 years ago

thobbsinteractive commented 2 years ago

How did this work originally I wonder?

turican0 commented 2 years ago

I try not to change the game code. I'm just creating a kind of NETBIOS/IPX emulator over UDP/IP. So it's more about how exactly NETBIOS works. See..: https://www.lifewire.com/netbios-software-protocol-818229 http://www.cs.vsb.cz/grygarek/PS/sem/netbios/netbios.h https://en.wikipedia.org/wiki/NetBIOS On top of that, I've added IP address detection(as a unique identifier of the computer), which the server then recognizes each computer by. I'll also extend that identifier with a port - hopefully this can be used to test multiple instances on a single PC, where each would have a different port. I didn't want to make it difficult to find out the individual interfaces, because there are specific APIs for different OSes, so I do it by sending a message to the server, it learns the IP from which the message came and sends the information back. Next, the NETBIOS function ADD_NAME is used, which plugs the computer into the network. Then the connection is established using CALL and LISTEN. And then messages can be sent using SEND and RECEIVE. The CANCEL, DELETE and HANG_UP functions are used to terminate various things, so I'm still figuring out what each does. I'm still thinking about a function that disconnects the client from the network if it doesn't answer for a long time, for example if some client application closes violently. I managed to get this working in classic DOSBOX, but unfortunately not in DOSBOX-X, which I use to get information about how the game works.

turican0 commented 2 years ago

On older networks, a lot of things were handled by broadcasts, so some things were simpler. On IP we first have to put together a group of IP addresses and then it can work similarly.

thobbsinteractive commented 2 years ago

It is interesting that it says NETBIOS works over TCP/IP. I even found a list of games that used it: https://www.mobygames.com/attribute/sheet/attributeId,129/offset,0/p,2/so,0a/ It includes Duke3D. Anyway Quake used UDP, so perhaps that is all we need? Each client broadcasting their updates without ensuring they are received and the server being the single point of truth. So if a client update is not received it simply does not happen on the server and the client updates with whatever it gets from the server. You seem to have a handle on things anyway, I'll stop bothering you and get back to understanding the HD render code so I can implement OpenGL