39dll V2.5
#41
Posted 09 July 2005 - 06:35 AM
To understand why this dll is important read http://www.gamedev.n.../article712.asp in the section: "Birth of Lag: Building the Packet". This dll can do everything mentioned in that section.
#42
Posted 09 July 2005 - 07:35 AM
Wht does it mean?
Edited by Timmo, 09 July 2005 - 07:37 AM.
#43
Posted 09 July 2005 - 08:25 AM
writebyte() - Utilizes 1 byte
writeshort() - Utilizes 2 bytes and can be a number between -32000 to +32000
writeint() - utilizes 4 bytes and can be a number between -2000000 to + 2000000
writefloat() - utilizes 4 bytes and can store numbers with a floating point (e.g 4.2)
writedouble() - Utilizes 8 bytes and is the same as writefloat but the number can be much much larger!
#44
Posted 09 July 2005 - 01:19 PM
Is it necessary to send a string and the numeric values in different packets (when the numeric values are being packed with writebyte())?
I've made a string_split() script (how original!), which uses a character from the ASCII-table (like '|') to split different values from each other. Since some strings depend their size on their user, like names and passwords.
For example, I send the packet: "LG|Jochem|mypassword|5600" to log myself in. I could easily halve the size of bytes for 5600, but that isn't possible, because there is already used a ASCII-character for the strings, and the whole packet will be messed up when readed, thus leading to errors.
I did though of giving a name and password a fixed size, but that would be a waste of bandwith, wouldn't it?
Does anyone have any suggestions?
#45
Posted 09 July 2005 - 02:10 PM
You do not need to have the packet seperated with "|".I was wondering something.
Is it necessary to send a string and the numeric values in different packets (when the numeric values are being packed with writebyte())?
I've made a string_split() script (how original!), which uses a character from the ASCII-table (like '|') to split different values from each other. Since some strings depend their size on their user, like names and passwords.
For example, I send the packet: "LG|Jochem|mypassword|5600" to log myself in. I could easily halve the size of bytes for 5600, but that isn't possible, because there is already used a ASCII-character for the strings, and the whole packet will be messed up when readed, thus leading to errors.
I did though of giving a name and password a fixed size, but that would be a waste of bandwith, wouldn't it?
Does anyone have any suggestions?
Just do:
//Building the packet
writestring("LG", true);
writestrng("Jochem", true);
writestring("mypassword", true);
writeshort(5600);
//Reading the packet
lg = readstring();
username = readstring();
password = readstring();
short = readshort();
See when you set argument1 in writestring() to True then this adds a NULL terminator character at the end of it. This Null terminator will now be used to find when the string ends. Setting argument0 in readstring() to 0 (or leaving it blank) means to extract the string by finding the NULL terminator. This is also alot faster then a split_string() script written in gml.
Null terminator character is the ascii code 0 btw and is very rarely used in strings..apart from telling the app when the string finishes.
Edited by 39ster, 10 July 2005 - 08:20 AM.
#46
Posted 09 July 2005 - 02:51 PM
#47
Posted 11 July 2005 - 08:07 AM
#48
Posted 11 July 2005 - 11:04 AM
What do you mean with that? :/
"It now includes the zlib library so you can compress and decrompress the internal memory buffer."
Err.. since most of the data is already expressed as small as it could be, how could it be any smaller?
#49
Posted 11 July 2005 - 11:07 AM
#50
Posted 11 July 2005 - 11:12 AM
#51
Posted 11 July 2005 - 12:01 PM
Alright say you have a file and you load the file into the internal buffer using the file functions. Then use checksum() which will return a unique number and only a file with the exact same data in it will have that same checksum value. So if you have an online game that stores the levels on the server than when a player enters a level, you can use this to check if it needs updating."You can also create a checksum of the data inside the buffer!"
What do you mean with that? :/
"It now includes the zlib library so you can compress and decrompress the internal memory buffer."
Err.. since most of the data is already expressed as small as it could be, how could it be any smaller?
Also for compressing wont be useful for sending messages that are already smaller than 12 bytes. You can use it to compress files or large messages. It will still be much smaller even though you have written in different data types!
Ok im not saying this cause i made the dll but this IS better than gmsock! Im saying this to help you. Being able to write in binary mode is very important for online games and this makes it very easy to write in different data types. If people just tried this and played around with it you will find it is faster, more powerful and more stable than gmsock.
#52
Posted 11 July 2005 - 01:55 PM
@ 39ster and JochemWell, it depends more on the way you work around with it, but that's already explained a million times by other people. Though, if you use both DLL's at their best, I think this DLL would win, but pretty close, though.
right ok, cheers mate
Edited by RiChArD_fLoOd, 11 July 2005 - 01:56 PM.
#53
Posted 11 July 2005 - 02:16 PM
I think I've found a major bug:
If a program stops responding, it will fail to listen on any port, and perhaps using the whole DLL. I don't know how to solve this, I've tried to free the DLL, rebooted the pc, but it just doesn't work anymore.
I tried to let my program connect to my server (same pc), but I forgot to let the server handle the messages the client would send. (I did made the script, I just forgot to insert it in the server object.)
My time out code wasn't working (timed out way too fast), so I removed it (silly me). Result was that the while loop went on forever, making the program not responding, since the server wasn't handling its login-message, which he should be handling, if I had put in the script to handle them.
So, any way to fix this? I will try to use a different port for a temporary solution. :/
Edit: Nope, I can't use different ports either.
Jochem.
Edited by Jochem, 11 July 2005 - 02:18 PM.
#54
Posted 11 July 2005 - 02:28 PM
You do not need to have the packet seperated with "|".I was wondering something.
Is it necessary to send a string and the numeric values in different packets (when the numeric values are being packed with writebyte())?
I've made a string_split() script (how original!), which uses a character from the ASCII-table (like '|') to split different values from each other. Since some strings depend their size on their user, like names and passwords.
For example, I send the packet: "LG|Jochem|mypassword|5600" to log myself in. I could easily halve the size of bytes for 5600, but that isn't possible, because there is already used a ASCII-character for the strings, and the whole packet will be messed up when readed, thus leading to errors.
I did though of giving a name and password a fixed size, but that would be a waste of bandwith, wouldn't it?
Does anyone have any suggestions?
Just do:
//Building the packet
writestring("LG", true);
writestrng("Jochem", true);
writestring("mypassword", true);
writeshort(5600);
//Reading the packet
lg = readstring();
username = readstring();
password = readstring();
short = readshort();
See when you set argument1 in writestring() to True then this adds a NULL terminator character at the end of it. This Null terminator will now be used to find when the string ends. Setting argument0 in readstring() to 0 (or leaving it blank) means to extract the string by finding the NULL terminator. This is also alot faster then a split_string() script written in gml.
Null terminator character is the ascii code 0 btw and is very rarely used in strings..apart from telling the app when the string finishes.
Hello, look what im trying to do...
SERVER ACTIONS(sending login informations to client.)
clearbuffer();
writebyte(3);
writestring(charname,true);
writestring(job,true);
sendmessage(sock);
show_message("message sent with "+string(charname)+":"+string(job));the last line is just for test.CLIENT, RECEIVING....
case 3:
charname = "";job = ""
charname = readstring();
job = readstring();
show_message("Account: "+string(charname)+"..."+string(job))it isnt receiving anithing, the charname and job values stays ""
whats wroong?
Edited by Jonit, 11 July 2005 - 02:30 PM.
#55
Posted 11 July 2005 - 02:41 PM
case 3:
charname = "";job = ""
charname = readstring();
job = readstring();
show_message("Account: "+string(charname)+"..."+string(job))
Switch is 'readbyte()?' And don't forget to use brackets. :/
You can remove this:
charname = "";job = "". It's not needed.
Edited by Jochem, 11 July 2005 - 02:48 PM.
#56
Posted 11 July 2005 - 03:08 PM
Why would the program stop responding? I dont quite understand what your doing.I think I've found a major bug:
The while loops should not go on forever if youve made sure it exits the loop if recievemessage() return 0 or < 0.
From what i can see everything is correct so the error is occur somewhere else..like maybe before the switch function? I need the code for the actual recieving.Hello, look what im trying to do...
SERVER ACTIONS(sending login informations to client.)
#57
Posted 11 July 2005 - 04:09 PM
Edit: That's weird, your example still works. Hmmm.
Edit2: I get my game to work again, silly me, I put the 'listen' script accidently in the step event. :/
Edit3: I think the reason why most people skip at looking this thread, is because of the name. You don't have a real name for your DLL. Look at GMsock, it has a name that you won't forget very soon.
Edited by Jochem, 11 July 2005 - 06:18 PM.
#58
Posted 12 July 2005 - 11:47 AM
#59
Posted 12 July 2005 - 11:53 AM
#60
Posted 12 July 2005 - 12:11 PM
http://www45.brinkst...se/bal game.zip
Edited by matu666, 12 July 2005 - 12:11 PM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users









