Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Help with net code
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
spongeboob




PostPosted: 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?



game.rar
 Description:

Download
 Filename:  game.rar
 Filesize:  537.37 KB
 Downloaded:  44 Time(s)


game.rar
 Description:

Download
 Filename:  game.rar
 Filesize:  537.37 KB
 Downloaded:  60 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
spongeboob




PostPosted: Wed May 31, 2006 4:37 pm   Post subject: (No subject)

bump
Tony




PostPosted: Wed May 31, 2006 4:57 pm   Post subject: (No 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
spongeboob




PostPosted: Wed May 31, 2006 5:13 pm   Post subject: (No 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
Tony




PostPosted: Wed May 31, 2006 6:34 pm   Post subject: (No subject)

yeah, you might actually want to *gasp* use processes for data exchange. Better start reading on the topic.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
spongeboob




PostPosted: Wed May 31, 2006 7:24 pm   Post subject: (No 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
codemage




PostPosted: Thu Jun 01, 2006 8:45 am   Post subject: (No 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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: