Raydium 3D Game Engine

Official forum for everything about Raydium, ManiaDrive, MeMak, ...
It is currently Sun Nov 10, 2024 7:41 pm

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Sat Apr 11, 2015 9:35 pm 
Offline

Joined: Fri Nov 22, 2013 2:56 am
Posts: 16
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?


Top
 Profile  
 
PostPosted: Mon Apr 13, 2015 8:02 am 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2593
Location: gnniiiii (Scrat)
Hi,

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


Top
 Profile  
 
PostPosted: Mon Apr 13, 2015 6:23 pm 
Offline

Joined: Fri Nov 22, 2013 2:56 am
Posts: 16
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);


Top
 Profile  
 
PostPosted: Mon Apr 13, 2015 7:51 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2593
Location: gnniiiii (Scrat)
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 ?


Top
 Profile  
 
PostPosted: Mon Apr 13, 2015 8:16 pm 
Offline

Joined: Fri Nov 22, 2013 2:56 am
Posts: 16
i searched over server c source file and besides the function declaration, there was this single line :-) :
Code:
raydium_network_on_connect=new_client;


Top
 Profile  
 
PostPosted: Tue Apr 14, 2015 7:56 am 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2593
Location: gnniiiii (Scrat)
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


Top
 Profile  
 
PostPosted: Tue Apr 14, 2015 3:54 pm 
Offline

Joined: Fri Nov 22, 2013 2:56 am
Posts: 16
I hope to solve this using raydium_network_write I think i seen it used in Mania Drive.


Top
 Profile  
 
PostPosted: Tue Apr 14, 2015 3:58 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2593
Location: gnniiiii (Scrat)
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...


Top
 Profile  
 
PostPosted: Thu Apr 16, 2015 10:57 pm 
Offline

Joined: Fri Nov 22, 2013 2:56 am
Posts: 16
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 ?


Top
 Profile  
 
PostPosted: Sun Apr 19, 2015 12:45 am 
Offline

Joined: Fri Nov 22, 2013 2:56 am
Posts: 16
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group