Giter Site home page Giter Site logo

Comments (2)

 avatar commented on August 16, 2024

I think I have found a fix for this issue:
It seems that the main problem is how the friction is computed per frame (either onground or swiming). What I tried now is to use the computation from 'PM_Friction' from bg_pmove code instead of the approach from 'AAS_ApplyFriction' inside the bot code.
Strange enough the results are good, the output AAS file now has both, jump reachabilities as well as swim reachabilities.

To make it clearer I will sum up the issue again:
The default bug was that either jump reachabilities was generated (when compiling an AAS file), or correct swim reachabilities was calculated. The movement prediction code is not only used for generating AAS files, it is also used during bot game, which makes the problem even worse.
This bug was already fixed here: ioquake/ioq3@9c4c363 where the specific friction was reversed. This mainly fixed the 'real-time' computation, but NOT the generation of correct AAS files.

I have to admit that I don't really understand why using a modified version 'AAS_ApplyFriction' is fixing the issue, hence I didn't make a PR yet. In other words, if someone is interested in fixing this issue, than I can make a PR, but I would need help than, to better understand whats going on here.
I think it is worth noting that ALL idtech3 engines are concerned!
Anyways here is a snippet how the reworked 'AAS_ApplyFriction' code would look like:

static void AAS_ApplyFriction(vec3_t vel, float friction, float stopspeed, float frametime)
{
float speed, control, drop, newspeed;
//horizontal speed
drop = 0;
speed = sqrt(vel[0] * vel[0] + vel[1] * vel[1]);
if (speed) {
control = speed < stopspeed ? stopspeed : speed;
drop += control * friction * frametime;
newspeed = speed - frametime * drop; // Tobias NOTE: why is 'frametime * ' needed? See 'PM_Friction'.
if (newspeed < 0) newspeed = 0;
newspeed /= speed;
VectorScale(vel, newspeed, vel);
}
}

The important thing seems to be 'newspeed = speed - frametime * drop;'

from spearmint.

 avatar commented on August 16, 2024

Additionally I will add a small patch I made for World of Padman as a blueprint:
bspc-botlib-friction-fix-showcase.txt (rename the file from .txt to .patch or .diff,).
Please don't ever apply this file directly as a patch, it was only made for demonstration purposes, to track the issue, though it will also fix the bug, I think. The 'new' solution of reworking the 'AAS_ApplyFriction' function seems more reliable.

from spearmint.

Related Issues (20)

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.