Gamestudio Links
Zorro Links
Newest Posts
hello all
by jcl. 09/24/19 09:04
Right AssetsFix for trading Forex on IG?
by Andy60. 09/23/19 21:11
Converting fbx file to mdl7
by Dark_Light. 09/23/19 15:50
New system for Zorro S subscriptions
by jcl. 09/23/19 08:34
IG plugin initial release
by Andy60. 09/23/19 07:40
Any chance of PBR materials with A8?
by Dooley. 09/22/19 21:43
Levels, textures, etc for A8
by Dooley. 09/22/19 03:57
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
8 registered members (svenbob, Tamas, MatPed, Superku, kvm, jenGs, 3run, 1 invisible), 642 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Zylo, Hjuutgckk, Dark_Light, oxygenjoe, web20tpo
18292 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,811
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,811
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: 66
Baesweiler
Tele Offline
Junior Member
Tele  Offline
Junior Member

Joined: Mar 2005
Posts: 66
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,811
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,811
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,811
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,811
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