Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Hi i'm trying to get a muiltplayer demo game to work

Author
Message
darkvee
20
Years of Service
User Offline
Joined: 18th Nov 2005
Location:
Posted: 30th Aug 2011 01:14
Hi guys,

I'm having some problems getting this to run above 2 frames per second. It shows 50 balls on the screen on the server and client. Can someone tell me if i'm sending the packets, and receiving it correctly and efficiently?

I'm using directplay by the way to. But surely directplay can do better then 1 to 2 frames a second?
Here is my code after all the network code is out of the way.



darkvee
basjak
16
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 30th Aug 2011 02:25
have you noticed that you're updating too many information in your loop

writing and retrieving information to memblock slows down the computer performance.

try putting all balls data in one string then send it. updating a string is faster than updating memblock.

try to run the program without networking. is it fast enough?

as well shorten your code:
EXP:
darkvee
20
Years of Service
User Offline
Joined: 18th Nov 2005
Location:
Posted: 30th Aug 2011 03:52 Edited at: 30th Aug 2011 04:03
Hi basjak,

Hi I noticed you used


Which should be

but I know what you meant. It was just a common mistake.

Thanks for the help. Yes it's much faster but network speed is the same. Maybe if I make 2 memblocks of the same byte size. For example one to send the packet with memblock 1 and the other to receive the packet using memblock 2.

That way i'm not having to write and read the memblock 1 about at the same time which should cause a lot of performance problems.

darkvee
basjak
16
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 30th Aug 2011 05:11
have you tried to turn the data into one string?

every time you try to write something on memblock, the compiler has to go to the memblock pointer on the memory then shift itself to the empty byte then add data.

every time you want to add data to the string, the compiler already knows the end of the string and go to the and of it, saving at list 50 to 60% of the performance.

about the code:
darkvee
20
Years of Service
User Offline
Joined: 18th Nov 2005
Location:
Posted: 30th Aug 2011 09:09
Not yet I havn't.

darkvee

Login to post a reply

Server time is: 2026-07-10 19:07:13
Your offset time is: 2026-07-10 19:07:13