Jump to content

  • Log In with Google      Sign In   
  • Create Account


K_J_M

Member Since 26 Feb 2007
Offline Last Active Nov 06 2013 04:50 PM
-----

#5006970 Oldschool retro RPG - feedback and ideas needed

Posted by K_J_M on 03 December 2012 - 11:05 PM

Hi Acharis.

I downloaded your game and gave it a whirl.

And i really like this. Posted Image

Everything ran smoothly and was really easy to pick up and play without instructions.

The only thing i felt was lacking was the sound effects and possibly some music to help generate some more atmosphere.

I contemplated writing something similar a while ago, more along the lines of the 'Ishar' games but instead decided against the step movement idea.

But it works really well in your game.

I can see this working really well on mobile devices.

Might be worth considering porting it to mobiles when you've finished the PC version.

The graphics have a real old school charm about them.

Keep up the good work.

KJM


#4979786 Car Simulation Headaches Part_#2

Posted by K_J_M on 13 September 2012 - 11:38 AM

"
I would argue with that. In your post #6, the blue arrow IS the real velocity of the tyre, which is perpendicular to the vector from CG to wheel pos, but not to the wheel's heading.
So it WILL generate both long/lat forces. If you do the same calculations for the remaining 3 wheels the sum of all Fx's will be zero if the CG is at the center of the car, so that's why there is no movement of the car body.
"

Thanks for the explanation Bmarci. Posted Image

I see there were flaws in my understanding.

I was assuming that a stationary car spinning on the spot has zero linear velocities and as a result no slip angles could be generated.

But in fact, you show that although the car chassis has no linear velocites, the wheels actually do and therefore the slip angles can be calculated whilst ignoring the angular velocity of the chassis.

Sorry for any confusion pochypoch.


#4979600 Car Simulation Headaches Part_#2

Posted by K_J_M on 13 September 2012 - 12:27 AM

Thanks for the comments.

Both Long and Lat Pacejka formulas need FZ (load) as one of the inputs.

And a resulting force as output.

The traction circle caps the forces to a maximum limit. I think the Racer sim reduces Longitude forces in favour of Lateral as a way to cap the forces.

But there are several different methods that i've seen.

Since the traction circle limits forces, and these are calculated from Pacejka which requires FZ (load) as an input, the traction circle caclulations are applied after the forces have been calculated.


#4979483 Car Simulation Headaches Part_#2

Posted by K_J_M on 12 September 2012 - 03:52 PM

Hi.

The Pacejka formula's work in wheel local coordinates.

Longtitude pointing in the direction the wheel rolls in and Lateral at 90 degrees to Longtitude direction.

So,as i understand it, Case 1 Example is correct.

Although i'm no expert, i always understood that a stationary car spinning on the spot with the steering centred produces no longtitude forces from the tires to move the car forwards or backwards. But only lateral forces to slow down the rate of spin.

But, maybe someone with more detailed knowledge than me can give a more accurate explanation.


#4978753 Car Simulation Headaches Part_#2

Posted by K_J_M on 10 September 2012 - 07:50 PM

It seems to me you are looking at the issue with regards to world coordinates.

If you look at the issue with regards to local car coordinates then each wheel has 0 longtitude velocity and (N) Lateral velocity if the car is spinning on the spot.

Marco Monsters car physics tutorial performs the world to local coordinates transform by rotating the linear world velocities by the yaw angle of the car / wheel.

s = Sin(yaw_angle)
c = Cos(yaw_angle)
local_lateral_velocity = (world_x_velocity * c) + (world_z_velocity * s)
local_longitude_velocity = (world_x_velocity * -s) + (world_z_velocity * c)

And to transform back from local to world coordinates. ( Note the sign for the sine command is reversed, which reverses the direction of rotation )

world_x_linear_velocity = (local_lateral_velocity * c) + (local_longitude_velocity * -s)
world_z_linear_velocity = (local_lateral_velocity *s) + (local_longitude_velocity * c)


But in regards to a stationary car spinning on it's axis the lateral wheel velocity is derived from the car angular velocity.


#4978485 Car Simulation Headaches Part_#2

Posted by K_J_M on 09 September 2012 - 11:45 PM

Hello PochyPoch.

I havn't read all of your post but a quick glance brought me to question 4.

To clarify Part 4.

If the car is stationary and spining on it's axis, and the front wheels arn't turned to any steering angle (yaw) but pointing in the direction the chassis points, then each wheel generates +- 90 degrees slip angle. The wheels only have lateral movement. ie they are only sliding sideways as the car spins.

The sign of the slip angle depends on whether the car is spinning clockwise or anti clockwise.

My statement about not generating slip angles was because the car is stationary and no slip angles are generated from the code that uses linear velocities of the car chassis to determine the slip angles. My basic method was using 1 wheel (chassis) to determine the slip angles and Bmarci was using 4 wheels.

Slip angles are generated by the difference between the longitude and lateral velocities of the tire.

The confusion comes from the fact that i was using the car chassis to determine the slip angle and not for each tire.

So when writing your sim, you need to take into consideration the angular velocity of the car and the slip angle that generates for each wheel and the linear velocities of the wheel (chassis , since the wheel is attached to the chassis).

The car can be moving with no angular velocity (moving forwards or sliding sideways), stationary but spinning on it's axis or any combination of the two.

And both situations need to be considered to determine your actual slip angle for each wheel.

The steering angle of the front wheels also needs to be taken into consideration for the front wheels slip angle.

Hope thats clearer.

And best of luck with your game.

I too have made a top down racer.

http://www.trinosis.com/


#4974162 Vehicle simulation headache

Posted by K_J_M on 28 August 2012 - 10:39 AM

I get slightly different slip angles in my demo.

12..3 -> slip 0 to -90 degrees
3..6 -> slip +90 to 0
6..9 -> slip 0 to -90
9..12 -> slip 90 to 0

The important thing is that your 12 - 3 and 9 - 12 slip angles have different signs for going forwards and 3 - 6 and 6 - 9 have different signs for going backwards.

So, Lateral Pacejka will return the correct signed force for skidding left and right.

I have different signs when the car spins past 90 degrees and starts going backwards. But i wouldnt worry about that until you get it working correctly going forwards.

Just to state the obvious, you are working in Degrees and not Radians, and not getting them confused ?

I would still reduce your code further to simulate what i do in my demo, with one wheel. Since your still having problems.

Once thats working as it should, then implement 2 wheels and when that works go to 4.

Also make the load and camber on the wheels constant, at this stage to simplyfy things as much as possible.

Could you upload a demo, so i could get a look at what's actually happening. Or a short video perhaps.


I don't understand these two lines

Fx=slip_ratio*0.25*Fz
Fy=slip_angle*0.1*Fz

To cap the forces to a traction circle / elipse you just normalise each and then multiply by a maximum length, if they exceed a maximum force.

You treat both as a 2d direction vector.

Also remember that Fz is used in the Pacejka equations. So i don't know why you're using it in those two lines.

Just remove those two lines from your code and see what happens.

Pacejka expects slip angles from -90 to +90, load (Fz) and camber as inputs and outputs FY as force.


#4904774 [Car Physics] - Precision about the Traction Circle

Posted by K_J_M on 21 January 2012 - 12:15 AM

I'm not sure if the code above does what i do, so heres my explanation anyway.

It's usually a case of using the longitude and lateral forces as a vector and testing whether the magnitude ( length ) of this vector exceeds some maximum length , ( traction circle radius ).

To calculate the length of the vector

magnitude = sqr ( (long_force * long_force) + (lat_force * lat_force) )


Then test the length of the vector and if it exceeds a maximum length, normalise the vector and multiply it by the maximum length.


if magnitude > max_length

if magnitude <> 0 // divide by 0 check

long_vec = long_force / magnitude // normalised vector
lat_vec = lat_force / magnitude // normalised vector

long_force = long_vec * max_length // length now at maximum
lat_force = lat_vec * max_length // length now at maximum

// the long and lat forces defined as a vector are now at it's permmitted maximum length but retains it's direction.

endif

endif



This is only one technique though.

I've read that Ruud Van Gaal's Racer only reduces the long force to maintain a maximum traction circle length.

ie, favouring losing longtiude grip over lateral.

Whereas my code reduces both long and lat forces.

Also worth mentioning is that some sims use a traction elipse instead of a traction circle.


KJM


PARTNERS