2 registered members (Ayumi, 1 invisible),
584
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: ANet - The ultimate networkplugin for GS [Demo]
[Re: Dark_samurai]
#236169
11/12/08 13:57
11/12/08 13:57
|
Joined: Nov 2007
Posts: 1,032 Croatia
croman
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,032
Croatia
|
Hey, I have a question for you. When i start serverclient mode it works just fine and then when i start the other main.exe file with client mode it crashes. Can you please take a look into a code?
//------------------------------------------------------------------------------------------
//
//
//------------------------------------------------------------------------------------------
void start_server()
{
//Server modus
enet_init_server(2300,4,_str("")); //initializes the server with port 2300,
//with max. 4 Clients and no password
while(enet_get_connection() == 1)
{
enet_server_poll(); //...needs to be called every frame!
wait(1);
}
}
STRING* svip = "#12";
//------------------------------------------------------------------------------------------
//
//
//------------------------------------------------------------------------------------------
void start_client()
{
//Client modus
enet_init_client(_str("127.0.0.1"),2300,_str("")); //Initializes a client
//which connects over the localhost with the server
while(enet_get_connection() == 2) //as long as the client-server mode consists
{
enet_client_poll();
wait(1);
}
}
//------------------------------------------------------------------------------------------
//
//
//------------------------------------------------------------------------------------------
void start_clientserver()
{
//Client-Server Modus:
enet_init_server(2300,4,_str("")); //Initializes the server
enet_init_client(_str("127.0.0.1"),2300,_str("")); //Initializes a client
//which connects over the localhost with the server
while(enet_get_connection() == 3) //as long as the client-server mode consists
{
enet_server_poll(); //...needs to be called every frame!
enet_client_poll();
wait(1);
}
}
var filehandle;
STRING* svcl = "#2";
//------------------------------------------------------------------------------------------
//
//
//------------------------------------------------------------------------------------------
function main()
{
enet_init(); //ENet is initialized
randomize();
fps_max = 60;
video_mode = 8;
video_depth = 32;
video_screen = 2;
time_smooth = 0.9;
fog_color = 1;
vec_set(screen_color,vector(150,0,0));
camera.fog_end = 75000;
filehandle = file_open_read("svcl.txt");
file_str_read(filehandle, svcl);
file_close(filehandle);
if(str_cmp(svcl, "3") == 1){start_clientserver();}
if(str_cmp(svcl, "2") == 1){start_client();}
if(str_cmp(svcl, "1") == 1){start_server();}
wait(-0.5);
if(enet_get_connection() == 0){
sys_exit(NULL);
}
wait(-0.5);
level_load("test.wmb");
//enet_set_level("test.wmb");
wait(5);
enet_ent_synchronize();
wait(-0.5);
camera.x = camera.y = camera.tilt = wheel_i = vehicle_i = 0;
on_e = reset_vehicle_manually;
on_f1 = main;
ph_setgravity(vector(0, 0, -320 * 1.4));
ph_setcorrections(25000, 0.05);
camera.x = -500;
camera.y = -500;
camera.z = 150;
camera.pan += 45;
camera.tilt -=15;
player = enet_ent_create(_str("aut_f360.mdl"), vector (random(200), random(200), 50), _str("vehicle"));
wait(1);
enet_ent_create (_str("rue_360_d.mdl"), vector (player.x + 17, player.y + 21, player.z - 4.5), _str("tire")); // FR
enet_ent_create (_str("rue_360_i.mdl"), vector (player.x - 17, player.y + 21, player.z - 4.5), _str("tire")); // FL
enet_ent_create (_str("rue_360_i.mdl"), vector (player.x - 17, player.y - 33, player.z - 4.5), _str("tire")); // RL
enet_ent_create (_str("rue_360_d.mdl"), vector (player.x + 17, player.y - 33, player.z - 4.5), _str("tire")); // RR
}
Ubi bene, ibi Patria.
|
|
|
Re: ANet - The ultimate networkplugin for GS [Demo]
[Re: croman]
#236171
11/12/08 14:12
11/12/08 14:12
|
Joined: Jul 2005
Posts: 1,930 Austria
Dark_samurai
OP
Serious User
|
OP
Serious User
Joined: Jul 2005
Posts: 1,930
Austria
|
Hmm... I think the problem is how you call enet_ent_synchronize(); This function should be called in the "Connected with Server" event (look at enet_set_event) and should only be called as client! And you shouldn't create an entity until the synchronizing is finished (= after "Synchronizing complete" is called). Correct synchronizing should be done like this:
function connected_with_server_event(var sender, STRING* msg)
{
enet_ent_synchronize();
}
function synchronizing_complete(var sender, STRING* msg)
{
//now you can create your Entities
}
PS: Don't forget to register your functions with enet_set_event()! Things like correct synchronizing, level changing,... will be explained in the first tutorial. It's about creating an application where you can select a player, move around with it, shows the playername above the head of the player, simple chatting, correct synchronizing, level changing, kicking a client, correct disconnecting. So I think that this will clear up all necessary things which are important for creating a MP-Game. I think the tutorial will come this weekend (available in german and english)!
ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)! get free version
|
|
|
Re: ANet - The ultimate networkplugin for GS [Demo]
[Re: Dark_samurai]
#236192
11/12/08 18:10
11/12/08 18:10
|
Joined: Oct 2007
Posts: 5,210 Ä°stanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
|
event 3(connected with server) is not triggered.
1(client connected) on server is triggered, but 3 on client is not.
4-> disconnected from server works too.
3333333333
|
|
|
Re: ANet - The ultimate networkplugin for GS [Demo]
[Re: Quad]
#236194
11/12/08 18:33
11/12/08 18:33
|
Joined: Jul 2005
Posts: 1,930 Austria
Dark_samurai
OP
Serious User
|
OP
Serious User
Joined: Jul 2005
Posts: 1,930
Austria
|
Can you send my your current code with a PM, please? I don't want to mess up this thread...
There must be something wrong in your code, because these events are working for sure.
ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)! get free version
|
|
|
Re: ANet - The ultimate networkplugin for GS [Demo]
[Re: Dark_samurai]
#236199
11/12/08 19:11
11/12/08 19:11
|
Joined: Nov 2007
Posts: 1,032 Croatia
croman
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,032
Croatia
|
okay it works now, thanks. i'm looking forward to your tutorials this weekend.
and what about version types(free, standard...) and their features and prices? can you post that here?
Ubi bene, ibi Patria.
|
|
|
Re: ANet - The ultimate networkplugin for GS [Demo]
[Re: Puppeteer]
#236203
11/12/08 19:36
11/12/08 19:36
|
Joined: Jul 2005
Posts: 1,930 Austria
Dark_samurai
OP
Serious User
|
OP
Serious User
Joined: Jul 2005
Posts: 1,930
Austria
|
but it is not yet ultimate since the send_unriliable is still missing :-P Look under enet_set_unreliable() in general functions (=Verwaltungsfunktionen) => It is ultimate ^^ Edit: Sorry forgot to answer your question: and what about version types(free, standard...) and their features and prices? can you post that here? The free/demo version is what you have now. Standard will be the same (same features) but connection limit will be 32. Pro has unlimited connections, you can use udp function (broadcast without a connection) and http function (both needed for creating a serverlist-system), extended playername system with skills and strings for each player which are automatically synchronized (can be used for a statistic list like in cs when you press [tab]), encryption, compression,... These features are planned, I can't prommise that all these features will be implented! I still don't know how expensive the versions will be. @all: Thanks for these nice words!
Last edited by Dark_samurai; 11/12/08 20:32.
ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)! get free version
|
|
|
Re: ANet - The ultimate networkplugin for GS [Demo]
[Re: Dark_samurai]
#236216
11/12/08 20:49
11/12/08 20:49
|
Joined: Apr 2007
Posts: 3,751 Canada
WretchedSid
Expert
|
Expert
Joined: Apr 2007
Posts: 3,751
Canada
|
Ok, hab da ein Problem und da ich das auf deutsch besser erklären kann, schreib ich jetzt einfach deutsch. Sry schonmal dafür. Also ich starte einen Server indem ich die funktion start_server aufrufe: void start_server()
{
enet_init_server(2300,4,_str(""));
while(enet_get_connection() == 1)
{
enet_server_poll();
wait(1);
}
} und wenn ich danach den Status über if(enet_get_connection() == 0) {error("Keine Verbindung!");}
if(enet_get_connection() == 1) {error("Server!");}
if(enet_get_connection() == 2) {error("Client!");}
if(enet_get_connection() == 3) {error("Client-Server!");} überprüfe kommt immer "Keine Verbindung" also irgendwas stimmt da nicht. enet_init(); ruf ich natürlich davor auf. So sieht meine main funktion aus: void main()
{
enet_init();
start_server();
wait(-1);
check_status();
}
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com
|
|
|
|