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).
7.06 : Entity actions didn't start in compiled executables of lite-C multiplayer games under certain circumstances (all A7 versions; fixed in A7.07.0).
The last one is less probable, I do not compile to exe, just start two processes from SED (first -cl -sv, then -cl). I think, version 7.06 is beta, so I have no access to it, right?
I know that moveMe() is executed on the server for both entities, therefore I
use the entity name and not the connection variable there to discriminate for which entity the function is executed.
On the other hand, getInput() is not started by an entity, so I apply the proper entity using the connection variable there.
This I think is perfectly in line with the general philosophy to have an input function on each client seperately and a move function which is executed on the server for each client.
Nonetheless, I have implemented your change, erased the getInput() call at main
and wrote a proc_client() at moveMe(). At getInput() I do not need a
discrimination of entities any more, because it is called with an entity now
and running on the client.
See below:
function getInput () { // wsad control on client and server separately
while (1) {
if (key_w == 1) my.skill1 = 5;
if (key_s == 1) my.skill1 = -5;
if (key_a == 1) my.skill2 = 5;
if (key_d == 1) my.skill2 = -5;
if (!key_any) {
my.skill1 = 0;
my.skill2 = 0;
}
if (connection == 2) send_skill (my.skill1, SEND_VEC|SEND_UNRELIABLE);
showX = my.skill1; // show input
showY = my.skill2; // show input
isInput++; // getInput running?
if (isInput > 999) isInput = 0;
wait (1);
}
}
function moveMe () { // movement for both on server
wait (1); // have to wait 1 frame after entity creation
proc_client (me, getInput());
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);
}
}
Result: Red ball on server is moved perfectly, but getInput() is never executed on the client. Tried some variations, also. Same result, red ball (server) moves on both processes, blue box never moves. With proc_local I get a runtime
crash on the client.
Sorry, problem persistent, still.