-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor trails #59
base: master
Are you sure you want to change the base?
Refactor trails #59
Conversation
Squashed commit of the following: commit e4a72f3 Author: Teero888 <[email protected]> Date: Fri Jan 3 00:59:31 2025 +0100 add speed mode commit 127a81b Author: Teero888 <[email protected]> Date: Thu Jan 2 23:03:03 2025 +0100 code review
Merged pr ddnet#58
if(ClientId == -2) | ||
Alpha *= g_Config.m_ClRaceGhostAlpha / 100.0f; | ||
else if(ClientId < 0 || m_pClient->IsOtherTeam(ClientId)) | ||
Alpha *= g_Config.m_ClShowOthersAlpha / 100.0f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ClientId can never be -2 or < 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Future proofing for when ghosts (-2) are added.
I'm not sure what < 0 is, I just copied it from players.cpp
float Alpha = (OtherTeam || ClientId < 0) ? g_Config.m_ClShowOthersAlpha / 100.0f : 1.0f;
if(ClientId == -2) // ghost
Alpha = g_Config.m_ClRaceGhostAlpha / 100.0f;
if(Trail.at(i).TooLong) | ||
const STrailPart &Part = s_Trail.at(i); | ||
const STrailPart &NextPart = s_Trail.at(i + 1); | ||
if(distance(Part.Pos, NextPart.Pos) > 120.0f) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't check this here because the Position at each end get interpolated by intratick so the length between positions can change over a tick, this is a regression from whenever I added TooLong. You can see the bug this causes in this video at 2:21 if you play frame by frame.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include <engine/graphics.h> |
if(PredictPlayer)
Trail.at(0).Pos = GameClient()->m_aClients[ClientId].m_RenderPos;
else
Trail.at(0).Pos = mix(PrevServerPos, CurServerPos, Client()->IntraGameTick(g_Config.m_ClDummy));
for(int i = 0; i < (int)Trail.size() - 1; i++)
{
if(distance(Trail.at(i).Pos, Trail.at(i + 1).Pos) > 120.0f)
Trail.at(i).TooLong = true;
}
When it's checked here Pos != UnmovedPos, Pos is then not modified at all
TooLong is also not modified and only read in the render part which doesn't modify the trail.
You should be able to do this check at rendering.
As for having a bit of extra trail when you respawn in the video, it's working on my machine™
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the bug doesn't replicate, even though I'm pretty sure it should but I don't care why so good enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
120 is actually a bit small, when youre falling really fast some bits get chopped
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw 600 somewhere i think thats more sensible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be changed to difference between segments, so if your speed increases by >120 in a single tick it cuts
* Changed mode to 1 indexed * Change mode selection to dropdown * Only show trail color for solid mode * Other refactoring
5df8aef
to
34cd259
Compare
It looks the same to me
Checklist