Jump to content
  • Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

188 Neutral

About jujunosuke

  • Rank
  1. jujunosuke

    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. jujunosuke

    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. jujunosuke

    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. jujunosuke

    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. jujunosuke

    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. jujunosuke

    [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. jujunosuke

    [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. jujunosuke

    [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. jujunosuke

    [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. Unity is very cool game development tool, but if you want to export your game for Android devices, you need to pay 1500$ for Unity Pro + 1500$ for Android exporter. So first, start with Unity Indie (Free version of unity), then when your game is COMPLETELY finished, you can try at your own risk to pay the 3000$ to export your game for Android and sell it on Android Market. You maybe also want to make some modification on your game reduce the (graphics quality) or (add touch events) to make it work smoothly on Android devices.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!