0 registered members (),
17,886
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
A6 car question
#48826
07/07/05 03:26
07/07/05 03:26
|
Joined: Sep 2004
Posts: 260 UB,Mongolia
Olzii
OP
Member
|
OP
Member
Joined: Sep 2004
Posts: 260
UB,Mongolia
|
Hi Marco,
I am changing your car tutorial to multiplayer example and i have some questions.
1. My car is smaller than your's and it is not working good as yours. Which variables, constants i have to change if i scaled your car ? / My scale is 20cm=1quant /
2. In multiplayer mode, i have created 2 physics car. And it is working good on server, but on client it does not accept key controls.
Thanks, Olzii
The Empire of the Mongols comprised the largest continuous land empire ever, reaching from Korea to Poland
|
|
|
Re: A6 car question
[Re: Olzii]
#48827
07/07/05 22:25
07/07/05 22:25
|
Joined: Sep 2003
Posts: 3,236 San Diego, CA
Marco_Grubert
Expert
|
Expert
Joined: Sep 2003
Posts: 3,236
San Diego, CA
|
Quote:
1. My car is smaller than your's and it is not working good as yours. Which variables, constants i have to change if i scaled your car ?
I recommend you start by placing your car somewhere above the ground and let it drop. Try different gravity settings until it looks realistic. Next, set wheel and body mass to a low value and drive the car around. If the car bounces a lot, increase the mass values. If the car has a tendency to flip over then reduce the chassis mass and increase wheel mass. To adjust the friction settings see if the car slips sideways when in a curve or while the handbrake is set. More friction reduces slipping but can lead to undesirable results if too high- just set it to a low value and work it up. Chassis friction is not too important- if the car is a "low rider" you should set that friction to a very low value, otherwise it can be high. On a level field the car should not be rolling much on its own. Add wheel damping if it does. If the car becomes unstable at high speeds you will have to reduce the maximum speed by changing the max angular value. Should the car be slow in getting moving or the wheels spin in place then you will have to adjust the wheel torque that is applied. If your car gets stuck in walls you need to reduce the PH_CHECK_DISTANCE parameter. In my demos I use 0.1 for this. The simulation will generally run better at a higher physics framerate (default:70, 140 is better) but requires more CPU power for that. For best handling the car should be wide, not too tall, with large tires and a chassis that has some ground clearance; in other words a golf cart will be hard to simulate.
Quote:
2. In multiplayer mode, i have created 2 physics car. And it is working good on server, but on client it does not accept key controls. Please help me to solve this example ? Here is my code
I am sorry, but I can not debug projects, unless they specifically demonstrate a potential bug. If you remove everything that is nonessential to the problem at hand, I will check it.
|
|
|
Re: A6 car question
[Re: Marco_Grubert]
#48828
07/08/05 02:45
07/08/05 02:45
|
Joined: Sep 2004
Posts: 260 UB,Mongolia
Olzii
OP
Member
|
OP
Member
Joined: Sep 2004
Posts: 260
UB,Mongolia
|
Thanks Marco,
I have another questions :
- Is there another method to lift up car without creating hook (like u) ? Because while i am changing it to multiplayer i have to declare many pointers for each car. (in Newton physics it can be done changing chasis position higher and reset the car transformation matrix) - Is it better or worse to make all my AI-car to physics car in my car game ? Can engine handle it if i use more than 20 physics car and some physics objects ? /I own 6.31.4 PRO edition/
Olzii
The Empire of the Mongols comprised the largest continuous land empire ever, reaching from Korea to Poland
|
|
|
Re: A6 car question
[Re: wildcard]
#48831
07/09/05 09:50
07/09/05 09:50
|
Joined: Aug 2001
Posts: 2,320 Alberta, Canada
William
Expert
|
Expert
Joined: Aug 2001
Posts: 2,320
Alberta, Canada
|
I currently have 8 A.I vehicles using the physics engine. In total that's 4 wheels x 8 and 1 chassis x 8, which equals 40 active physics objects. This runs at 80 - 90 FPS with just one vehicle and the environment in view(remember all the other karts are racing). My computer has 2GB of ram with 3.0ghz and a Radeon 9800 graphics card. Of course there is thousands of lines of code running on top of this so I cannot give you an estimate of what it would be like with just the barebone vehicles racing(quite a bit better I'd imagine). Anyways, all i'm saying is its possible to have at least 8 racers. If your going commercial then give the option for 4, 6, or 8 racers in your grand-prix mode and all should be good. Personally, I like racing against 6 vehicles. Also, the framerate increases to 120-130FPS. Ello has a good idea, but if your using pretty closed circuts(and the vehicles you see vary quickly) theres a possibility for huge slowdown with all the enabling/disabling code. Also, it wouldn't help the playing experience if you seen the A.I kart land a jump like it's floating on air(considering your timing is off for enabling them back in the physics engine).
Watch these variables:
PH_FPS_MAX_LOCK = 70; PH_CHECK_DISTANCE = 20; ph_setautodisable(100,100,100,100); // turn off time_smooth=0;//dont set at "1", bug with physics engine
They make a huge difference on your performance. PH_FPS_MAX_LOCK when set higher can slow things down alot with multiple vehicles. When PH_CHECK_DISTANCE is lower it will slow down the performance. Do some testing, see what works for you in the balance of performance/stability. I'd reccomend giving the user an option to change the simulation of the physics in the end as well(for higher end users).
P.S - Incase anyone wants to know for the future. I've found a great way to do spinouts(like in Mario Kart) and whatever else you'd like. Just make your real physics vehicle invisible, reduce it's speed accordingly, then create another model and have it do what you want(while following your invisble vehicle). I know this seems like common sense, but I spent an uneeded amount of time wrestling with the physics engine trying to do spinouts and flip effects. It's quite hard to make something in the physics engine do the same thing each time(if not impossible) for an arcade racers spinouts.
|
|
|
Re: A6 car question
[Re: Olzii]
#48832
07/09/05 10:05
07/09/05 10:05
|
Joined: Aug 2001
Posts: 2,320 Alberta, Canada
William
Expert
|
Expert
Joined: Aug 2001
Posts: 2,320
Alberta, Canada
|
About the flipping - Heres some code I made up: Code:
//Put this on the top of your function var stop_vanish2;
/*Put this in a while loop, be sure to change the pointer from "kart1" to whatever your main chassis's pointer is, the same goes for the wheels of that chassis/* . if(!key_x && !joy_4 || !joy_4 && !key_x) && (kart1 == me){stop_vanish2 = 0;} if(key_x && !joy_4 || joy_4 && !key_x) && (kart1 == me) && (stop_vanish2 == 0) { stop_vanish2 = 1; my.lightrange = 0; vec_set(temp.x, my.x); temp.z += 30; phent_enable (kart1_FL,0); phent_enable (kart1_FR,0); phent_enable (kart1_RL,0); phent_enable (kart1_RR,0); phent_enable (my,0); vec_set(my.x, temp.x); vec_set(kart1_FL.x, temp.x); vec_set(kart1_FR.x, temp.x); vec_set(kart1_RL.x, temp.x); vec_set(kart1_RR.x, temp.x); my.tilt += 180; kart1_FL.tilt += 180; kart1_FR.tilt += 180; kart1_RL.tilt += 180; kart1_RR.tilt += 180; my.pan += 180; kart1_FL.pan += 180; kart1_FR.pan += 180; kart1_RL.pan += 180; kart1_RR.pan += 180; phent_enable (kart1_FL,1); phent_enable (kart1_FR,1); phent_enable (kart1_RL,1); phent_enable (kart1_RR,1); phent_enable (my,1); }
What it does is temporarly un-enables your vehicle from the physics engine, then flips it using basic pan/tilt/roll and then re-enables it. BTW - sorry about the double post, I missed this question in the first one... 
|
|
|
Re: A6 car question
[Re: William]
#48833
07/18/05 10:02
07/18/05 10:02
|
Joined: Sep 2004
Posts: 260 UB,Mongolia
Olzii
OP
Member
|
OP
Member
Joined: Sep 2004
Posts: 260
UB,Mongolia
|
Thanks, William
I'll try your flip code.
Olzii
The Empire of the Mongols comprised the largest continuous land empire ever, reaching from Korea to Poland
|
|
|
Re: A6 car question
[Re: Olzii]
#48834
07/23/05 05:57
07/23/05 05:57
|
Joined: Sep 2004
Posts: 260 UB,Mongolia
Olzii
OP
Member
|
OP
Member
Joined: Sep 2004
Posts: 260
UB,Mongolia
|
Hi Marco,
I have two question.
1. I said you before my level has scaled /1quant=20cm/. I couldnot find any information about your car tutorial level's scale. In Update_speed() function there is one line : linSpeed= vec_length(vecLin) * 0.091; // convert from quant/sec to kmh How many meters or centimeters are equal to your level's one quant ? 2. I want to make manual gear transmission for my car. Please give me some advise how to do it ? Is there any tutorial about gear shifting ?
Olzii
The Empire of the Mongols comprised the largest continuous land empire ever, reaching from Korea to Poland
|
|
|
|