Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 716 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: No Entity synchronizing with Lite-C ? [Re: nfs42] #171604
12/09/07 17:52
12/09/07 17:52
Joined: Jul 2007
Posts: 53
Germany
Henning Offline OP
Junior Member
Henning  Offline OP
Junior Member

Joined: Jul 2007
Posts: 53
Germany
Hi Andreas,

yes, I used entPlayer at the send_skill command.
I implemented your change, your proposed code now looks like this:

// Simple Multiplayer
// 3D Gamestudio A7 Version 7.05 commercial
// H.Berkelmann 2007

#include <acknex.h>
#include <default.c>

ENTITY* clPlayer;
ENTITY* svPlayer;
ENTITY* entPlayer;

var isMove = 0;
var isInput = 0;
var showX = 0;
var showY = 0;

function moveMe () { // movement for both on server
while (1) {
my.x += my.skill1 * time_step;
my.y += my.skill2 * time_step;
ent_sendnow (me);

isMove++;
if (isMove > 999) isMove = 0;
wait (1);
}
}

function getInput () { // wsad control on client and server separately
while (entPlayer == NULL) {
if (connection == 2) entPlayer = clPlayer;
if (connection == 3) entPlayer = svPlayer;
wait (1);
}

while (1) {
if (key_w == 1) entPlayer.skill1 = 5;
if (key_s == 1) entPlayer.skill1 = -5;
if (key_a == 1) entPlayer.skill2 = 5;
if (key_d == 1) entPlayer.skill2 = -5;
if (!key_any) {
entPlayer.skill1 = 0;
entPlayer.skill2 = 0;
}

if (connection == 2) send_skill (entPlayer.skill1, SEND_VEC|SEND_UNRELIABLE);
// send_skill (entPlayer.skill1, SEND_VEC|SEND_UNRELIABLE);

showX = entPlayer.skill1; // show input
showY = entPlayer.skill2; // show input
isInput++; // getInput running?
if (isInput > 999) isInput = 0;
wait (1);
}
}

////////////////////////////// main ///////////////////////////////////////
function main () {
level_load ("M.wmb"); // just a platform and a cylinder at +X for orientation
wait (-0.5);
vec_set(camera.x,vector(-200, 0 , 20));

while (connection == 0) wait (1);

if (connection == 2) { // client
clPlayer = ent_create ("BlueBox.mdl", vector (70, 30, 0), moveMe);
}

if (connection == 3) { // client / server
svPlayer = ent_create ("RedSphere.mdl", vector (70, -30, 0), moveMe);
}
wait (-0.5);

getInput();
}

PANEL* diag_pan = {
flags = VISIBLE;
digits (4,10,"Diagnostics",*,1,NULL);
digits (4,20,"connection =",*,1,NULL);
digits (80,20,3.0,*,1,connection);
digits (4,50,session_name,*,1,NULL);
digits (4,60,player_name,*,1,NULL);
digits (4,70,"Input :",*,1,NULL);
digits (80,70,3.0,*,1,isInput);
digits (4,80,"Move :",*,1,NULL);
digits (80,80,3.0,*,1,isMove);
digits (4,90,"Inp X :",*,1,NULL);
digits (80,90,3.0,*,1,showX);
digits (4,100,"Inp Y :",*,1,NULL);
digits (80,100,3.0,*,1,showY);
}

When I execute it, I can see at the diagnostics panel that moveMe()
and getInput() are running on the server, and getInput() on the client.
Both process the keyboard input. But - as you may expect - no change.
The red ball is moved on both by input on the server, the blue box does not
move at all.
I always try the variant with 'if (connection == 2) send_skill...' and
without the condition, because I am not sure here. Has no influence.

Re: No Entity synchronizing with Lite-C ? [Re: Henning] #171605
12/09/07 18:08
12/09/07 18:08
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
Quote:

Hi Firoball,

I am using version 7.05, there are two relevant bugs at the bug list:
7.05 : Script functions and actions sent to the server or client in multiplayer mode didn't always make it due to a lite-C address bug (all lite-C and A7 versions; fixed in A7.06).





This might be the problem (I was the guy running into it).
Do something simple like changing the frame, or doing a printf() and see what happens.

Have you checked the annoucnements thread whether there is a newer public beta available?

Re: No Entity synchronizing with Lite-C ? [Re: FBL] #171606
12/09/07 21:52
12/09/07 21:52
Joined: Jul 2007
Posts: 53
Germany
Henning Offline OP
Junior Member
Henning  Offline OP
Junior Member

Joined: Jul 2007
Posts: 53
Germany
Hello Firoball,

I saw that A7.06 is available, will download and install it tomorrow
and try another test. If it is this problem, A7.06 should solve it.
Thank you very much for the tip. Stay tuned.

Re: No Entity synchronizing with Lite-C ? [Re: Henning] #171607
12/10/07 19:56
12/10/07 19:56
Joined: Jul 2007
Posts: 53
Germany
Henning Offline OP
Junior Member
Henning  Offline OP
Junior Member

Joined: Jul 2007
Posts: 53
Germany
SHOCK ... JOY ... DEEP SATISFACTION ...

It runs with A7.06!

Exactly as I have written it at the beginning of this thread!

Just remove the 'if (me == clPlayer)' before the isMove++; statement at the moveMe() function and you have a nice, little, crude multiplayer example without any clutter.

Thank you all so much, now there is a chance I can finish my first with Gamestudio during my Christmas holydays.

All the best and a nice Christmas time
Henning

Page 2 of 2 1 2

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