Hi!
I have decided to create a
multiplayer shooter with A7.
I have found Locoweeds tutorial and a forum thread written by ulf.
I have also found the Pong-Multiplayer example.
My first target was to create an entity that simply moves in a random direction.
But the action of the entity created on the client is not executed.
(Otherwise there would be a new text-file in my work folder)I have some general questions, too.
1.) Are there any tutorials about multiplayer with lite-c/A7?
2.) I test the script on one pc instead of two....are there any restrictions?
Code:
#include <acknex.h>
#include <default.c>
var Test = 0;
STRING* Temp_Str = "#100";
ENTITY* Player;
action Dummy_Local_Act()
{
wait(-1);
str_for_num(Temp_Str,10);
Test = file_open_write(Temp_Str);
wait(1);
file_close(Test);
}
action Dummy_Act()
{
wait(-1);
proc_local(my, Dummy_Local_Act); // function for client
wait(-0.5);
ent_sendnow(my);
wait(-0.5);
str_for_num(Temp_Str,connection);
Test = file_open_write(Temp_Str);
wait(1);
file_close(Test);
}
function Create()
{
Player = ent_create("earth.mdl",vector(0,random(400)+200,30),Dummy_Act);
while(!Player) wait(1);
}
function main()
{
video_mode = 7; // 800x600
fps_max = 60; // limit the number of packets
randomize(); // create different random seed
while(connection == 0) {wait(1);}
wait(-1);
level_load("Testlevel.wmb");
wait(-1);
camera.z = 300;
camera.tilt = -50;
camera.pan = 90;
on_g = Create;
}
After execution of this script I find one new file in my work folder which has the name "3". This is obviously created by the server. (-sv -cl). But there is no file with the name "2" (-cl).