Directplay and multiplayer messages
BlitzPlus Forums/BlitzPlus Beginners Area/Directplay and multiplayer messages
| ||
Hi for a fourth time Is there any way to 'flush' server messages in directplay? When I send data quickly, I am getting the wrong response from the server. I send messages in a while not recieve message loop. I tried removing the loop, but then the client doesn't recieve the response/ the server doesn't send one. Thanks |
| ||
Anyone? |
| ||
Oh well I am using BPLite now |
| ||
What's BPLite? I've noticed that when creating programs using BPlus that i get random data or not the correct response from certain events. It's very annoying that I have to program round blitz's own issues. If I knew Blitz was to be abandoned I would never of purchased it. :( |
| ||
Blitz --- abandoned? It still has an active forum base. But to answer your question BPLite is BlitzPlay Lite. It is a very powerful UDP alternative to DirectPlay. The built in commands are amazing, and my program, hopefully, will be completed within a month because of BlitzPlay's sample code and commands. I am looking to purchase the full version, but the director dude seems to have abandoned it (he hasn't gone on in 4 years). |
| ||
I know it is a bit old but maybe helpful to someone. I just used Direct Play in a small game I made and I to needed to flush the messages to smooth out the game play. I did this by putting my RecvNetMsg routine in a repeat loop. Ending the loop with Until RecvNetMsg()=False to flush the server messages after each access. It work very nice and solved a lag issue I had with one computer that was behind a firewall which would get farther behind in this action game as the game went on because of a backlog of messages. Something like this, Repeat If RecvNetMsg() Then msgType=NetMsgType() If msgType>0 And msgType<100 Then msgFrom=NetMsgFrom() If player=1 Then msgData$=NetMsgData$() If msgdata$="player1hit" Then p2score=p2score+1 : Goto reset player2x=stringtonumber(msgdata$,1) player2y=stringtonumber(msgdata$,2) player2frame=stringtonumber(msgdata$,3) bullet2x=stringtonumber(msgdata$,4) bullet2y=stringtonumber(msgdata$,5) ElseIf player=2 Then msgData$=NetMsgData$() If msgdata$="player2hit" Then p1score=p1score+1 : Goto reset player1x=stringtonumber(msgdata$,1) player1Y=stringtonumber(msgdata$,2) player1frame=stringtonumber(msgdata$,3) bullet1x=stringtonumber(msgdata$,4) bullet1y=stringtonumber(msgdata$,5) EndIf EndIf EndIf Until RecvNetMsg()=False This way I read the messages until there is no message to read and keep the data in the last message. CTP |
| ||
One problem you may want to consider with Directplay is that it doesn't let you know what ports are in use, therefore if you need to forward any ports on your router for internet play it can be an issue. |
| ||
I had only uses DP on a network. So it is better to use straight UDP for net play? |
| ||
Yes. |
| ||
I wouldn't worry too much as DirectPlay is deprecated. |
| ||
I liked DP as it is UDP in a nice wrapper that handled everything for me. I know if using TCP it handles controlling the order you receive messages in, but TCP will stop a program waiting for the message reply to come in. Where in UDP you have to handle this yourself, but wont stop the program. But there are no examples in the UDP help files and I don't really know how to control the messages if they come in out of order. I just made my first little action game using DP about two weeks ago. It was mostly a learning experience. Now I will have to just dig though the code archives here and try to understand the UDP codes. CTP |