Raydium 3D Game Engine
https://memak.raydium.org/

raydium_network_propag_refresh doesn't work
https://memak.raydium.org/viewtopic.php?f=8&t=2342
Page 1 of 1

Author:  bitrider [ Sat Apr 11, 2015 9:35 pm ]
Post subject:  raydium_network_propag_refresh doesn't work

Hi,

i need to send an array from server to clients:

Code:
int startgrid[RAYDIUM_NETWORK_MAX_CLIENTS][2];


For every client it contains two ints: start grid race position and car livery id

I want to send the array to every new client connected:

Code:
void new_client(int client)
{
raydium_network_propag_refresh(NET_STARTGRID);
}


I get same error every time:

Raydium: network: ERROR sending ! (-1)

on client connection to server

Why this doesn't work?

Author:  Xfennec [ Mon Apr 13, 2015 8:02 am ]
Post subject:  Re: raydium_network_propag_refresh doesn't work

Hi,

Can we see the related "raydium_network_propag_add()" call ?

Author:  bitrider [ Mon Apr 13, 2015 6:23 pm ]
Post subject:  Re: raydium_network_propag_refresh doesn't work

here it is:

1. client
Code:
#define NET_STARTGRID   (RAYDIUM_NETWORK_PACKET_BASE+100)
...
int startgrid[RAYDIUM_NETWORK_MAX_CLIENTS][2];
...
raydium_network_propag_add(NET_STARTGRID,startgrid,sizeof(startgrid[0][0]) * RAYDIUM_NETWORK_MAX_CLIENTS * 2);


2. server
Code:
int startgrid[RAYDIUM_NETWORK_MAX_CLIENTS][2];
...
raydium_network_propag_add(NET_STARTGRID,startgrid,sizeof(startgrid[0][0]) * RAYDIUM_NETWORK_MAX_CLIENTS * 2);

Author:  Xfennec [ Mon Apr 13, 2015 7:51 pm ]
Post subject:  Re: raydium_network_propag_refresh doesn't work

Seems OK to me, no problem here. It may be related to the "timing" of raydium_network_propag_refresh() call, then. When new_client() is called ?

Author:  bitrider [ Mon Apr 13, 2015 8:16 pm ]
Post subject:  Re: raydium_network_propag_refresh doesn't work

i searched over server c source file and besides the function declaration, there was this single line :-) :
Code:
raydium_network_on_connect=new_client;

Author:  Xfennec [ Tue Apr 14, 2015 7:56 am ]
Post subject:  Re: raydium_network_propag_refresh doesn't work

Oops. While digging the code, I realised that the "propag" system was never intended for the server side ! The server was only meant to synchronize the variables over all clients, not read or write the values. And the documentation does not say a word about that :/

So, here's the options:
1 - use another system to send this grid data from the server (classic netcall, HTTP request with web.c module, …)
2 - wait a bit to let trying to improve the propag system so it can be available to the server

Author:  bitrider [ Tue Apr 14, 2015 3:54 pm ]
Post subject:  Re: raydium_network_propag_refresh doesn't work

I hope to solve this using raydium_network_write I think i seen it used in Mania Drive.

Author:  Xfennec [ Tue Apr 14, 2015 3:58 pm ]
Post subject:  Re: raydium_network_propag_refresh doesn't work

This is really low level, try with netcalls first, it's easier.

I've started a few tests about server-side propags, will post here along the way...

Author:  bitrider [ Thu Apr 16, 2015 10:57 pm ]
Post subject:  Re: raydium_network_propag_refresh doesn't work

I was too lazy and i moved the generated random startgrid array to the client. Since every next client logging in after first client gets this data from server it makes no difference 8)
But i assumed that the first client always gets the value of raydium_network_uid equal to 0. Is that so ?

Author:  bitrider [ Sun Apr 19, 2015 12:45 am ]
Post subject:  Re: raydium_network_propag_refresh doesn't work

Nope, propag eventually wasn't good idea for this purpose :(
I took your advice and i "plugged in" into NET_REMAINING type with my array.
I also moved
Code:
game_state_change(GAME_GAME);
from button callback to time counter callback.
It works flawlessly now :D

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/