Welcome Guest [Log In] [Register]
We hope you enjoy your visit.


You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.

Join our community!

If you are already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
String to Real/Integer
Topic Started: Nov 16 2010, 08:20 PM (208 Views)
DJ-Habana
C# King
[ *  *  *  *  *  * ]
I am building my multiplayer now with 39dll
the problem is that if I send it like this

writeshort(x)
writeshort(y)
writeshort(z)
writeshort(roty)

then the object is wabling and that is not right

so now I go and I make a string

CRD = string(x)+'|'+string(y)+'|'+string(z)+'|'+string(roty)+'|';

and use this code do decode it then

function decode_string
str=argument0; // string to decode
obj=argument1; //obj to update with coordinates

var p;
p = string_pos('|',str);
temp = string_copy(str,1,p-1);
obj.x = real(temp);
str = string_delete(str,1,p);

p = string_pos('|',str);
temp = string_copy(str,1,p-1);
obj.y = real(temp);
str = string_delete(str,1,p);

p = string_pos('|',str);
temp = string_copy(str,1,p-1);
obj.z = real(temp);
str = string_delete(str,1,p);

p = string_pos('|',str);
temp = string_copy(str,1,p-1);
obj.roty = real(temp);
str = string_delete(str,1,p);


if I run then I get this error:


___________________________________________
ERROR in
action number 1
of Step Event
for object obj_39DllControl:

Error in function real().
Posted Image


Offline Profile Quote Post Goto Top
 
Despellanion
Member Avatar
Forum God
[ *  *  *  *  *  * ]
I don't know, I haven't had any problems with wabbling multiplayer position updates. Just make sure you aren't trying to send too much data at the same time, or there might be some packet loss or some packets not being sent properly. I've also had the real-error, and I think it's got to do with it trying to read funny values that aren't really numbers. You should check the actual value with a show_message or something, then it would be easier to spot the problem I think.
Offline Profile Quote Post Goto Top
 
DJ-Habana
C# King
[ *  *  *  *  *  * ]
this is what I send when it is wabling or something

clearbuffer();
writebyte(5);
writebyte(global.myid);
writeshort(x);
writeshort(y);
writeshort(z);
writeshort(roty);
sendmessage(global.clienttcp);

then a guy told me to put everything in one string

CRD = string(x)+'|'+string(y)+'|'+string(z)+'|'+string(roty)+'|';
clearbuffer();
writebyte(5);
writebyte(global.myid);
writestring(CRD,true)
sendmessage(global.clienttcp);


if it is packet loss how would I know that?
Posted Image


Offline Profile Quote Post Goto Top
 
DJ-Habana
C# King
[ *  *  *  *  *  * ]
should this be in a alarm event

clearbuffer();
writebyte(5);
writebyte(global.myid);
writeshort(x);
writeshort(y);
writeshort(z);
writeshort(roty);
sendmessage(global.clienttcp);

I saw it in alarm event in the example u3d + 39dll
Posted Image


Offline Profile Quote Post Goto Top
 
Despellanion
Member Avatar
Forum God
[ *  *  *  *  *  * ]
DJ-Habana
Nov 16 2010, 11:21 PM
should this be in a alarm event

clearbuffer();
writebyte(5);
writebyte(global.myid);
writeshort(x);
writeshort(y);
writeshort(z);
writeshort(roty);
sendmessage(global.clienttcp);

I saw it in alarm event in the example u3d + 39dll
You can have it in a alarm event, but you can also put it in a key-press event to save the server some work for idling players.
Offline Profile Quote Post Goto Top
 
DJ-Habana
C# King
[ *  *  *  *  *  * ]
Despellanion
Nov 16 2010, 11:26 PM
DJ-Habana
Nov 16 2010, 11:21 PM
should this be in a alarm event

clearbuffer();
writebyte(5);
writebyte(global.myid);
writeshort(x);
writeshort(y);
writeshort(z);
writeshort(roty);
sendmessage(global.clienttcp);

I saw it in alarm event in the example u3d + 39dll
You can have it in a alarm event, but you can also put it in a key-press event to save the server some work for idling players.
Cool Thanx going to give it a try
Posted Image


Offline Profile Quote Post Goto Top
 
DJ-Habana
C# King
[ *  *  *  *  *  * ]
damn it still jumps around
I wish I could explain what I see
Edited by DJ-Habana, Nov 17 2010, 07:51 AM.
Posted Image


Offline Profile Quote Post Goto Top
 
« Previous Topic · Off-topic · Next Topic »
Add Reply