Geometry images: vertex positions and normals are stored in textures. Image compression can be used to store them, and they can be sampled at different (mipmap) levels to get different triangle counts
WebGL 1 doesn't have bitwise operators, required for collision masks... I ended up using a rather primitive but fast collision filter: dot(particleA.filterVec,particleB.filterVec)>0.
@olafurw
“Pi is an infinite, nonrepeating decimal - meaning that every possible number combination exists somewhere in pi.”
Does this mean that photoshop.exe exists in pi? Is pi illegal?
-fbounds-safety: Runtime & compile time bounds checks for C code in LLVM. Low overhead makes it possible to ship checks to users.
This tackles one of the biggest causes of vulnerabilities in software today. This is huge!
To solve the floating point precision problem in open world games:
Divide world into cells. When the player changes cell, move the world so the current cell is at (0,0,0). Physics and rendering is performed relative to the current cell origin.
When using double precision, similar things happen at the same distance from the origin. I guess this means HTML5 canvas is using single precision floats under the hood
My first Rust reactions (coming from C++):
const by default 👌
Implicitly “auto” everywhere 😍
No null pointers 🤯
Can’t have 2 mutable refs to same value 🤔👍
Use after move = compile error 👍
Built in style checker 👍
Modules & package manager 📦❤️
This line of code may look innocent:
x = lerp(x, target, deltaTime)
But this is what happens when the framerate gets low! It overshoots. Switch to a framerate independent version before it's too late! Code:
@ImLunaHey
Yep. And they slow down code reviews. They can’t see issues that a linter would highlight, so humans have to point them out while reviewing instead
Precision problem solved! I went with the cell based solution. Space is divided in NxN cells. Simulation + rendering happens locally in each cell, which is 1x1 km.
I can now start exploring the solar system! For reference, the Earth-Sun distance is about 10^11 m.
Guard clauses: Return early for the unusual cases.
Emphasizes the happy path, removes nesting (and sometimes mutable variables too!). Error cases are placed closer to their corresponding checks.
#refactoring
#programming