Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (TipmyPip, AndrewAMD, dBc), 18,430 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Testing MP with Commercial on one PC (German and English) #214569
07/05/08 13:10
07/05/08 13:10
Joined: Mar 2007
Posts: 151
JokeSpeaker Offline OP
Member
JokeSpeaker  Offline OP
Member

Joined: Mar 2007
Posts: 151
German:
Hi, ich habe ein Problem mit der Multiplayer Engine der Commercial-Version und würde mich freuen, wenn ihr mir helfen könnt.

Ich habe geplant, ein ganz simples Schiffeversenken-Online zu machen. Zuerst habe ich einfach nur dies getestet, indem ich zwei Fenster öffne, einmal als Server und Client und einmal als Client, beides auf einem PC. Sie bestehen nur aus schwarzen Hintergrund und zeigen Strings an, je nach Aufforderung.

So verläuft das Ganze:
Ich starte den Server und sobald das weiße Startfenster verschwindet und das Spiel startet, erscheint die Zeile "der Server wurde gestartet", was bedeutet, dass der Server erfolgreich gestartet wurde. Danach starte ich einen Clienten. Im Server erscheint die Zeile "Client0932blabla hat sich eingeloggt.". Nun schicke ich vom Server aus die Zeile "Spam", welche dann auf dem Server erscheint, allerdings nicht auf dem Clienten, was bedeutet, dass keine Verbindung besteht, obwohl im weißen Startfenster stand, dass sie erfolgreich verbunden wurden. Also die Send-Befehle funktionieren nicht.

Woran liegt nun das Problem? Liegt es am Script oder unterstützt die Commercial-Version keinen Server, der zugleich als Client arbeitet oder unterstützt sie keine Verbindung auf einem einzigen Rechner? Oder kann es sein dass die Firewall blockt, obwohl ich diese abgestellt habe?

English:
Hi, I have a problem with the multiplayer system from the commercial version. I will be very thankful if you help me.

I have planed to make an simple battleship online game. First I tested the connection with a client and a client+server (-cl -sv). These should only show strings on a black background.

When I started the server, the white load-window at the start say that the server was started easily. And then I start the client and in the server the string "Client893... has joined." appears. In the load-window of the client the line that says that the connection to the server was succesfull appeared. Now the server should send the string "spam" to the client, but no string appears in the client. No send-commands are succesful.

Do someone know where the problem is? Can it be an error in the script or doesn't the commercial version support running a server also as a client (-cl+-sv-command) or doesn't support this version testing multiplayer on only one computer? Or blocks the firewall the connection? (But I disabled the firewall.)

I hope, my english is understandable.

MfG JokeSpeaker

Re: Testing MP with Commercial on one PC (German and English) [Re: JokeSpeaker] #214577
07/05/08 14:20
07/05/08 14:20
Joined: Nov 2007
Posts: 1,032
Croatia
croman Offline
Serious User
croman  Offline
Serious User

Joined: Nov 2007
Posts: 1,032
Croatia
i had the same problem with strings. i couldnt send string from server to client. You need to use second string for sending. make sendStr and copy spamStr to it and send sendstr to client. that worked in my case...



Ubi bene, ibi Patria.
Re: Testing MP with Commercial on one PC (German and English) [Re: croman] #214578
07/05/08 14:45
07/05/08 14:45
Joined: May 2008
Posts: 33
Russia/Netherlands
H
Hand_Of_Law Offline
Newbie
Hand_Of_Law  Offline
Newbie
H

Joined: May 2008
Posts: 33
Russia/Netherlands
I have made this simple code for a multi player chat.
It handles sending strings between client and server and displaying them in a panel.

Also check out AUM74, there is a workshop on the basics for this.

Quote:
#include <acknex.h>
#include <default.c>

STRING* messages_str = "#50";
STRING* connected_str = "#50";
STRING* temp_str = "#10";
STRING* chat_entry = "#100";
STRING* chat_send = "#100";

STRING* Chat0 = "#100";
STRING* Chat1 = "#100";
STRING* Chat2 = "#100";
STRING* Chat3 = "#100";
STRING* Chat4 = "#100";
STRING* Chat5 = "#100";
STRING* Chat6 = "#100";
STRING* Chat7 = "#100";
STRING* Chat8 = "#100";
STRING* Chat9 = "#100";

var People_connected = 0;

FONT* Arial_font = "Arial#12";

TEXT* messages_txt =
{
pos_x = 300;
pos_y = 1;
layer = 10;
font(Arial_font);
string (messages_str);
flags = visible;
}

TEXT* chatentry_txt =
{
pos_x = 0;
pos_y = 0;
layer = 20;
font(Arial_font);
string(chat_entry);
flags = visible;
}

TEXT * chatwindow_txt =
{
pos_x = 0;
pos_y = 0;
layer = 20;
font(Arial_font);
string(Chat0,Chat1,Chat2,Chat3,Chat4,Chat5,chat6,chat7,chat8,chat9);
flags = visible;
}

TEXT* connected_txt =
{
pos_x = 500;
pos_y = 0;
layer = 10;
font(Arial_font);
string(connected_str);
flags = visible;
}

BMAP* Chatmap = "Chat.jpg";

PANEL* Chat_panel =
{
bmap = Chatmap;
pos_x = 0;
pos_y = 0;
layer = 15;
flags = visible,overlay,translucent;
}

function display_info();
function server_event();
function client_event();

function init_chat()
{
if (connection == 2 | connection == 3)
{
Chat_panel.pos_y = 0;
chatwindow_txt.pos_y = 0;
chatentry_txt.pos_y = 135;
}
}

void input_chat()
{
if (connection == 2 | connection == 3)
{
if (inkey_active) return;
str_cpy(chat_entry,"#100");
inkey(chat_entry);
if (result == 13)
{
str_cpy(chat_send,player_name);
str_cat(chat_send,": ");
str_cat(chat_send,chat_entry);
send_string(chat_send);
if (connection == 3)
{
str_cpy(Chat0,Chat1);
str_cpy(Chat1,Chat2);
str_cpy(Chat2,Chat3);
str_cpy(Chat3,Chat4);
str_cpy(Chat4,Chat5);
str_cpy(Chat5,Chat6);
str_cpy(Chat6,Chat7);
str_cpy(Chat7,Chat8);
str_cpy(Chat8,Chat9);
str_cpy(Chat9,chat_send);
}
wait(1);
str_cpy(chat_entry,"#100");
\ }
}
}

function main()
{

fps_max = 60; // limit the number of data packets that are sent each second to 60
vec_set(screen_color, vector(100, 10, 0));
init_chat();
on_t = input_chat;
on_server = server_event;
on_client = client_event;
if (!connection)
{
str_cpy(messages_str, "Can't find any server. Please try again later.");
wait (-4);
sys_exit(NULL);
}
if (connection == 2)
{
str_cpy(messages_str, "Running as a client.");
}
else
{
str_cpy(messages_str, "Running as a server.");
str_cat(messages_str, "\nServer IP address: ");
str_cat(messages_str, server_ip);
str_cat(messages_str, "\nServer name: ");
str_cat(messages_str, server_name);
if (connection == 3)
{
People_connected = 1;
}
}
// the code below will run on the client, as well as on the server
str_cat(messages_str, "\nLevel name: ");
str_cat(messages_str, level_name);
str_cat(messages_str, "\nApplication name: ");
str_cat(messages_str, app_name);
str_cat(messages_str, "\nPlayer name: ");
str_cat(messages_str, player_name);
str_cat(messages_str, "\nSession name: ");
str_cat(messages_str, session_name);
str_cpy(connected_str, "Connected: ");
str_for_num(temp_str, People_connected);
str_cat(connected_str, temp_str);
str_cat(connected_str, "\nPing : ");
str_for_num(temp_str, dplay_latency);
str_cat (connected_str, temp_str);
}

function server_event()
{
if (event_type == EVENT_JOIN)
{
wait(-3);
People_connected += 1;
send_var(People_connected);
}
if (event_type == EVENT_STRING)
{
str_cpy(Chat0,Chat1);
str_cpy(Chat1,Chat2);
str_cpy(Chat2,Chat3);
str_cpy(Chat3,Chat4);
str_cpy(Chat4,Chat5);
str_cpy(Chat5,Chat6);
str_cpy(Chat6,Chat7);
str_cpy(Chat7,Chat8);
str_cpy(Chat8,Chat9);
str_cpy(Chat9,chat_send);
send_string(chat_send);
}
}

function client_event()
{
if (event_type == EVENT_JOIN)
{
wait(-3);
People_connected += 1;
send_var(People_connected);
}
if (event_type == EVENT_STRING)
{
str_cpy(Chat0,Chat1);
str_cpy(Chat1,Chat2);
str_cpy(Chat2,Chat3);
str_cpy(Chat3,Chat4);
str_cpy(Chat4,Chat5);
str_cpy(Chat5,Chat6);
str_cpy(Chat6,Chat7);
str_cpy(Chat7,Chat8);
str_cpy(Chat8,Chat9);
str_cpy(Chat9,chat_send);
}
}


Re: Testing MP with Commercial on one PC (German and English) [Re: Hand_Of_Law] #214579
07/05/08 14:47
07/05/08 14:47
Joined: Nov 2007
Posts: 1,032
Croatia
croman Offline
Serious User
croman  Offline
Serious User

Joined: Nov 2007
Posts: 1,032
Croatia
well, that chat code is same as from locoweed's multiplayer tutorial smile ...anyway try what i told you, it will work, i'm sure cause that was my problem too...



Ubi bene, ibi Patria.
Re: Testing MP with Commercial on one PC (German and English) [Re: croman] #214597
07/05/08 17:02
07/05/08 17:02
Joined: Mar 2007
Posts: 151
JokeSpeaker Offline OP
Member
JokeSpeaker  Offline OP
Member

Joined: Mar 2007
Posts: 151
Oh, I oversighed the new AUM. Thanks to all you who helped me. ^^

EDIT: I tested the AUM Chat and tried it to open too many clients. And the error "Too many Clients [OK] [Cancel]" appeared. Thats ok, but if I click Ok, the server will be closed too. Will it happens in online playing with more PCs too?

Last edited by JokeSpeaker; 07/05/08 17:19.
Re: Testing MP with Commercial on one PC (German and English) [Re: JokeSpeaker] #215275
07/10/08 09:14
07/10/08 09:14
Joined: Mar 2007
Posts: 151
JokeSpeaker Offline OP
Member
JokeSpeaker  Offline OP
Member

Joined: Mar 2007
Posts: 151
So, I have a new problem:
If I send arrays with the bigness of 13x13 from a client to the server, the array will arrive errorless, but if I send 4 arrays with 13x13 or an array with 5x13x13 at the same time from the server to all 2-4 clients, the clients won't become the array. The data in the arrays of the clients is the same how before.
Can be the problem triggered by the script, the connection or by another thing?

Re: Testing MP with Commercial on one PC (German and English) [Re: JokeSpeaker] #215279
07/10/08 09:50
07/10/08 09:50
Joined: Nov 2007
Posts: 1,032
Croatia
croman Offline
Serious User
croman  Offline
Serious User

Joined: Nov 2007
Posts: 1,032
Croatia
can i see part of the code where you send those arrays and part where client deals with them once he receives them?



Ubi bene, ibi Patria.
Re: Testing MP with Commercial on one PC (German and English) [Re: croman] #215284
07/10/08 10:06
07/10/08 10:06
Joined: Mar 2007
Posts: 151
JokeSpeaker Offline OP
Member
JokeSpeaker  Offline OP
Member

Joined: Mar 2007
Posts: 151
Here is the code where the server send the 4 arrays to the clients:

send_var(OwnRT1); //sending the 4 Arrays
send_var(OwnRT2);
send_var(OwnRT3);
send_var(OwnRT4);
wait(20);
OwnSetted = 1; //Saying that the Arrays was sent.
send_var(OwnSetted);

and here is the code, where the client disposes the array:

while(OwnSetted == 0) wait(1); //waiting for the "Saying"
SetArrayInMain(1); //set the arrays in the main array (surely errorless)
SetArrayInMain(2);
SetArrayInMain(3);
SetArrayInMain(4);

I tested it with many ways and discovered that the arriving OwnRT-Arrays have only 0,0,0,0,etc.. So they have the same worth as before.

Last edited by JokeSpeaker; 07/10/08 10:07.
Re: Testing MP with Commercial on one PC (German and English) [Re: JokeSpeaker] #215286
07/10/08 10:14
07/10/08 10:14
Joined: Nov 2007
Posts: 1,032
Croatia
croman Offline
Serious User
croman  Offline
Serious User

Joined: Nov 2007
Posts: 1,032
Croatia
try to use another array just for sending. before sending ownrt1 copy it into sendVar = ownrt1; and then send sendVar over to client.



Ubi bene, ibi Patria.
Re: Testing MP with Commercial on one PC (German and English) [Re: croman] #215290
07/10/08 10:34
07/10/08 10:34
Joined: Mar 2007
Posts: 151
JokeSpeaker Offline OP
Member
JokeSpeaker  Offline OP
Member

Joined: Mar 2007
Posts: 151
thanks, but it hasn't functioned. Is the array too big?

Page 1 of 2 1 2

Moderated by  HeelX, Spirit 

Gamestudio download | 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