anyone know how to use the udp/tcp commands?

BlitzMax Forums/BlitzMax Beginners Area/anyone know how to use the udp/tcp commands?

Nate the Great(Posted 2009) [#1]
Hi,

well I was looking throught the online manual and there doesnt seem to be an example for any kind of networked program in bmax and they arent like the b3d commands so im kinda lost. Does anyone have a very simple chat program or somethin? BTW what is a Tsocket, all I know from the manual is its a socket which is???


Czar Flavius(Posted 2009) [#2]
DISCLAIMER: This is by no means an example of good code, or how you're "supposed" to do it, it's purely code I managed to hack together for my game, learning as I went along. But it may be of some use to you.
The global values are set by interacting with the main menu, then init is called when the Go button is pressed. Each game "tick", wait_tick is called and the current tick number sent to make sure the games are at the same pace. (Problem with this - if one computer lags, the other computer freezes until the lag is gone). Then sync_commands is called to exchange the actions each player has made. (Problem with this code - the order in which commands are executed is different between clients. It's not a problem right now but could become one. I plan to replace it with a new system, where all commands are sent to the host, who then collects them and sends the entire package of all client commands to each client, so the order is the same. This would also help expand the code to more than two players)



Beaker(Posted 2009) [#3]
Might help a little:
http://en.wikipedia.org/wiki/Internet_socket


Matt McFarland(Posted 2009) [#4]
It would be great to have a blitzmax tutorial on how to do this properly.