Floating point time is being stored as a float here, we can prevent precision loss by changing some of these to double during the lifetime of the function to get a more accurate result.
- Use fast data types where possible so the compiler can optimize for speed based on platform
- for example, 128 bits might be fastest on ARM
- good future-proofing
- Refactor GetTimeSinceStart() to be a bit faster
- multiplication is much faster than division
- Implement a RageTimer method to get the seconds value as a plain int, for the places which cast the seconds value to an int
- Changing from GetTimeSinceStartFast() to GetTimeSinceStart() where accuracy is important
- Changing from GetTimeSinceStart() to GetUsecsSinceStart() for timestamp diffs
- Adjust RageThreads to accomodate an unsigned timestamp value
- a constant for the maximum value of `uint_fast64_t` replaces `-1` to accommodate the change from signed to unsigned for the `locked_at` variable
- i have separate constants for `std::numeric_limits<std::uint_fast64_t>::max()` and `static_cast<std::uint_fast64_t>(-1)`, so the reader understands -1 represents an error code, though they evaluate to the same value, so i could remove one of the two
- Add two methods to calculate the MMSSMsMs / MMSSMsMsMs time value from usecs directly instead of inferring it from a seconds value, in RageUtil
- Use a similar counter/modulo based method for WheelNotifyIcon, similar to what i did for text_glow in NoteField in 2eeee03
- Make `g_iStartTime` static const for safety
Rename two timer functions:
GetUsecsSinceStart -> GetTimeSinceStartMicroseconds
GetMicrosecondsSinceStart -> GetSystemTimeAsMicroseconds
Remove std prefix from uint_fast64_t
- Remove checking for standard functions from the build system
- Prefix all invocations with std::
- Replace suffixed functions with unprefixed versions
- Include <cmath> in all files that use it and remove the global include
e.g. floorf(x) -> std::floor(x)
* Implemented nITG's Square modifiers
Modifiers added:
Square
SquareOffset
SquarePeriod
SquareZ
SquareZOffset
SquareZPeriod
* Implemented nITG's BumpyX Modifiers
Also fixes up some tiny bits pertaining to the square modifiers.
Modifiers Added:
BumpyX
BumpyXPeriod
BumpyXOffset
* Implemented nITG's TornadoZ Modifiers
Modifiers Added:
TornadoZ
TornadoZPeriod
TornadoZOffset
Another commit is needed to update fallback's metrics
* Update fallback's metrics to accommodate TornadoX
* Implemented nITG's Parabola Modifiers
Modifiers Added:
ParabolaX
ParabolaY
ParabolaZ
* Implemented nITG's Sawtooth Modifiers
Modifiers Added:
Sawtooth
SawtoothPeriod
SawtoothZ
SawtoothZPeriod
* Implemented nITG's Zigzag Modifiers
Modifiers Added:
Zigzag
ZigzagPeriod
ZigzagOffset
ZigzagZ
ZigzagZPeriod
ZigzagZOffset
* Implemented nITG's ModTimer modifiers
Modifiers Added:
ModTimer (Lua method name is ModTimerSetting (takes enums. Ex: 'ModTimerType_Song'). Can be activated with mod strings 'modtimer(song/beat/game/default)' )
ModTimerOffset
ModTimerMult
* Remove Log use from ArrowEffects::GetTime()
* Accidentally removed a CPY(m_BatteryLives)
* Implemented nITG's DrunkZ modifiers
Modifiers added:
drunkz
drunkzspeed
drunkzoffset
drunkzperiod
Another commit is needed to update fallback's metrics
* Update fallback's metrics to accommodate DrunkZ
* Implemented nITG's BeatY & BeatZ Modifers
Modifiers Added:
beaty
beatyoffset
beatyperiod
beatymult
beatz
beatzoffset
beatzperiod
beatzmult
Another commit is needed to update fallback's metrics
* Updated fallback's metrics to accommodate ...
the new Beat modifiers.
* Implemented nITG's Digital Modifiers
Modifers Added:
digital
digitalsteps
digitalperiod
digitaloffset
digitalz
digitalzsteps
digitalzperiod
digitalzoffset
* Removed duplicate zbuffer check.
* Updated Luadocs with the new modifiers
* Removed accidental duplicate Mini from Luadocs
* Split up long modifier lines.
Hopefully, this makes it a bit easier to read.
* Remove accidental commit to root of repo.
* Split up long modifier lines
Hopefully, this makes it easier to read.
* Redid Square functions to not use FastSin
This implementation is based off of 5.2's square_wave function from ModValue.
* Redid zigzag functions to not use FastSin
This implementation is based off of 5.2's triangle_wave function from ModValue.
* Moved square & zigzag calculation to RageMath.
New RageMath functions:
RageSquare
RageTriangle
* Made Square & Digital have the same period...
as Zigzag and Sawtooth.
* Deduplicate tornado calculations.
* Fixed typo in UpdateTornado, and moved UpdateTornado logic to ArrowEffects::Init because it doesn't depend on anything that changes every frame. Tornado metrics are also loaded in ArrowEffects::Init.
* Deduplicated Beat mod update logic.
The logic is now placed into a function called UpdateBeat.
The m_fBeatFactor members are now a 1D array, similar to m_MaxTornado and m_MinTornado.
* Implemented NITG's MoveX/Y/Z modifiers
Added modifiers:
MoveX1-n: Moves a column in the x direction, 100% = move left one arrow size.
MoveY1-n: Moves a column in the y direction
MoveZ1-n: Moves a column in the z direction.
RageTextureManager now keeps a map of textures that need updating, which is none of them because I couldn't find a class that inherits from RageTexture that doesn't have an empty Update function.
ArrowEffects now requires setting the current PlayerOptions before calling any functions. This might make moving to per-column mods easier, and reduces the direct usage of PlayerState.
Tipsy calculations for each column are done in ArrowEffects::Update instead of GetYPos and GetYOffset.
DrawHold changed to only call DrawHoldBody once. DrawHoldBody now does the normal and glow passes together instead of needing to be called twice.
DrawHoldPart changed to take most of its args in a struct.
Giant copy paste mess that NoteField was using to draw timing segment text replaced with a couple functions and a macro.
Selection glow for notefield is only calculated if a section is selected.
Added RageVector3 functions to CubicSplineN for NoteDisplay to use.
Actor effect period is cached now. Sprites and Models cache their animation length now.
ReceptorArrowRow no longer calls ArrowEffects::Update in gameplay.
and exposed all arrow effects functions. This can allow themed elements
to move with columns during gameplay, such as column specific judgments,
flashes, or whatever else.
This required using the new Steps::GetTimingData function and the allowEmpty
parameter to TimingData::TidyUpData when appropriate, as well as clearing the
TimingData to remove step timing rather than coping the song timing over it.
Fixes some odd editor behavior when changing song timing, and is overall a
slightly less hacky way of doing things.
Scroll segments seem to cause the lag when there's a lot of segment
in the steps, say, 165. On my Mac, it drops the frame-rate down by about
30 FPS in the end.
This is because the way the the game tries to determine the exact position
of the note, it has to go through all the scroll segments from the
beginning until it finds the currently active scroll segment and keep
track of the beat to display instead.
And each frame, the game needs to determine the position for each note,
and also when figuring out the first beat and last beat to display. This
makes the game slow even with just 165 scroll segments.
The approach is that at every game update, we create an optimized data
structure that can calculate the displayed beat from real song beat
in O(log n) time. So in this approach we iterate through EVERY scroll
segments each frame instead of iterating through the scroll segments
for each note for each frame. This eliminates the lag on this side.
The data structure is recomputed each update because I assume that the
timing segments can change at any time, but not during draws.
A similar problem is: when using Cmods, GetElapsedTimeFromBeat()
is also called very often (say, for each note and also in FindFirst/Last
DisplayedBeat), we may as well have to make these queries faster for songs
that has hundreds of BPM changes or stops or delays to prevent the game
from lagging.
which returns the dispalyed position and timing (based on the timing display
switch in the editor), so less copy n paste in ArrowEffects and NoteField.
ArrowEffects had a minor change, but the intent isn't up yet.
It needs to be so that when you go from the editor to the chart
for playing in Song Timing, it doesn't use the Step Timing.