jujunosuke

Members
  • Content count

    113
  • Joined

  • Last visited

Community Reputation

188 Neutral

About jujunosuke

  • Rank
    Member
  1. Replay Physics

    dancingmad, thank you for your feedback. Now that i know what to do, i just need to implement it on my project.   Thanks again.
  2. Replay Physics

    Sorry dude but i didn't came on gamedev physics forum to get someone who give me a link to a product. I am here because i want to solve a problem and think with my head.   Otherwise i would have post on Unity forum don't you think so ? Make sens ?   Sorry i don't want to sound rude.
  3. Replay Physics

    i think i got it. I kind of replied my own answer.     So, here is the formula to interpolate two values or two Vector3 //================================================================== // INTERPOLATE //================================================================== public float interpolate( float x1, float x2, float x3, float y1, float y3 ) { return ( (x2 - x1) * (y3 - y1) / (x3 - x1) ) + y1; } x1 is the timing of the keyframe1 x2 is the current timing x3 is the timing of the keyframe2   y1 is the recorded position of the keyframe1 y3 is the recorded position of the keyframe2   It will return y2 which is the interpolation of keyframe 1 and 2. The position will change with the current timing     So basically, the interpolation can be done properly even if the framerate is not a fixed framerate because the position can be calculated at any moment with the interpolation function.   Thats it, i hope it help.
  4. Replay Physics

    dacingmad, thank you very much for your feedback. Instead of trying to replicate and reproduce the physics in my replay, i think i will go with the keyframe system as you mentioned. It just looks to be so less pain..   I have more questions though, i hope you can help me to clear my mind.   If during the game, i record something like this :   0.0 ==> carPosition.x = 0; 1.0 ==> carPosition.x = 10; 2.0 ==> carPosition.x = 20;     Because my game has no fixed time step, the framerate is every-time different. So if during the replay my camera angle is different, with more objects displayed on screen, i will never be able to reproduce the action at the exact same timing i recorded them..   Instead of being 0.0, 1.0, and 2.0 seconds it will probably play 0.03, 1.023, 2.054 etc...   Does that mean that i need to calculate the position of my car related to these value ?   For example if at recorded time 1.0 my car position is 10, when replayed at 1.023 it should be : positionX = 20(next position) - 10(actualPosition) = 10 * 1.023(currentTime) = 10.23   Is that pseudo code correct ?   What i want to say is that even if the replay time is totally different from the actual recorded time, i should be able to "guess" the position of the car with mathematic. Am i correct ?   And the last question, how often would i have to record keyframes ? The more i record them the more accurate the replay will be right ?   Anyway, thank you very much, and i hope you can understand my English because i am not native speaker.. Best regards.
  5. Replay Physics

    Hi everyone,   I would like to get some advice on how to make a visually convincing replay for my racing game.   I am using PhysX for the physics simulation and i am pretty sure that everything is non-deterministic. I am not sure how to verify if my time step is fixed or not ?   My first attempt at recording replay was very hilarious, and a big fail to say the least...   I tried to record user input (only input change) so every time i want to start recording i have a variable called recordedTime. This variable is incremented with the time step like this. if (isRecording) { recordedTime += Time.timeStep; } Then i would record the user input like this void recordAction( float time, string actionName ) { actions.Add( time.ToString() + "_" + actionName ); } so for example recordAction( recordedTime, "accel_on" ); etc etc.   But of course failed to reproduce the action properly. So i decided to add some keyframes at key moments in order to repositionate the car in the good position direction velocity and everything.     So i have a function that record pretty much everything. Car position, orientation, rigidbody velocity, rigidbody angularvelocity, same for wheels, etc...   But even after adding the keyframe system, it just does not worked as expected.   The thing, is i don't know really the tweaking i need to do in order to reproduce the same action at the same time. Should i use Update ? FixedUpdate ? LateUpdate ? to record action ?   I just struggle to understand the most fundamental concept. If i record acceleration input at 1.20 second, how can i play it again later with a different camera angle that is going to affect my framerate and then play the action faster or slower than 1.20 ?     So, instead of trying to reproduce everything in a physical way, i was wondering if it would be a decent solution to record the car position and orientation keyframes only, and then play a kind of linear transition between each keyframes in order to reproduce visually the movement of my car. What would you think about this option ? Does some professional games use it ?   Any feedback or advices would be very appreciated. Thank you in advance.
  6. [Car physics] Wheels / Tire Traction torque

    I made a mistake its 350 Nm @ 3200 (BMW M3 E36) Still very powerful     The fact is i was used to play with wrong torque feedback (forget to multiply by gear ratio), so my torque feedback was insanely strong. And i made all the other car settings based on that setting.   So yesterday i tried to play a little bit with the "new" settings and by increasing the grip on the wheels, and tweaking the cylinder inertia formula, i get much more decent results now. Also my Tachometer RPM needle feel really smooth hehe.     Thank you for the link, i have some reading now. I am a little bit scared every time i have to add one more thing to my transmission model (which is quite complex already). Its just another chance to forget something and make a single mistake that will screw up all the calculation   But i consider this topic as answered! Thank you very much for your time dear kunos!
  7. [Car physics] Wheels / Tire Traction torque

    So, if 164 nm is not low at all, that mean that my above code is correct ? Strange, i might have a problem or something i forgot somewhere..   My engine produce around 450 Nm at 3600 rpm. I then divide the 450 Nm by the inertia of a cylinder and multiply it by the gearRatios So @3600 rpm i get angularAcceleration = (450 / cylinderInertia) * gearRatios; And that is how i got my angularAcceleration on the rearWheels.   Then   angularVelocity += angularAcceleration * Time.deltaTime;
  8. [Car physics] Wheels / Tire Traction torque

    Hum, i divided the traction torque by the gear ratio and now i got catastrophic results... So traction torque seems completely out.   In the first 3 gears, the needle keep bouncing on the rev limiter like i had 3000 hp. (Now my car is arround 280 hp RWD). I might be doing something wrong somewhere.   Just to recap, Rev engine ---> getForce ---> multiply by GearRatios ---> getTheWheelsSlip on the ground ---> slipRatio Calculations ---> GetTractionForce that make move the car forward. Then the TractionForce is multiplied by the Rear Wheels radius and divided by the gearRatios to get the traction Torque that will slow down my engine.   So, if i get 3000 Nm of force for a 1 wheel that mean 6000 Nm of force that make the car move forward. Then TractionTorque = 6000 * wheelRadius / gearRatios; So 6000 * 0.34 / (3.82 * 3.26)     (first gear + final drive ratio) = 2040 / (12.45) = 164 (its ridiculously low!!)   At first i though i made a mistake and tried to multiply by the gearRatio instead of dividing it, but it just reversed the problem.   If the above pseudo code is correct, that mean that my problem is somewhere else then..
  9. [Car physics] Wheels / Tire Traction torque

    Hi kunos, long time no see! Thank you for your very quick answer!   Oh, i see! Now that you told me that it looks very obvious! That is why my brake torque traction was so strong! (And very wrong because the brake force was the same for all gears...)   kunos, i just can't count how many times you saved me from the mess..   I will test and report (as i always do) but i am pretty sure that it will work on my problem is solved. Best Regards.
  10. Hi everyone,   I am not sure how i should calculate the traction torque that act as a brake/resistance on the engine.   For example, the real wheels of my car spins, and lets say that each wheels return 3000 Nm of Force. I am pretty sure that to transform that force in torque i need to multiply the returned force by the wheel radius right ?     So, for a rear wheel drive car for example, the Traction Torque that act as a Brake on the engine would be 3000 Nm * wheel radius + 3000 Nm * wheel radius = traction torque of both rear wheels ? Right now, i am doing 6000 Nm * wheel radius.     I am a little bit confuse. At the moment, my car traction torque is very huge and my car acceleration feel quite slow. The car doesn't rev very well.   Any feedback would be greatly appreciated.   Best regards.
  11. About suspension and weight transfer, i don't know if the solution i used can help any of you guys. It is just a simplification of the concept, but honestly, i got pretty decent result and my simulation got better. As kunos said, i use physX as my physics engine, with 5 rigid body connected with joints. Basically i calculate the spring compression based on the distance of center of my wheel to the distance of my spring attached to the body of the car. You can decide about the spring distance free height. I set mine to 0.36 meters. That mean, if the car body is 0 kg the spring should not be compressed and give you 0.36 meters. Then i just do some calculation of the distance. Vector3 of the center of the wheel, Vector3 of the joint position. I then make calculation to get a result between 0 and 1. 0 mean that the spring is stretched to the max and give 0 grip. (spring free height) 1 mean that the spring is compressed to the max and give 100 % of grip. once you made that, calculate the total force that your tire should provide and multiply it by the result of the spring compression. Works decently for me and was really simple to implement. But of course, this technique is valuable only if you use a 3d physics engine as mentioned. I don't know what kunos think about this way of doing though..
  12. bmarci, thanks for your answer and your point, but i think you don't get what i tried to say. I am not native English so, it may be the reason i explained it bad. [quote]I'm sorry but I feel your post was not so constructive.[/quote] It was, i tried to explain why this thread was confusing to me. If you don't want to admit that some people will not understand that thread thats your problem. But don't say that my post was not constructive. [quote]As far as I understand this topic is not about a specific broblem, more likely about all problems. If you have a specific issue, just read the FIRT post which is constantly edited and expanded, as the discussion goes on.[/quote] A web page with some photos, or even Flash based animation would be so much better than this post. [quote]I don't think any of us who just started playing with car simualtion are about to make hyper realistic simulation for a racing team or a car factory. At this level, it's all about game and fun with an acceptable level of physical accuracy, and thus as everything in game programming it's all about cheating as much as possible. So there ARE miracle recipes as long as you are not a professional in aero dynamics or in suspension geometry setups. Later when we work out everything about differentials and tyre simulation those magical solutions will disappear.[/quote] I am not even talking about realistic simulation, i am talking about something really simple, the basics. Beside the fact that marco monster is 10 years old, it cover everything so well, its just the best way to start in my opinion. And gamedev forum should be there to help you to answer question on a particular point that you don't understand for example. Of course, its always interesting to see some reading on car physics, a subject that passionate all of us, but the fact of melting all kind of question and answer together make it really confusing and not that easy and enjoyable to read IMO. I don't have any problem with "tutorial" or "resource" kind of thread, but at least, it really need to be done more seriously. That was my 50 cent.
  13. Again, i am sorry but i think this thread is confusing. When i look at the first post and the evolution of the thread, i can't find anything related. Its like everyone is talking about his problem and mix everything. I will be difficult for someone who have a specific issue to find answers by looking at this thread.. [quote]Part 1 - What should i absolutly do to make this a fun game with drifts, skids and such things ?[/quote] This title only is just nonsense... There is no miracle recipe to make fun game or drift game. First the random guy who have no knowledge about car physics should be oriented to some reading first. The famous Marco monster tutorial is i guess a good start : [url="http://www.asawicki.info/Mirror/Car%20Physics%20for%20Games/Car%20Physics%20for%20Games.html"]http://www.asawicki.info/Mirror/Car%20Physics%20for%20Games/Car%20Physics%20for%20Games.html[/url] Also, the way you explain things is hard for a newcomer to understand. The advice order is completely wrong, and doing thing that way is total nonsense. Again no offense, you want to help people and help yourself, thats a great idea, but you should at least do it seriously.. Basically separating Car physics in multiple categories would have been a better approach... Tires, Transmissions, Engine, Gear Ratios, Weight Transfer etc... Again marco's monster tutorial do that better than you do. [quote]Use the powered wheels velocity to determine motor RPMs. Based on player throttle input, and engine torque curve, generate a torque force for powered wheels.[/quote] Another exemple, how did you came to this conclusion ? Looks like a copy and paste. As kunos mentioned this is backward thinking, and not very logical to me. Of course i know that this approach is valuable because i already deal with it by seeing some car physics tutorial on the net. But for a new-comer, it will be difficult to understand anything... Anyway..
  14. [Car Physics] - Angular Velocity / Angular Momentum

    [quote] nope.. that is a locked differential or a "spool", a limited slip allow tyres to turn at different speeds but in a "limited" (doh ) way. A spool adds tons of understeer to the car because the rear tyres will oppose to any change in relative angular speeds trying to straight the car up. This understeer is usually transformed into "snap" oversteer as soon there is too much torque for the tyres to handle. The car will be really really hard to drive. [/quote] Excellent kunos ! Thank you for all these informative answers ! I guess i have all the answers i was looking for and its up to me from now [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] See you next time! Best regards.
  15. [Car Physics] - Angular Velocity / Angular Momentum

    Damn kunos you answer too fast [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] [quote]static friction only applies at velocity = 0 , so forget about that [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] As for "drift", it took me about 13 years to come up with a global model that allows my physics implementer to do a "drift" car... it really is that hard [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img], and the more your model is complicated the harder it gets. [/quote] Reading this is as fascinating as discouraging.. hehe. [quote]again, do not underestimate the role of differential modeling.. drift needs limited slip differentials, an open diff won't drift, and a spool won't drift.[/quote] In my sim, the real wheels turn both at the exact same rate, so i guess i already have a LSD config.. Anyway, after that much experience in car simulation, it is so great that you share your experience kunos. Tyre modeling is just fascinating and extremely complicated at the same time.. Btw, this next question is not related to my post, but just for curiosity, what do you think about physics used in game like Gran Turismo 5 or Forza 4 ? The tire model on this game is far to be perfect and is of course really simple compared to any good PC simulation. BUT they have the quality to be correct simulation with correct car behaviour for LARGE audience public. I know that you try to reach a kind of ultimate car simulation but, did these large public sims influenced you in any way ? ***EDIT*** What i mean is, we can control the car for laptime or drift with a simple standard controller, see the replay and still see acceptable car behaviour right ? This have to be quite challenging...