Finding the BEST sine function for Nintendo 64
Channel:Kaze Emanuar · Length:26:40 · Published:2023-06-24 · Views:420537
Summary
Kaze Emanuar searches for the best sine approximation for the Nintendo 64, comparing the lookup tables in Mario 64 and Ocarina of Time with polynomial alternatives. It walks through numerics and 3rd, 4th and 5th order approximations.
Why HN recommends it
Cited in discussions of sine implementations and whether lookup tables beat computation on memory-bound hardware.
This guy puts a lot of work into figuring out if there is a faster way to do trig calcs on the N64 — HN, 2024
Software performance & optimization · Game programming & engines · Game history & retro gaming
Subtitles (excerpt)
back in the day of 2D gaming things were pretty straightforward to move your character around you just add the horizontal speed to the X position and the vertical speed to their y position it was all about programming logic and not so much about the math plus you didn't have to deal with the nightmares of compilers the good old days of programming and pure machine code every programmer dream when we shifted from 2D games to 3D games the game physics and rendering got a whole lot trickier now with have to deal with an additional Dimension which will require trigonometry to achieve let's take an example imagine you have a character in a game this character can move forward and rotate in any direction now the direction the character is facing is represented by an angle which we called the face angle when the character moves forward they're moving in a direction determined by the face angle and this is where our friend sign and cosine come into play to move the character we change its X position by multiplying the sign of the face angle with the forward velocity while same stainless we change its Z position by multiplying the coign of the face angle with its forward velocity similarly in 3D games we have 3D animated characters and each character is made up
On Hacker News
Yeah, I used a ton of trig tables for software renderers in the late 80s/early 90s, but I'm just throwing ideas out there, since I've seen a lot of really great optimizations recently that were mostly missed during that time. This guy puts a lot of work into figuring out if there is a faster way to do trig calcs on the N64 than was used in SM64 (spoiler: there is): [VIDEO] Jez (CEO of Argonaut) o… — qingcharles, 2024-08
This is the video that got me thinking: [VIDEO] I was writing software texturers etc in the late 80s/early 90s, and even recently I've seen x86 people humble me with all sorts of info that I had no idea about at the time, concerning pipelining etc. I would just sit all day randomly reordering assembler instructions and reprofiling teapot renders to see if anything would move the needle. — qingcharles, 2024-08
You might also find this video interesting: "Finding the BEST sine function for Nintendo 64" [VIDEO] — eska, 2024-03
Not just modern machines, the Nintendo64 was memory bound under most circumstances and as such many traditional optimizations (lookup tables, unrolling loops) can be slower on the N64. The unrolling loops case is interesting. Because the cpu has to fetch more instructions this puts more strain on the memory bus. If curious, On a N64 the graphics chip is also the memory controller so every thing t… — somat, 2026-03
It's not useless if it's good enough for the problem at hand. Kaze Emanuar has two entire videos dedicated to optimizing sin() on the Nintendo 64 and he's using approximations like this without issues in his homebrew: - [VIDEO] - [LINK] — boricj, 2025-04
Related videos
- Nathan Barley - Episode 1 · genuinelyfunnynazi · 26:02
- Casey Muratori – The Big OOPs: Anatomy of a Thirty-five-year Mistake – BSC 2025 · Better Software Conference · 2:27:33
- These Stupid Trucks are Literally Killing Us · Not Just Bikes · 35:07
- 8 Bit & '8 Bitish' Graphics-Outside the Box · GDC Festival of Gaming · 1:25:34
- How Python was Shaped by leaky Internals, Armin Ronacher, Flask framework · Видео с мероприятий {speach! · 49:55
- CppCon 2015: Andrei Alexandrescu “std::allocator...” · CppCon · 1:12:27
- Reverse emulating the NES to give it SUPER POWERS! · suckerpinch · 22:21
- Overwatch Gameplay Architecture and Netcode · GDC Festival of Gaming · 1:04:03
- Preventing the Collapse of Civilization / Jonathan Blow (Thekla, Inc) · DevGAMM · 1:02:41
- "Performance Matters" by Emery Berger · Strange Loop Conference · 42:15
- The Ultimate Game Boy Talk (33c3) · media.ccc.de · 1:01:06
- The Thirty Million Line Problem · Molly Rocket · 1:48:55
- CppCon 2017: Matt Kulukundis “Designing a Fast, Efficient, Cache-friendly Hash Table, Step by Step” · CppCon · 59:33
- RustConf 2018 - Closing Keynote - Using Rust For Game Development by Catherine West · Rust Programming Language · 42:29
- Erlang Factory 2014 - That's 'Billion' with a 'B': Scaling to the Next Level at WhatsApp · Erlang Solutions · 49:15
- A Deep Dive into Nanite Virtualized Geometry · SIGGRAPH Advances in Real-Time Rendering · 1:09:59