Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Nymphodora, Quad), 919 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 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