Computer Science Canada

Help with net code

Author:  spongeboob [ Sun May 28, 2006 1:15 pm ]
Post subject:  Help with net code

Hi, I'm currently trying to program a sort of multi-player street fighter game for a school project.

The problem is that the game runs incredibly slow over the internet

attached is the game files

of course you cant help me, if the game compiled

here is the net code part of the player class

code:

function sendData : string

currentPlayer:=""
currentPlayer:=currentPlayer + "x" + intstr(x)
currentPlayer:=currentPlayer + "y" + intstr(y)
currentPlayer:=currentPlayer + "p" + intstr(currentpic)

result currentPlayer
 
end sendData

procedure getData (newData : string)

x:=strint(newData(2..((index(newData, "y")-1))))
y:=strint(newData((index(newData, "y")+1)..((index(newData, "p")-1))))
currentpic:=strint(newData((index(newData, "p")+1)..(length(newData))))
 
end getData


if you try to play the game as is, it should work
but it is incredibly slow....

Can anyone help me with some sort of new net code
or is Turing not capable of something like this?

Author:  spongeboob [ Wed May 31, 2006 4:37 pm ]
Post subject: 

bump

Author:  Tony [ Wed May 31, 2006 4:57 pm ]
Post subject: 

well the problem here is that you're exchanging information during each frame. So each frame a client needs to send out data, wait for other side to reply to data, read and interpret that.

You can try setting up some benchmark tests to see just how fast you can exchange information, but I'm gonna guess that it's a long stretch away from real-time.

Some games have an AI play for other parties in between data exchanges, and then syncs the states. Though I don't think that would be applicable for this type of a game.

Author:  spongeboob [ Wed May 31, 2006 5:13 pm ]
Post subject: 

you see the thing is,
I've tried making it check every 0.1/0.5/other interval seconds but it simply freezes everything whenever it is exchanging information

i've even tried to fork it so it does the stuff in the background
but all i got was some fatal errors

that being said, I dont think an AI inbetween exchanges would help much as the main problem is the pause that occurs when they try to exchange information

Author:  Tony [ Wed May 31, 2006 6:34 pm ]
Post subject: 

yeah, you might actually want to *gasp* use processes for data exchange. Better start reading on the topic.

Author:  spongeboob [ Wed May 31, 2006 7:24 pm ]
Post subject: 

spongeboob wrote:
you see the thing is,
I've tried making it check every 0.1/0.5/other interval seconds but it simply freezes everything whenever it is exchanging information

i've even tried to fork it so it does the stuff in the background
but all i got was some fatal errors

that being said, I dont think an AI inbetween exchanges would help much as the main problem is the pause that occurs when they try to exchange information


i did try processes, but like i stated, i got some fatal/environmental errors that prevented me from further testing

however, it might've been because i tried to use the data before the data was actually exchanged due to the nature of processes

i'll try an if statement to prevent ^^ that.......hopefully there'll be some progress Confused

Author:  codemage [ Thu Jun 01, 2006 8:45 am ]
Post subject: 

I can't check your source since I live in a police-state-dictatorship workplace, but make you're you're checking

Net.LineAvailable (etc.) to see if anything is available on the network before getting info. That should resolve issues with demanding before the supply is there.


: