Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (SBGuy), 712 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
cannot send string #446487
10/17/14 11:19
10/17/14 11:19
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Hi all,

For my multiplayer game, I want to send a string and var (array) from the server to the client to show hit indicator numbers on the client. The var array is sent correctly, but for some reason I cannot send the string properly crazy .

Code:
var sendindicator_colors[3] = { 0, 0, 0 };
STRING* sendindicator_str = "";
STRING* hitindicator_line1_str = "";
....

function calculate_hitindicator()
{
....
  //send string and array to client
  send_string (sendindicator_str); 
  send_var (sendindicator_colors);
}

function on_client_event(void* buffer) 
{
 if (event_type == EVENT_STRING)
 {
  ...
   //hit indicators
   if (buffer == sendindicator_str) 
   {
    hitindicator_showlines(); 
    str_cpy(hitindicator_line1_str, sendindicator_str);		
    vec_set(hitindicator_line1_txt.blue, vector(sendindicator_colors[0], sendindicator_colors[1], sendindicator_colors[2]));
   }	 
 } 
}



I have debug_vars on both the server and client so I can precisely see what goes well and what goes wrong. The debug_vars show e.g. sendindicator_colors[0] correctly, but e.g. draw_text(sendindicator_str,50,460,vector(100,100,255)); is only shown correctly on the server, and empty on the client. So something goes wrong with sending of the string?

I have checked my code with find text (ctrl+f) and nothing else messes with sendindicator_str.

Re: cannot send string [Re: Reconnoiter] #446497
10/17/14 20:53
10/17/14 20:53
Joined: Mar 2005
Posts: 68
Baesweiler
Tele Offline
Junior Member
Tele  Offline
Junior Member

Joined: Mar 2005
Posts: 68
Baesweiler
Hi Reconnoiter
Go to sehe site
http://www.coniserver.net/coni_users/web_users/pirvu/aum/aumonline_e/
and search to "send string server"
all info you need is in "Multiplayer"
Tele.

Re: cannot send string [Re: Tele] #446502
10/18/14 10:12
10/18/14 10:12
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
@Tele,

I appreciate your time to comment, but I have read that tutorial many times. I also have already a fully working chat system and other send_strings for my multiplayer game. The problem lies somewhere else. It does seem to send the string cause the line "if (buffer == sendindicator_str)" in function on_client_event is triggered. Also I send this string the same as other strings.

However the data send within the string (e.g. "test 15 damage" ) is not received on the client. The data or string pointer seems to be damaged for some reason.

I will try sending it as a struct, see if that helps.

Re: cannot send string [Re: Reconnoiter] #446503
10/18/14 12:11
10/18/14 12:11
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
I got it working! laugh

Using a struct does the trick, saves some overhead bandwidth and now less is calculated on the server and more on the client (non cheatable stuff). Since the server does not create the string now, but the client does with the variables it gets from server.


Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1