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
5 registered members (Nymphodora, AndrewAMD, TipmyPip, Quad, Imhotep), 847 guests, and 4 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
mp_template_v2 Help #453257
07/14/15 18:28
07/14/15 18:28
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline 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:
Code:
///////////////////////////////
// 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

A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: mp_template_v2 Help [Re: DLively] #453258
07/14/15 19:12
07/14/15 19:12
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Also, what is the reason for invalid time stamps?


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: mp_template_v2 Help [Re: DLively] #453260
07/14/15 21:36
07/14/15 21:36
Joined: Jan 2006
Posts: 968
EpsiloN Offline
User
EpsiloN  Offline
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


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: mp_template_v2 Help [Re: EpsiloN] #453300
07/17/15 15:25
07/17/15 15:25
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
"there is no fps view"
You mean on the dedicated server? That's the point of it, yes. Or do you mean the clients themselves?

Btw. you need to disable mouse_mode again after your selection, otherwise you should not be able to rotate the player.

"Also, what is the reason for invalid time stamps?"
When do you get those error messages precisely?


"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] #453488
07/28/15 23:22
07/28/15 23:22
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline 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.

A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: mp_template_v2 Help [Re: DLively] #453489
07/29/15 03:41
07/29/15 03:41
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
rewind_do: invalid time stamp

that is the error. it crashes the server.
I have not yet seen the error when there is only a server running...
the error is produced when there is one or more clients, and we all get them at the same time..

any thoughts?


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: mp_template_v2 Help [Re: DLively] #453493
07/29/15 06:50
07/29/15 06:50
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
That's strange but I think I should be able to fix that later today or tomorrow!
Does it happen when a new client connects or while playing?


"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] #453509
07/29/15 21:54
07/29/15 21:54
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Sa-weet laugh I noticed that it generally only happens if there are clients connected or joining... laugh

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 wink

Last edited by DLively; 07/29/15 22:11.

A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
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 Offline
Senior Expert
Superku  Offline
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 Offline OP
Serious User
DLively  Offline 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 laugh

Last edited by DLively; 07/31/15 23:07.

A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com

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