Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,513 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Can't find what's wrong #87348
08/24/06 08:53
08/24/06 08:53
Joined: Jan 2006
Posts: 13
Kishinev, Moldova
Maxim Offline OP
Newbie
Maxim  Offline OP
Newbie

Joined: Jan 2006
Posts: 13
Kishinev, Moldova
Inspired by locoweed's tutorial, i'm trying to make a MP driving game.
But a sort of problem occurs: can't get see my car on the screen. I suppose there's something wrong with "my_car()" function.
here's my piece of code:
Code:
 function my_car_client()
{
my_car();
}
function move_car()
{
wait(1);
proc_client(my,my_car_client);
}
//////////////////////////////////////////////
function oldcamera()
{
while(1)
{
dist_planar = cos (tilt_3rd) * dist_total; // vy4eslenie rasstoiania do obiecta po uglu i goriz rasstoianiu
cam_angle = my.pan; //prisvoenie s pogreshnostiu
3rd_person.x = my.x - cos(cam_angle) * dist_planar; // polojenie x ??
3rd_person.y = my.y - sin(cam_angle) * dist_planar; // polojenie y ??
3rd_person.z = my.z + sin(tilt_3rd) * dist_total + 20; // polojenie z ??
3rd_person.pan = cam_angle; // oborot camery
//3rd_person.roll = my.roll * 0.2; // naklon kamery
//3rd_person.tilt = my.tilt * 0.2; //bokovoi naklon kamery ??
wait(1);
}
}

///////////////////////////////////////////
function camspecifics() // once - defines cam options
{
camera.visible = off; // why??
camera.ambient=0;
3rd_person.size_x = screen_size.x; // donno
3rd_person.size_y = screen_size.y; // donno
3rd_person.genius = my; //donno
3rd_person.visible = on; // why???????
}
///////////////////////////////////////////
function carcontrol() // key - dependable control
{
while(1)
{
if(key_cul == on)
{
m1 +=500;
wheel_target = -25;

}
if(key_cur == on)
{
m1 -= 500;
wheel_target = 25;
}
if(key_cul == on && key_cur == on)||(key_cur == off && key_cul == off)
{
m1 = 0;
wheel_target = 0;
}
if(key_cuu == on)
{
m2 += 2000;
}
if(key_cud == on)
{
m2 -= 2000;
}

if(key_cuu == on && key_cud == on)||(key_cuu == off && key_cud == off)
{
m2 = 0;
}
// vec_set(temp, my.x); // makes it so temp is always starts at my.x
//temp.z -= 1000; // set how far to trace


phcon_getposition(joints [1],temp);
vec_set(m1_1,vector((wheel_target)*0.2,100,0));
phcon_getposition(joints [2],temp);
vec_set(m1_2,vector((wheel_target)*0.2,100,0));
phcon_setmotor(joints [1],m1_1,nullvector,nullvector);
phcon_setmotor(joints [2],m1_2,nullvector,nullvector);

phent_addforcelocal ( my, vector (m2,0,0),nullvector );
phent_addtorquelocal ( my, vector(0,0,m1) );
}
wait(1);
}
/////////////////////////////////////////////
function debug()
{
while(1)
{
str_for_num(s3,my.pan);
draw_text(s3,5,40,vector(255,255,255));

str_for_num(s4,my.roll);
draw_text(s4,5,64,vector(255,255,255));

str_for_num(s5,my.tilt);
draw_text(s5,5,88,vector(255,255,255));

str_for_num(s0,my.x);
draw_text(s0,5,112,vector(255,255,255));

str_for_num(s1,my.y);
draw_text(s1,5,136,vector(255,255,255));

str_for_num(s2,my.z);
draw_text(s2,5,160,vector(255,255,255));
wait(1);
}
}
///////////////////////////////////////////
function server_called()
{
// if new player connected, increment people connected// and tell him it's ok to continue
if ((event_type == event_join) && (people_connected < MAX_CONNECTIONS))
{
ifdef server;
people_connected += 1; // another person connected
send_var(people_connected); // send number of people connected
server_says_start = TRUE; // send it's ok to go to newest client
send_var(server_says_start); // send start message
endif; // ifdef server
}
// some one disconnected
if (event_type == event_leave)
{
ifdef server;
people_connected -= 1; // one less person connected to server
send_var(people_connected); // send number of people connected
endif;
}

//on_server = server_called; // on server event, call server_called()
}
///////////////////////////////////////////
function display_info()
{
while(1)
{
str_cpy(str_people_connected, "People Connected: ");
str_for_num(str_temp, people_connected);
str_cat(str_people_connected, str_temp);
wait(1);
}
}

//////////////wheel FUNKtions/////////////////
function frontrightwheel()
{
my.tilt = 90;
//frontright = my;
my.scale_x = 0.25;
my.scale_y = 0.25;
my.scale_z = 0.25;
phent_settype (my,ph_rigid,ph_sphere);
phent_setgroup (my,2);
phent_setelasticity (my,20,10);
phent_setfriction (my,90);
phent_setmass (my,15,ph_sphere);
joints [1] = phcon_add(ph_wheel,player,my);
phent_setdamping(my,50,50);
vec_set(p2,vector(0,0,1));
vec_set(p3,vector(1,0,0));
vec_set(p4,vector(-20,20,0));
vec_set(p6,vector(sc,dc,0));
phcon_setparams1(joints [1],my.x,p2,p3);
phcon_setparams2(joints [1],p4,nullvector,p6);
}
function frontleftwheel()
{
my.tilt = 90;
//frontleft = my;
my.scale_x = 0.25;
my.scale_y = 0.25;
my.scale_z = 0.25;
phent_settype (my,ph_rigid,ph_sphere);
phent_setgroup (my,2);
phent_setelasticity (my,20,10);
phent_setfriction (my,90);
phent_setmass (my,15,ph_sphere);
phent_setdamping(my,50,50);
joints [2] = phcon_add(ph_wheel,player,my);
vec_set(p2,vector(0,0,1));
vec_set(p3,vector(1,0,0));
vec_set(p4,vector(-20,20,0));
vec_set(p6,vector(sc,dc,0));
phcon_setparams1(joints [2],my.x,p2,p3);
phcon_setparams2(joints [2],p4,nullvector,p6);
}
function rearrightwheel()
{
my.tilt = 90;
my.scale_x = 0.25;
my.scale_y = 0.25;
my.scale_z = 0.25;
//rearright = my;
phent_settype (my,ph_rigid,ph_sphere);
phent_setgroup (my,2);
phent_setelasticity (my,20,10);
phent_setfriction (my,90);
phent_setmass (my,15,ph_sphere);
joints [3] = phcon_add(ph_wheel,player,my);
phent_setdamping(my,50,50);
vec_set(p2,vector(0,0,0));
vec_set(p3,vector(1,0,0));
vec_set(p4,vector(0,0,0));
vec_set(p6,vector(sc,dc,0));
phcon_setparams1(joints [3],my.x,p2,p3);
phcon_setparams2(joints [3],p4,nullvector,p6);
}
function rearleftwheel()
{
my.tilt = 90;
my.scale_x = 0.25;
my.scale_y = 0.25;
my.scale_z = 0.25;
//rearleft = my;
phent_settype (my,ph_rigid,ph_sphere);
phent_setgroup (my,2);
phent_setelasticity (my,20,10);
phent_setfriction (my,90);
phent_setmass (my,15,ph_sphere);
joints [4] = phcon_add(ph_wheel,player,my);
phent_setdamping(my,50,50);
vec_set(p2,vector(0,0,0));
vec_set(p3,vector(1,0,0));
vec_set(p4,vector(0,0,0));
vec_set(p6,vector(sc,dc,0));
phcon_setparams1(joints [4],my.x,p2,p3);
phcon_setparams2(joints [4],p4,nullvector,p6);

}


////////////main function////////////////////////////////////////////////////
function main() // predefined "main" function
{
////////////////////////////////////////////////
randomize();
ifdef server;
while(connection== 0) {wait(1);} // wait until level loaded and connection set
endif;
ifdef client;
while(connection== 0) {wait(1);} // wait until level loaded and connection set
endif;

level_load (dorogi_wmb); // load level from previously defined string
sleep(.5);
fps_max = 60; // lock fps at 60 for all players
fps_lock = ON;
mouse_mode = 2; // does not effect forces

if (connection == 2)|| (connection == 3)
{

camspecifics();
oldcamera();
display_info();
debug();
txt_people_connected.visible = ON;
temp.X = 500 + random(100);
temp.Y = 1000 + random(20);
temp.Z = 100;
wait(3);
player = ent_create(car_mdl,temp,my_car);
wait(3);

}
}

///////////////my car FUNKtion////////////////
function my_car() // my car's movement action
{
player.pan = 90;
player.scale_x = 0.6;
player.scale_y = 0.6;
player.scale_z = 0.6;
player=me;
player.overlay = off;
player.flare = off;
player.bright = off;
player.transparent = off;
player.ambient = 50;
player.shadow = off;
player.metal = on;
phent_settype(player,PH_RIGID,PH_box);
phent_setmass(player,1200,PH_box);
phent_setgroup (player, 2); // set the id of the car
phent_setfriction(player,80); //set the friction coefficient
phent_setdamping (player, 50, 50); // set the velocity damping (linear = 20, angular = 30)
phent_setelasticity (player, 10, 5); // set the bounciness factor
ph_setgravity (vector(0, 0, -386));
//ent_create(wheel_mdl, vector(player.x+25,player.y+30,player.z-8),frontrightwheel);
//ent_create(wheel_mdl, vector(player.x-20,player.y+30,player.z-8),frontleftwheel);
//ent_create(wheel_mdl, vector(player.x+25,player.y-30,player.z-8),rearrightwheel);
//ent_create(wheel_mdl, vector(player.x-20,player.y-30,player.z-8),rearleftwheel);

ph_setcorrections(50000,0.1);




i feel so ashamed (especially with my car physics)

Re: Can't find what's wrong [Re: Maxim] #87349
09/04/06 01:32
09/04/06 01:32
Joined: Jun 2005
Posts: 130
K
khanoftruth Offline
Member
khanoftruth  Offline
Member
K

Joined: Jun 2005
Posts: 130
I have no clue if there is anything wrong with your my_car code, but 2 points of note:

1. Unless you are using A6 Pro, your wheel phisics won't work properly.

2. I am pretty sure that the problem is more in your old_camera function. I don't know what, but that is where I'd think a problem would be.


The Galvanic Productions Hompage: www.GalvanicProductions.tk For our current project, click on the Nirvana link.
Re: Can't find what's wrong [Re: khanoftruth] #87350
09/04/06 06:18
09/04/06 06:18
Joined: Apr 2002
Posts: 4,801
Richmond B.C., Canada
Captain_Kiyaku Offline

Dichotomic
Captain_Kiyaku  Offline

Dichotomic

Joined: Apr 2002
Posts: 4,801
Richmond B.C., Canada
what version do you use? A6.20 Pro edition? You should update, that might fix the problem.


My Blog

"Tag und Nacht schrei ich mich heiser,
Wind weht alle Worte fort,
Tag und Nacht schrei ich mein Krähenwort!"

Subway To Sally - Krähenkönig

Moderated by  HeelX, Spirit 

Gamestudio download | 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