|
mp_template_v2 Help
#453257
07/14/15 18:28
07/14/15 18:28
|
Joined: Apr 2005
Posts: 1,988 Canadian, Eh
DLively
OP
Serious User
|
OP
Serious User
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
|
Hi There. Im using the new multiplayer template from the latest AUM 114. I am trying to convert the number pressing to buttons, as to make a more appealing menu.. I've got everything working fine, besides one small thing... If you've used the template you'd know that when you start a dedicated server that is_client = !key_1; // or 1 if you've pressed 2 and 0 if you've pressed 1 This is my Mod:
///////////////////////////////
// mp_main.c
// by Superku, 2015
// [EDIT by Superku: removed e-mail]
///////////////////////////////
#define PRAGMA_PATH "gui"
#include <acknex.h>
#include <default.c>
#include "mp_helper.c"
#include "mp_chat.c"
#include "mp_weapons.c"
#include "mp_player.c"
var menu_panel_selected = 0;
BMAP* dserver_map = "dserver.tga";
BMAP* lanclient_map = "lancli.tga";
BMAP* onclient_map = "onlicli.tga";
BMAP* servclient_map = "servcli.tga";
function center_panel(PANEL* panel, BMAP* Bmap){
panel.pos_x = (screen_size.x - bmap_width(Bmap))/2;
panel.pos_y = (screen_size.y - bmap_height(Bmap))/2;
}
///////////////////////////////
...
function dserver_button(){
is_client = 0;
session_open("mpsession");
menu_panel_selected = 1;
}
function server_client_button(){
is_client = 1;
session_open("mpsession");
menu_panel_selected = 2;
}
function lanclient_button(){
session_connect("mpsession","");
menu_panel_selected = 3;
}
function online_client_button();
PANEL* dedicated_server_pan={
button(0,0,dserver_map,dserver_map,dserver_map,dserver_button,NULL,NULL);
button(0,78,servclient_map,servclient_map,servclient_map,server_client_button, NULL,NULL);
button(0,156,lanclient_map,lanclient_map,lanclient_map,lanclient_button, NULL,NULL);
button(0,234,onclient_map,onclient_map,onclient_map,online_client_button, NULL,NULL);
flags = SHOW;
}
function online_client_button(){
set(txt_ip_input,SHOW);
txt_ip_input.pos_x = screen_size.x/2;
txt_ip_input.pos_y = screen_size.y*0.334;
reset(dedicated_server_pan, SHOW);
ip_input();
while(!key_enter)
{
DEBUG_VAR(total_frames,300);
if(key_ctrl) inkey_active = 0;
if(!key_ctrl || !key_v) key_ctrl_v_off = 1;
else
{
if(key_ctrl_v_off)
{
key_ctrl_v_off = 0;
clipboard_get_string(str_ip_address);
wait(1);
ip_input();
}
}
wait(1);
}
str_cpy((txt_ip_input.pstring)[2],"Trying to connect to address...");
wait(2);
session_connect("mpsession",str_ip_address);
menu_panel_selected = 4;
}
////////////////////////////////////////192.168.0.101
void main()
{
fps_max = 60;
vec_set(screen_color,COLOR_BLACK);
vec_set(sky_color,COLOR_BLACK);
sun_light = 50;
video_mode = 8;
video_aspect = 1.777;
camera.clip_near = 2;
camera.clip_far = 10000;
random_seed(0);
init_dplay_settings(); // call this function before the first wait() instruction
wait(1);
draw_textmode("Arial",1,20,100);
// basic game menu stuff
mouse_mode = 2;
while(menu_panel_selected == 0) // server or client?
{
vec_set(mouse_pos,mouse_cursor);
center_panel(dedicated_server_pan, dserver_map);
wait(1);
}
reset(dedicated_server_pan, SHOW);
dplay_level_load("map1.wmb"); // use this function to load the first multiplayer level
weapon_models_init();
set(txt_chat_main,SHOW);
if(connection != 2) init_server();
else init_client();
wait(1);
if(is_client)
{
spawn_get_position(temp);
player = ent_create("guard.mdl",temp,fnc_player);
while(player.client_id != dplay_id)
{
draw_text(str_printf(NULL,"Waiting for Player Creation... %.3f",(double)player.client_id),20,20,COLOR_WHITE);
wait(1);
}
if(connection != 2)
{
int i;
/*if(connection == 3)
{
i = player_id_get(0);
if(i > 0) str_cpy(str_pl_names[i-1],"Server Player");
}*/
for(i = 0; i < 2; i++)
{
spawn_get_position(temp);
you = ent_create("guard.mdl",temp,fnc_player);
your.ai_controlled = 1+i;
}
}
}
}
////////////////////////////////////////
Basically, it when i connect through online connect or lan connect, it just gives a topview like the server view,Adds the clients, but there is no fps view any help or thoughts?
Last edited by Superku; 11/17/16 18:11. Reason: removed e-mail
|
|
|
Re: mp_template_v2 Help
[Re: DLively]
#453260
07/14/15 21:36
07/14/15 21:36
|
Joined: Jan 2006
Posts: 968
EpsiloN
User
|
User
Joined: Jan 2006
Posts: 968
|
I havent used the template and I'm not familiar with it, but my guess is that it joins, but doesnt act as a client. You probably are missing some definition somewhere, that this app should be a client app... Here's my implementation (not a real template, but more like a base for MP projects): Multiplayer - Basic Extensive Tutorial
|
|
|
Re: mp_template_v2 Help
[Re: Superku]
#453488
07/28/15 23:22
07/28/15 23:22
|
Joined: Apr 2005
Posts: 1,988 Canadian, Eh
DLively
OP
Serious User
|
OP
Serious User
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
|
Sorry for the delay, I've been very busy.
adding "is_client = 1;" to function lanclient_button() fixed it
The time stamps (what I suspect) are caused when about 4 or so people connect to the server.
Last edited by DLively; 07/28/15 23:24.
|
|
|
Re: mp_template_v2 Help
[Re: Superku]
#453509
07/29/15 21:54
07/29/15 21:54
|
Joined: Apr 2005
Posts: 1,988 Canadian, Eh
DLively
OP
Serious User
|
OP
Serious User
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
|
Sa-weet I noticed that it generally only happens if there are clients connected or joining... Edit: the error mostly happens while playing though... and then the server gets the error message too. Edit2: I also wanted to mention that I left a dedicated server running all night with no errors
Last edited by DLively; 07/29/15 22:11.
|
|
|
Re: mp_template_v2 Help
[Re: DLively]
#453524
07/30/15 18:33
07/30/15 18:33
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
Hm not completely sure what causes the issue but I think it's a one time issue when a new client connects and the game time isn't synchronized yet. Please try the following patch: http://superku.de/mp_template_v2patch1.zip(EDIT: Updated with another micro patch.)
Last edited by Superku; 07/31/15 10:15.
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual Check out my new game: Pogostuck: Rage With Your Friends
|
|
|
Re: mp_template_v2 Help
[Re: Superku]
#453557
07/31/15 23:06
07/31/15 23:06
|
Joined: Apr 2005
Posts: 1,988 Canadian, Eh
DLively
OP
Serious User
|
OP
Serious User
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
|
It seems to be working much better on my end anyway.. I haven't received the error message again but we only had it open for 10 minutes. maybe 15. But we received the errors long before that amount of time with the previous version. So as far as I can tell its working the way it should. I haven't tried the micro patch yet tho... Will let you know as soon as I do BTW: Thanks for your help, and also -> Thanks for this awesome multiplayer template... Its very well coded
Last edited by DLively; 07/31/15 23:07.
|
|
|
|