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
5 registered members (Dico, AndrewAMD, TipmyPip, NewbieZorro, Grant), 15,253 guests, and 5 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
Client joining during game not up to date #154935
09/17/07 22:30
09/17/07 22:30
Joined: Sep 2003
Posts: 9,859
F
FBL Offline OP
Senior Expert
FBL  Offline OP
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
I've built up a structure where te server starts the functions on client side when a newly joined client creates his player.

This works fine so far by using proc_local (and proc_client - I'm not going into detail now).

My problem is, that when another client joins during the game (session_connect()) the entity of the first client is not created on the newly joined client.
What is the best way to get the entity created and updated on the client as well?

I'm not using ent_createlocal for the players on the clients - instead I'm just creating the entites on the servers, set nosend flag, move them separately on client and server and sync the clients to the server every second. This is working pretty fine so far.

But I need to get the entity appearing on later joined clients as well.
How is this usually done? Any easy solution for this problem?

Everything else is working fine - at least on a single pc

Re: Client joining during game not up to date [Re: FBL] #154936
09/18/07 06:52
09/18/07 06:52
Joined: Aug 2003
Posts: 425
DocJoe Offline
Senior Member
DocJoe  Offline
Senior Member

Joined: Aug 2003
Posts: 425
Due to your post I tested with 1 server and 2 clients (before I only tested with 1 server and 1 client) and can confirm your observation, there's still at least one bug. I'll post this in beta forum with a link to your post here.


Don't take the cake to the party.
Re: Client joining during game not up to date [Re: DocJoe] #154937
09/18/07 15:35
09/18/07 15:35
Joined: Sep 2003
Posts: 9,859
F
FBL Offline OP
Senior Expert
FBL  Offline OP
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
Oh, that's a bug?

Re: Client joining during game not up to date [Re: FBL] #154938
09/23/07 12:31
09/23/07 12:31
Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
TSG_Torsten Offline

User
TSG_Torsten  Offline

User

Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
Same here, second client don't see the entity of the first one.

Re: Client joining during game not up to date [Re: TSG_Torsten] #154939
10/08/07 16:16
10/08/07 16:16
Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
TSG_Torsten Offline

User
TSG_Torsten  Offline

User

Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
Does someone have any suggestions to solve this problem?

Regards
TSGames

Re: Client joining during game not up to date [Re: TSG_Torsten] #154940
10/09/07 08:40
10/09/07 08:40
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline
User
demiGod  Offline
User

Joined: Mar 2006
Posts: 752
Portugal
Dont know if this can help you actually, but if you are creating the players on server, using local procedures like proc_local it should work with all clients..

Just one thing that you may check, if you didnt allready: before using proc_local dont forget do put a sleep(1);, otherwise proc_local dont update the info on clients, it needs to wait after entity creation on server, but probably you allready saw that.

Hope it helps.

Re: Client joining during game not up to date [Re: demiGod] #154941
10/09/07 09:56
10/09/07 09:56
Joined: Sep 2003
Posts: 9,859
F
FBL Offline OP
Senior Expert
FBL  Offline OP
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
My problem is solved meanwhile.
It was not a wait issue and not a bug either, but had to do with NOSEND flag being set. It also prevents further joining clients from being updated correctly.

What I did was adding a event when a client joins. If that happens, the servre sets a global variabel, and all entities poll this variable. If it is one, the NOSEND flag is reset for a short time, allowing to update the clients, and then set again.

Code:


var vClientJoin = 0;

//assign to "on_server"
void net_sv_event()
{
switch (event_type)
{
case EVENT_JOIN:
vClient_join ++;
wait (dplay_entrate + 1);
vClient_join --;
break;

default:
break;
}
}

//call from entity server loop with "my" as parameter
void net_ent_upd(ENTITY* ent)
{
/* in case a new client joined, enable auto send of entity for a short time
NOSEND must only be reset once, since this function is called every frame.
Having a wait() will cause it to run in parallel for the same entity for
a short time.
*/
if (vClient_join > 0 && (ent->smask & NOSEND) == NOSEND)
{
ent->smask &= ~NOSEND;
wait (dplay_entrate);
ent->smask |= NOSEND;
}
}



This solution somehow is clumsy (the wait() inside an event function is disturbuing...) and I haven't tested it for online gaming, but in LAN it solves the problem for me.


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