Git Product home page Git Product logo

Comments (7)

marcos2250 avatar marcos2250 commented on September 2, 2024 1

Absolutely man! feel free to take it.
Lately i've had very little time to work in this project. Last time I was trying to understand the AI driver part, but the decompiled code is a complete mess.

from tnfs-1995.

marcos2250 avatar marcos2250 commented on September 2, 2024 1

Hi Andy, that's awesome work, man! Merged your fixes (thanks!) and tweaked the AI a bit to include some traffic cars (now it's 1 player, 4 opponents and 3 traffic). Still very dumb AI, cars keep crashing on each other, as it has just the minimal functions to work.

from tnfs-1995.

marcos2250 avatar marcos2250 commented on September 2, 2024 1

yes, just changing car->ai_state you might change their behavior any time, you can even make the cars race in reverse. As TNFS only can handle up to 8 cars, do when in a head to head race, the 6 remaining slots were for traffic/police.
The tnfs_ai_drivers_update() is a quirky version from how TNFS handle it originally. It's also missing a lot of police car code, I should bring this part next time!

from tnfs-1995.

AndyGura avatar AndyGura commented on September 2, 2024

Thank you! I started integrating it and it works fantastically! Here is the video.

I have some questions though and feature requests, maybe you can write me an email to [email protected] so we can communicate? For now I have these:

  • looks like if I put carspecs.pbs file (uncompressed), car never shifts to 2nd gear, is it an issue with the code or I do something wrong? I use pbs from TNFS SE (PC). Fixed it myself and created PR: #3
  • does player_car.matrix include body roll and body pitch? It feels like it doesn't. Is there way to retrieve final rotation matrix with these included? Fixed it myself and created PR: #5
  • do you plan to rework hardcoded xman car? Will be great to be able to start race with 0, 1 or 7 opponents, just like in game. I've done it in the PR #4
  • is there any chance to add traffic cars?

from tnfs-1995.

AndyGura avatar AndyGura commented on September 2, 2024

Hi! Thank you, sounds great! I see now some cars start going backwards at some point, those are probably traffic cars. But I'm not sure how can I control how many racers and how many traffic cars I want to spawn? Also, is it possible to spawn/despawn traffic cars at the runtime, when race is already happening? Thank you!

from tnfs-1995.

AndyGura avatar AndyGura commented on September 2, 2024

@marcos2250 thanks, I'm constantly updating your library in my project. Now all kinds of races work as expected apart from dumb AI and traffic not obeying lanes :)

I noticed one curious thing: by comparing car.position changes each frame and linear velocity vector [car.speed_x, car.speed_y, car.speed_z], the position delta is always slightly greater than linear velocity. I calculated it thoroughly and found that it almost exactly equal if FPS would've been 24, not 30. Do you have any idea how it is possible? I see your constants car.fps and car.delta_time, thy look correct and correspond to 30 frames per second

I recorded comparison test between dos TNFS and yours physics backend: https://www.youtube.com/watch?v=M_II5Gd8RGk

UPD: I figured it out, sorry for noise. Apparently all formulas were written for tick == 1/24 seconds, and for 30 fps developers just patched everything related to length: made track distance, display speed, speed in stats 0.8x.

from tnfs-1995.

marcos2250 avatar marcos2250 commented on September 2, 2024

Very intriguing why they did make this messed that way.

I found it odd that the delta_time const is also 0x888 (1/30) on 3DO, looks like they tried to make it real time 30 fps sim, but the hardware couldn't render 30 fps.

On PC/PSX versions, as in the lines 738,739 (linear) and 820 (rotation) of tnfs_fiziks.c, they added the fix2() macro call increasing vectors 25% without changing displayed speed!

from tnfs-1995.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.