AbsoluteBeginner,
Sure you should use whatever communication method you prefer. The general difficulty with files is performance and synchronicity - reading and writing files is generally a bit slow and you have to sure the file written by one program ends before another reads it. Synronicity will be hard with files and if there is a delay, then for a game with moving bits the different programs will probably get out of sync. There is plently of chance for errors and will be slow. Somehow you really want an event fired when there is something there to read, which is exactly what the LDServer/LDClient stuff does.
You can always change to LDServer methods later, but they are pretty easy to use really, just connect client using connection string (IP) created by server, then send messages from clients (like keys pressed) and the other clients get it as an event message arived.
Do play with these a little before deciding, below is a very simple server client test code: Save them somewhere, compile them both, then run server followed by several clients.
Sever
Client
Sure you should use whatever communication method you prefer. The general difficulty with files is performance and synchronicity - reading and writing files is generally a bit slow and you have to sure the file written by one program ends before another reads it. Synronicity will be hard with files and if there is a delay, then for a game with moving bits the different programs will probably get out of sync. There is plently of chance for errors and will be slow. Somehow you really want an event fired when there is something there to read, which is exactly what the LDServer/LDClient stuff does.
You can always change to LDServer methods later, but they are pretty easy to use really, just connect client using connection string (IP) created by server, then send messages from clients (like keys pressed) and the other clients get it as an event message arived.
Do play with these a little before deciding, below is a very simple server client test code: Save them somewhere, compile them both, then run server followed by several clients.
Sever
Code:
connect = LDServer.Start("True")
File.WriteLine(Program.Directory+"\ConnectIP.txt",1,connect)
TextWindow.Title = "Server"
LDServer.AutoMessages = "True"
While ("True")
Program.Delay(10)
EndWhile
Client
Code:
connect = File.ReadLine(Program.Directory+"\ConnectIP.txt",1)
LDClient.ServerMessage = OnServerMessage
LDClient.Connect(connect,"True")
button = Controls.AddButton("Press me",10,40)
Controls.ButtonClicked = OnButtonClicked
textBox = Controls.AddTextBox(10,10)
Controls.SetSize(textBox,200,20)
While ("True")
If (message <> "") Then
If (Text.EndsWith(message,"CONNECTED")) Then 'Initial connection established
GraphicsWindow.Title = LDClient.Name
Else
Controls.SetTextBoxText(textBox,message) 'Message received
EndIf
message = "" 'Wait for another message
EndIf
Program.Delay(10)
EndWhile
Sub OnServerMessage
message = LDClient.LastServerMessage 'Message received
EndSub
Sub OnButtonClicked
LDClient.SendMessage("Hello") 'Send a message
EndSub