#Foundations - Learning Graphics Programming with the Zig Programming language
1 messages · Page 2 of 1
hehe
oh I see, well I can just add a .c file and include it
if it can be done with C it can be done in zig
gimme those nice, slightly blurry edges 
cheater 🙂
because zig ships with a C and C++ compiler
ill tell the zig police
that's how I am linking cimgui
you could actually compile your C++ projects with zig
:\
as long as you're not using gcc
idk people have trouble with the nonstandard gnu C stuff
I'm talking out of turn because I don't know anything about that
I WISH there was a language with syntax like java or C# that had support for embedded C/C++
the two most useful features in all of C++'s history is only compatible with clang and gcc
gcc is my goto compiler : (
do you use gnu c extensions?
yes
beef-lang, unironically
thankfully clang on windows support those extensions too
oh then maybe it's not a problem
zig compiles with clang
I am speaking beyond my depth though I really never delve into this, anything C I've tried to compile with the zig compiler has just worked
WHAT
you can literally write zero zig, and use the zig compiler
based
yea I was just on that page
ah 🙂
I want rust without the borrow checker and with templates, what are my options
nim
the only big downside with this language is you need to use their custom IDE :C
nim doesn't have templates (C++ style ones at least)
maybe like Odin?
idk
nope
Odin receives alot of hate from GPers, for no reason
nim feels to me like if rust and python were merged together
LVSTRI, what about zig?
ah yes odin
have you all heard of https://www.roc-lang.org/
A fast, friendly, functional language.
no templates
x: int = 123
oh.
alright that was a trick question I'll admit
yeah those are (fully) monomorphized generics
odin is very inspired by pascal 🙂
I feel like at that point I'd go use go
the TL;DR is that you can't do compile time snake with those
yeah I know, I'm mainly meming don't worry
debugging a fully compile time game is gonna be not fun
but I want to point out that unfortunately there are zero languages (with the exception of C++) that have actual fully fledged "templates"
it definitely ain't 
but that's the beauty of templates
you can express anything (and crash the compiler)
hrm I see
it's really a double edged sword because if you implement a template system in your language
then making libraries is going to be a nightmare, due to the typesystem being utterly fucked
(just look at C++'s boost)
if you don't make templates then your type system is more elegant and simple, but it's inherently limited in expressibility
I'm totally fine with just a fully imperative, simple language like zig personally
me too, considering I'm used to java
I've got none of this comptime stuff
I mean I could make a gradle plugin but that's, not really comptime either
one day I'll get over templates and use a sane language like everyone else
alas until then I shall keep suffering with sad ceepeepee
ah yes sane language
because being addicted to java is sane
it's better than C++ addiction at the very least
the sane thing is to not program at all tbh
trust me on that one 
that's not how hermite works, as far as I understand it, you just have two tangents per pairs of points
when there's not a tangent there I use a zero vector
I love splines
it's really cool, math is cool
math is kind of wizardry
I guess it's back to reading now
going to do a quaternion slerp thing at the end of this chapter, then it's just barreling down until I finally get to projections
Projections as in..?
as in projecting 3D to 2D
Wait
Idea for coordinate system
X up right, right handed
As in the coordinate system is rotated 45 degrees

I have an X up left handed coordinate system
I was going to do X positive points down, but I literally do the pointing thing all the time, and it's painful to do it X down
nah vulkan is how glfw window works
(weird in a good way)
that picture is also incorrect, the origin is in the center
for gl
(-1, -1) is not P₀
RadDebugger has saved me so much time recently
any crash that I don't immediately know the cause I just immediately run my app in RadDebugger and replicate the crash, it's much better than the the cppvsdbg debugger in vs code imo
I kind of also like that it doesn't debug in the editor
I can debug in vs code now though if I wanted that
As a jetbrains enthusiast addict
I’m surprised you’re not using intellij idea
nah I don't like intellij, I used to
I think Jetbrains is not good at writing software
they have attempted three or four different strategies for achieving remote server editing, and they are all awful and do not work
they tried integrating rsync, which is awful because you need to keep a client side copy of the code
they've tried a projection of an editor running on a remote machine, like you know, like attempting to paint a 2D framebuffer as if it was intellij for an intellij running remotely
they've tried a remote jira agent, that thing doesn't work either
they've tried creating an entirely new editor, distinct from intellij, it's been in alpha for years now
vs code solved this problem like 8 years ago, with no issue
even TUI editors like neovim can do it
The IDE backend is the full-blown JetBrains IDE
mind boggling how bad they are at this
why do you need remote editing?
all my code is on a remote server at work
are you some php webdev person? 😛
I'm a fullstack go dev :P
i mean dont you usually edit locally, commit, push, and have some CI/CD deploy your shit somewhere
what about sshfs?
sshfs is not good, it's very bad
how come? (i have my media and storage connected via sshfs and occasionally develop c#/c++ stuff over it)
well, to get it to work on a mac you need a kernel extension for one
it's pretty dang good if you're doing everything locally
macos doesnt count
a buggy one that's badly supported and requires disabling security features in the OS
I am forced to use macos at work
then I'm working in a slow VM with an even slower filesystem, so I can run a slow IDE, when I don't need any of those things with vs code remote editing
give it all the cores and memory 😛 and put storage on the fast nvme
i understand
thats a bummer
use the RAM as your disk and the disk as your RAM /s
I think jetbrains made really good tech once, and are now just coasting on that aging technology
and are unable to make it any better or do anything new with it
i only have 2 beefs with jetbrains
my main beef with jetbrains is the pricing plan
because you are still a kid without a job
<- actively plans to not get a job as a developer
: D
I respect that
pricing is actually quite reasonable
I would die on burnout if I had to write code for a job
not much more than your netflix subscription
<- has no subscriptions 
heh
in rider attaching the debugger takes "long" (too long for my taste, although its just something like 3 or 4s) when you hit f5 to start debugging
and when you want to make files to be copied to output there is a little dialog to set the specifics... that dialog doesnt remember the size from previous times and you have to enlarge it a little bit to get to that one option i need
those 2 things annoy me, for now
3 or 4 seconds is a really long time
this dialog?
I didn't even know that dialog could be resized
don't think I've ever seen that one
does not exist for IDEA
yeah
its a c# build system thing
to embedd files as resources or to copy them to the out dir or whatever
do your C# engine run in mono on linux?
probably
no
its all dotnet
and yes, lunix and windows
mac would work too if i targeted a supported opengl version 😛
nah thats stupid
you can just run dx9/dx10 and most dx11 stuff natively, on wine
or apples stolen counterpart
d3d12, specifically
some d3d12 probably works too on dxvk
yeah with crossover
ah was that the wine-fork name?
I'm not sure, I just did a google search and it said https://www.codeweavers.com/crossover
yeah looks like it is a wine fork
yeah, name rings a bell now
I legit asked for a linux laptop last week and was told no :/
it's ok, it's a job
fair
I kinda wanna get a mac at some point so I can test my code on one 
mac mini is the cheapest way to do that
does it have apples proprietary gpu
yes
it's a mac
it's just a little box, you have to attach all your stuff to it
if you do opengl, its really really not worth it, if you do native metal, or webgpu, then yes, good idea
$600
decent price
expensive for a mini
I think
I have no frame of reference 
vulkan doesnt run natively either
I also do have some native code
which, I don't explicitly need
but I'd like to have it
: )
I am also considering doing proprietary api impls
The chapters in these books usually take me 1 or 2 days, the interpolation chapter took me two weeks. Honestly it was mostly something I'm going to have to reference if I want to do half the things it discusses, finding arc lengths, constant rate of movement along a curve, sampling points, maintaining camera orientation along curves, etc
Glad it's done. I'll implement some lerp/slerp methods in my math, animate my cubes finally and then move on
It's probably months before I get to projections
ridiculous to think you can just follow LOGL, copy and paste the code, install renderdoc and think you can do graphics programming tbfh
you wrote a mc clone already
You know I didn’t even know about renderdoc for the longest time while writing blockens, I wrote my own cli vao debugger
I printed my vao description and then wrote out the bits in the buffer in a way I could see what they were per vertex
I spent a long time looking at bits in my terminal
idk I was really ignorant
Still am
Also the only matrix multiplication I had in blockens was the final model view projection transformation in the shader
It was all vectors everywhere
You can get away with a lot of dumb code when everything in your game is perfectly parallel and perpendicular to a coordinate axis tbfh
I actually had to do a months long rewrite to get my character and third person camera working
It was when I had to use matrix math elsewhere, to do culling when I realized how much trouble I was in because I didn’t understand basic stuff
Blockens uses fill lighting, I send a per vertex light value
LO-
oh
Learn OpenGL
I learned graphics programming through modding MC for like 2-4 years
Rarely used learning resources except for when I wasn’t working in MC
I am just coming to terms with unrealistic expectations, ignore me
theres no raisin to ignore you
Error: unable to ignore
He's mastered the slerp
pub fn slerp(p: rotation.Quat, q: rotation.Quat, u: f32) rotation.Quat {
const pn = vector.normalize(p);
const qn = vector.normalize(q);
const angle: f32 = std.math.acos(vector.dotProduct(pn, qn));
const denominator: f32 = @sin(angle);
const pt: f32 = (1.0 - u) * angle;
const spt: f32 = @sin(pt);
const sptp: rotation.Quat = vector.mul(spt, pn);
const sqt: f32 = @sin(u * angle);
const sqtq: rotation.Quat = vector.mul(sqt, qn);
const numerator: rotation.Quat = vector.add(sptp, sqtq);
return vector.normalize(vector.mul(1.0 / denominator, numerator));
}
https://github.com/btipling/foundations/blob/main/src/foundations/math/interpolation.zig#L59C1-L76C2
I should check for @cos(angle) near 1 and lerp
and negate p if p is negative
if cosine is negative actually
that changed the animation I had
that's much better now
before:
after:
it was taking the long way around before I checked for a negative cosine
my slerp is now:
pub fn slerp(p: rotation.Quat, q: rotation.Quat, u: f32) rotation.Quat {
var pn = vector.normalize(p);
const qn = vector.normalize(q);
const angle: f32 = std.math.acos(vector.dotProduct(pn, qn));
const cs = @cos(angle);
if (float.equal(cs, 1.0, 0.001)) return lerp(pn, qn, u);
if (cs <= 0) pn = vector.normalize(vector.negate(pn));
const denominator: f32 = @sin(angle);
const pt: f32 = (1.0 - u) * angle;
const spt: f32 = @sin(pt);
const sptp: rotation.Quat = vector.mul(spt, pn);
const sqt: f32 = @sin(u * angle);
const sqtq: rotation.Quat = vector.mul(sqt, qn);
const numerator: rotation.Quat = vector.add(sptp, sqtq);
return vector.normalize(vector.mul(1.0 / denominator, numerator));
}
this line right here did the thing if (cs <= 0) pn = vector.normalize(vector.negate(pn));
I don't think you need const cs = @cos(angle);
you should already have the cosine of that angle as the result of the dot product
inline quat slerp(quat x, quat y, float a)
{
quat z = y;
float cos_theta = dot(x, y);
if (cos_theta < 0.0f)
{
z = -z;
cos_theta = -cos_theta;
}
if (cos_theta > 1.0f - std::numeric_limits<float>::epsilon())
{
return mix(x, y, a).normalized();
}
else
{
const float angle = acos(cos_theta);
return (sin((1.0f - a) * angle) * x + sin(a * angle) * z) / sin(angle);
}
}```
heres mine
also whats the deal with @ in zig?
the @ means it's a built in function, it's not something in the standard library, it means it's doing something very specific based on the target at compile time, like @memcpy trig functions are all built ins
the language reference says:
Builtin functions are provided by the compiler and are prefixed with @. The comptime keyword on a parameter means that the parameter must be known at compile time.
you're right about the dot product, those vectors are normalized so it is just the cosine of the angle
thank you
do you normalize your quaternions prior to slerp?
I probably don't need to normalize after my negation either
I think I should assume the quats are normalized prior to slerp tbh, because they are key frames and I can normalize them when defining them, and not per slerp call
I'm going to clean this function up
Yeah I assume the quats are normalized
that is correct thing to do I think, normalizing per slerp is not good
appreciate you sharing your code!
you should normalize after the lerp though
because you might wanna lerp between vectors that arent normalized
eg lerp(point0, point1, 0.5) gives you a point halfway
those are points
I have linear interpolation for points that's defined seperately
oh ok
Also I don't use the code I posted for animation, its not neccessary to be that accurate usually
I use this
inline quat slerp_approx(quat x, quat y, float a)
{
float ca = dot(x, y);
float d = fabsf(ca);
float A = 1.0904f + d * (-3.2452f + d * (3.55645f - d * 1.43519f));
float B = 0.848013f + d * (-1.06021f + d * 0.215638f);
float k = A * (a - 0.5f) * (a - 0.5f) + B;
float ot = a + a * (a - 0.5f) * (a - 1) * k;
return (x * (1.0f - ot) + y * (ca > 0.0f ? ot : -ot)).normalized();
}```
oh ok
no trig
so my linear interpolation is always a piecewise interpolation, but it's doing the same math otherwise
oh interesting
yeah I saw a no-trig solution in one of my books
the full slerp is resevered for aiming and camera math
my book was saying that under 90 deg lerp is fine, and if you want to blend animation you kind of always have to use lerp
because slerp is order dependent
thank you
and you inline your slerp too hrm
I inline most of my math functions, I didn't in this case
not for any specific reason, makes sense to, I guess if you wanted to build something for web and didn't want a big binary
which is not something I want to do
inline in c++ doesn't neccesarly mean the function will be inlined
ah what does it mean?
that's what it means in zig I think
Adding the inline keyword to a function definition makes that function become semantically inlined at the callsite. This is not a hint to be possibly observed by optimization passes, but has implications on the types and values involved in the function call.
hrm
that's zig
I think that means a small release will still inline it
in zig anyway
Basically inline in C++ just means you can put the code in a header file lol
it used to be a hint, but afaik it does basically nothing on modern compilers
inline is really a comptime thing in zig
I'm actually gonna replace it with constexpr once I replace the fabs call
comptime is zig's version of macros
yeah in C++ we have constexpr
Zig on GP. I approve 👌
I'm not the only one lol 
also I noticed @glossy forge is on this server and they also have a cool zig math library they've made https://github.com/griush/zm
we get one or two more ziguana and maybe we can get a zig emoji, jk

you mean a :nozig: emoji? 😛
#1027528776717975592 is open 25/8
I'm just kidding I have a lot of zig emoji at my disposal already, more than enough, but I am looking forward to more active people here who also write zig
which one would you like to add the most?
probably as that's the official logo
I don't know if there's critical mass to warrant it though
maybe it's just bias on my part but it seems like most people on the zig server are doing something graphics related if they're not part of the core compiler team
it's just like every time I go into someone's bio and github or they talk about something in #zig the non game dev channel they're doing something related to game development and GPUs
so I think if zig keeps growing it will be big in this space, but we'll see

I can't remember anything about the movie tbh
2000 was a strange year for me anyway
I had just finished my tour in the USMC and was starting community college, so big adjustment
i heard about zig in december because my CS teacher in uni told me about it, and it's been my goto since, even if i did some C/C++ I used it for the build system
Nice! Have you been building a game or a game engine?
Damn usually those teachers give outdated shit
he's actually quite young and talking shit about the older teachers for teaching outdated shit lol
Lmfao
yeah, i did in c++ but it was quite a mess, now i'm trying to do one in zig, but i'm just experimenting and researching first, i want to get it right
Nice, doing something similar. Good luck, excited to see what you come up with!
sure, i'll make sure to post here

just doing math things as they come up in the books, like 4 more chapters to go before I get to any 3D perspective stuff ...
I guess I'll have to improve that hover after I have perspective
you may have noticed my square window, it's that way for a reason lol
better
I have this for a sphere but like all my plane math it's pointless to do anything with it that's interesting until I have perspective
I could make a cool 2d game
I don't want to make a 2d game but I could
actually I can't, because I don't even have orthographic yet, I just have a fucking square
⬛
also made these take a center and radius for arbitrary boundary detection
reading about AABB is making me
when thinking about how I did collisions in blockens
you know I should fix my drag and drop from the lines scene to use this code now, because that was hacky and this is the right way to do it
looks great
Thanks! Just some math stuff I am doing right now
thats neat
Thanks, just some triangle math stuff I guess, 3 more chapters until perspective
its a cool visualization
Thanks, it’s also converting 3D cartesian coordinates from the mouse position to barycentric coordinates in the plane of the triangle
That’s being shown in the little info box
It’s a 2D visualization but the math is 3D

Looks like @timber berry has also been spamming this server with their
unfortunately they are not working on a game engine 
trying to find what I said in here
search is being useless
you just pointing me to how to do graphics in Zig?
no you just replied to me on the zig game dev channel
then I saw you were also on this server
@timber berry I'm just glad there are other people here representing zig :D
maybe that didn't come across in my message lol
sorry
you started it though, by replying to a months old message :P
oh ok. Whenever I try to do game dev I get bored.
no worries, good luck on your browser project
lol
I'm real good at making new friends
i kind of dont like deinit
i would prefer destroy
or dispose
i keep seeing it as defer foo.deinit in all those weird zig projects on ze zig zerver
you can call it whatever you want
yeah i thought so, and thats "bad" too
bad is a too strong word here
all the kids tho make zig packages name stuff like they want and you get the spaghetti monster 🙂
well let me explain why it's called deinit

in zig you want to do more than just free memory
you also at the very least want to assign undefined to any pointer props
you want to do a FreeAndNil kind of thing?
yeah
you want to use undefined though
because in safe releases and in debug mode
yeah FreeAndNil is pascal's counterpart
if you try to reference the thing it will panic
and there's probably more you will do in other deinit methods
so it's not just freeing memory
if it is just freeing memory you don't need a deinit at all
you can just destroy the thing directly from whatever calling code
that would call the deinit
thats stuff you would do in a dtor (or free floating Free/Delete/DestroyXXX function) too, free unmanaged resources and reset fields or set them to some undefined state
yeah the init deinit are basically constructors and destructors, but the thing about zig is if you don't have any extra work do do, if all you do in your init and deinit is things you clould just do directly, then do them directly there's no need for these pass through functions
i see
like if you are passing in all the args for the struct as part of the init parameters there's not much you're gaining there
but you are saying i can call that function whatever i want if there is a need for such a function
there's no lint for it
i am just saying that this name should be standardized somehow, so that when i read code, i know immediately..... hmm i understand
there may be a proposal for that
yeah actually need to take a serious peek still 🙂
oi
not exactly
but it's obvious deinit is a convention
it's just not enforced by the compiler
you can call it whatever you want, but you probably shouldn't
its a little sad that every language has to reinvent naming for those things
when it worked for other languages before 🙂
These coding conventions are not enforced by the compiler, but they are shipped in this documentation along with the compiler in order to provide a point of reference
seems intentional to not enforce by the compiler
the reason why
Zig will not enforce identifier naming conventions according to any style. The "style guide" will always be merely offered as a point of commonality for different groups to standardize on, but will not be any kind of rules or enforcement from the language or tooling.
hmm
i see
zorg people will still come up with a naming scheme of sorts over time and then eventually turns into some unspoken rules
yes I think so
I came into zig bringing in my own baggage and over time have just slowly adapted to the convention and the style guide
and then I find myself wanting to use that style in Go at work, because it's not bad tbh
but gofmt then breaks the build :(
hehe
I bought more vulkan books I think I'm team Khronos (GL/Vk) for the long haul
🖖
This is how it is with a bunch of langs
Java has a standardized naming convention
But you’re not forced to use it
The IDE you choose may or may not assume you do use it though
Yep, zig is still going through lots of changes still also
How do you still need more books 
How many GP books do you have? 
I know :( I have a problem
but I am actually reading them
I actually have a lot
I have 8 physical books and 2 more on the way and then I also have about 6 in digital form but not physical form
game math is the only one of the digital ones I'm currently reading
I actually don't like the red and blue opengl books, they're not very good
well they'll be useful in the future now that I understand things better, but for a beginner they weren't good
@delicate delta remember to not fall into book-tutorial-knowledge-study purgatory ✍️
yes I have goals!
the books are the means to the end they are not the end
thank you
the goal being like, an actual game 😅
I'm building a visualization that determines the distance between a point and a line, and I haven't finished yet, but I'm using Plücker coordinates, and I'm using them to extend the line in a way that visually makes them infinite and so I'm picking an extra point to extend my line and I picked just a third point just to see how it worked, and it's kind of interesting
it's like a trombone or something lol
it works by finding the point on the line closest to the origin and then I pass in a float and it picks a point some value in the direction of the Plücker coordinate direction
that green dot in the middle is always the point on the line closest to the origin
the drag behavior lags a little
Trombone and Guitarstring Simulator 2024
Visualizing these things is pretty cool
Perhaps those things come in handy for debug views of sorts later down the road
I think so!
it's like 2:28 am and I have to read about wedge products tomorrow I better get to bed
kind of cool, I put my point directly on the origin and now the line is always connected to the point on the line the Plücker coordinate math says is the closest point on the line to the origin
math works
that's a cool youtube channel thanks
: )
grassman algebra seems to add a lot of complexity to graphics programming and offer few benefits, the most touted being that is makes the cross product, determinant math and quaternion rotations seem hacky versions of more elegant math, but I can't imagine trying to explain someone something on this server the context of antiwedge bivectors
I can't even easily write notes on it because of all the new symbols it adds
looking at volume 2 of FGED, there's one problem in the entire book that references the wedge product, and there are no references to bi or trivectors or antiwedges or any of the stuff, so doesn't seem really worthwhile to uh spend a lot of time on this, but it sounds like he's going to use more of this math in his volume 3 physics book
having finally read though this math I think I'm in alignment with what @verbal mason had said about it too
Well I think it has applications. My issue is that linear algebra is accelerated in hardware. So any new math would need to be emulated in software, or hope it's so useful they add hardware instructions
what sorts of applications?
looking at his code his implementations seem very similar to other linear algebra code
it looks like linear combinations and cross product operations
idk, I'm gonna move on for now
if this helps me solve something later I can come back to it
holy shit I'm 20 pages away from perspective math, I think I'll be 3D by the end of next weekend
06/07/2024 is when I created this thread, end of next weekend will be 08/04/2024, two months of non-stop math reading
I did the math, it is 972 pages
I think based on my current progress I will probably be done with this project and all the books I have bought probably end of year or early next year. I think I can commit to starting a new game March 1st 2025
I will time box this effort to March 1 2025
Assuming life allows for it
Nice
I set a deadline of January 2025 to finish my engine. Not sleeping for 6 months is on the table.
I admire your ambition and goals as well as your commitment. Good luck!
Your engine is already very impressive
Thanks. You gotta be in it to win it.
Yes
What kind of features?
what happened to the 2 games you wanted to finish in march 2024? 🙂
I use dealloc
I'd like to have new and free but Zig would think that's hidden memory allocations or something stupid
hehe
Turbo Pascal had Init; and Done;
Delphi Create; and Destroy;
i guess either works and every language wants to be a bit different so all good
Delphi sounds cool
I like the full UI experience of the visual development environment you were sharing in a screenshot, reminds me of visual basic
it's just mostly nostalgia, the box set with the visual editor and a cd rom and some books, I'm not sure I actually want it now I don't like use intellij or visual studio
Delphi 8 turned into Visual Studio clone
yeah i miss those times too 🙂
you can whip up fully fledged master detail database programs within a few clicks, including databinding, database connections and whatnot
I just see that and want to build something cool though
hehe
I look at visual studio and I want to close it
xD
I abandoned Delphi for good in 2010
the company behind it just didnt give a fuck about fixing bugs, for years
aw that sucks
it went downhill when they sold all the borland stuff to codegear and later to embarcadero
Borland, the Sun Microsystems of Programming Languages
i still remember compiling GLScene (had 330k loc at that time) in 2s from 0 to written binary on disk on an athlon xp2200
ah thats GLScene in Lazarus
i made the orange icons : ) and they keep using it
ok i stop hehe
did you make a game?
this is just shit i found on google images
oh
but i did a bit of stuff, but i dont have any records of it anymore : (
that was 1998-2007ish or so
I don't have any of my pre-github stuff anymore either
but ever since github it's like permanent
i do have some silly "car driving in a city" thing lying somewhere
which still runs on todays windows
not sure where it sits though
my oldest thing on github is this d3.js risk game lol https://github.com/btipling/sphela-game
it's basically a d3.js globe and I made a game with it
prior to that I made my own IRC client, I had a color picker website that got popular on digg, I had a browser game, I made an iphone app, I had mac app, I had a bunch of python stuff I did, I built an Adobe Flex app, a PHP based blog, all gone now, it was probably all terrible code though so good riddance
it wasn't bad tbh
php has like a package manager now and is more strongly typed and such
so i heard
I managed to find the first game I made from 1998. Can't get it compiled, sadly, need to spin up an old VM. But here is one of the backgrounds (cyberpunk RPG).
On a floppy disk in my mom's garage. Uses some ancient version of Java and a web applet, no way to play it today.
Almost all my old stuff is gone. Saved a couple of my better Flash games, but the emulators can't really play them.
java web applet wow
that's like some 1990's tech
all I remember about java web applets were was water reflections on websites
and the java download tool itself was a java webapplet iirc
lol ya
Lol I just opened this vulkan book I bought found a familiar name as the reviewer @wise imp
I have completed all the chapters that preceded perspective math finally. Each next chapter in my math books is perspective, basically out of the kiddie pool now yay
its a great book that one. im checking a few of them right now to implement them in my engine
We are in 3d now, 
the fancypants volumetrics ive implemented on my project ive gotten from the book
that book really shines if you are actually implementing a real engine
having code + detailed explanations of how it works is super handy for complicated effects like this
Yes I plan to go through it carefully !
And build an engine
starting to think about the next game I want to build
couple ideas, a cooking game with a mystery story, a construction vehicles simulator game, or a small space station repair tech simulator, not voxel, but like a tiny space station that is a sum of parts that can be fully disassembled, really want an achievable small scope, 3D, single player. Kind of leaning into the small space station repair one since it's probably the smallest in scope in terms of art needed
I'm going to keep thinking about it and write down ideas as I work though the books and keep making progress
I kind of like the construction simulator too, I think I can make that scope small
kind of like command and conquer RTS but just the construction part

I love both ideas tbh
the space station one has a subnautica feel the more I think about it
which one
wow what's that
there are smoller variants as well
and whenever i see one on the road and i happen to walk by, i stop and look at it like a little boy
i used to build those massive ones out of legos when i was 13, 14, 15 or so 🙂
double steering in the front and back and neatly tucked away thingies you put out to stabilize the crane when it gets deployed
a friend of mine bought a 400 euro chinesium lego set of that specific crane in the pic
absolute monstruosity
yeah
and their "lego" material is also better than original lego these days
man i love cranes 🙂
or otherwise complex machinery on the roads, like those pump wagons which come for cleaning the sewage
all sorts of levers and switches and pipes and hoses attached to those big tanks, quite cool to watch them in action
I could look at these all day tbh
I was actually inspired by my childhood memories of Playmobil, but Legos too
I love fire engines too
sometimes the city brings them to the park for kids to climb on
I don't climb on them but I do admire them
I don't have the living space to do any legos
maybe that's why I love minecraft and voxel games so much
the name foundations actually might make sense for this game :P
maybe I just transition it to a game
Foundations as title for a architectural game is a perfect fit
right?
People i know who played with Playmobil instead of Legos were always a little weird 🙂
also remember that getting "legit" chinese not-legos is morally right
their fault for cheaping out
Playmobil was big in germany for kids back in the 80s, I had legos too
the thing about Playmobil is that it's the kind of toy kids love but as you get older they lose their appeal whereas Legos are always fun
but they were really exciting as a kid
I will allow it
as long as legos were involved, but if you were a playmobil kid only, id end the friendship right now lol
I had those too, they sold them in the upscale toy stores in NYC
I had a legos moon base, that was the fanciest toy I had besides my playmobil pirate ship, most of my toys were preowned
excited about a construction game I'm going to keep thinking about it, it involves world changes
I want to avoid voxel engine stuff tbh
maybe it's just a regular mesh tree
for a construction area
In my neighborhood growing up there was a bootleg toy store, think the guy was Chinese, and had imported stuff like the Japanese Voltron and stuff like that, probably why I'm a huge anime nerd
so now that I have a projection I'm going to do all the plane math I've gone over and couldn't do visualizations with and I'm going to extract the projection planes and demonstrate culling that way, which is the thing that led me to abandon blockens because I couldn't understand how to get that working
then I'll go back to reading more
Losing my fucking mind at the pluralization of lego here
Let us know if you need any help
sorry
dont be 🙂
Im just being a pedant
It is, however, wrong to say “LEGOs”, if you are referring to the brand/company.
I was incorrect
it was a fun moon base
Yeh I love lego
I think it was that
man i remember that
it was still before my time, but i remember seeing it in catalogs
my first legos
i got 1987 when i was 4, 2 Lego TECHNIC things, a forklift and a little buggy with 2 of those lego technic people
those ground plates they used for decades 😄
I had that one but not the whole base, just the ship
most of my toys were used, this one was one of the ones that wasn't
These were my favorite tho https://wheeljackslab.com/blog/ten-most-expensive-starcom-toys/
i had that space stuff from the 90s, that black red destroyer ship and a lot of the white/neongreen ground stuff
I remember these
clear legos blew my mind
fuck me, i forgot about the space rail shit
that was also peak 80s
i want that kind of lego back 😦
i dont need marvel themed shit
I had the first two, not the big one
or lego city where you have only 1 piece of something which used to be 10 pieces
I don't mind the harry potter legos
yeah, the star wars stuff is neat too
hehe
this shit with actual doors and you could put people IN the cockpit
was cool, i think i even had this one too, and the bigger ambulance with lights and a sirene thingy
working on a config file so I can set view options, so I don't have to look at a square anymore, creating my own file format :O
because I want zero zig dependencies and don't want to add a c dependency build for a config file that I'm storing basic stuff in
I don't like hard coded view options
heh I didn't know my video was recording sound
that's unfortunate
anyway
that was a lot of work to write a config file parser and make it work, I didn't add the ui settings and I have to fix all my visualizations now to work with perspective
it is saving settings now though to a file and loading them
just no UI to set it, have to open the file
famous last words
I'll use an orthographic projection for all my 2D visualizations and I guess I will have to application side transform the drag handle positions so they'll match what's on the screen
with that same projection
that sphere looks garbage in 3D because I wrote it to use the colors from 2D positions
and the wireframe doesn't look great either anymore, lost all that beautiful symmetry due to perspective
I've been migrating my 2D visualizations that just had a hard depedency on a square window to orthographic projections, it's been kind of fun. The projection is easy, it was figuring out the hover and drag interaction that was a fun problem to solve. I basically had to do some transforms aligning window coordinates and the orthographic projected coordinates of my vertices
just messing around with the orthopgraphic projections is kind of fun, I actually hadn't used them before
nearly done with this, I have a lot of scenes I've written that I have to migrate each manually, I'm going to work on display setting UI and then start working on a new scene that is just a demonstration of how look ats are just the inverse camera matrix, then I'll do all the plane stuff before going back to reading
unfortunately my job isnt going to well right now so have to work through this weekend though :<
Streamed Live on Twitch: https://twitch.tv/tsoding
Enable Subtitles for Twitch Chat
More Episodes: https://www.youtube.com/playlist?list=PLpM-Dvs8t0VYwdrsI_O-7wpo-_MMIdeX8
Chapters:
- 00:00:00 - Day 1
- 01:51:00 - Day 2
References:
- The issue: https://github.com/c3lang/c3c/issues/1273
- subprocess.h: https://github.com/sheredom/subprocess.h
-...
"Since the downfall of zig..."
that made me laugh out loud
oh they are on this server?
"it's not my language, the language is fine, I'm not the target audience for it" https://www.youtube.com/watch?v=CDCU6b-WzAw
seems like reasonable opinions
idk
yeah I like these videos
neat
good videos ya
yeah I was disappointed was trying to find a good zig trolling, but he's just making good videos
heh
c3 looks cool
too bad for them that zig already won though :(
actually
what I like about c3 is better macro support
c3 probably works seamlessly with flecs
also c3 has header files
Volatile and const have no representation in C3.
that seems bad
yeah also cool
if I wasn't writing zig I probably would be just writing C++
idk why I like zig, I just do, but I would go to C++ if I ever got tired of it
i have not tried c3 yet
yeah idk zig is working for me, I have spent a lot of time becoming more and more competent in it
c3 seems cool though
i dont mean to convince you to drop zig btw 🙂
I actually want to build a game at some point I can't be language hopping
haha
yeah, and the macros are nice in c3 too
translate-c stuff in zig works ok but sometimes it doesn't
this tscoding video is hilarious
I just have it on in the background
ok I finished migration my visualizations, it's "ok"
idk
he also does some cool beatboksing in between hehe
the splines are so much nicer in a big window
the hover targeting isn't precise on that one
anyway, it's all migrated
BTW
like BTW
I made those grid lines there 3D
because in that screenshot they are 2D and I had to rotate them and they would only look right from that perspective
so
I made paralelelpoops
fully 3D
worked first try
those are generated parallelolols
I sketched that out
wrote the code
and replaced my lines with the pralellelepipeds without any changes of the scene data other than replacing "quad" with "parallelepiped" and it just worked
it's all still instanced
building out my camera movement
that other cube is going to be the camera
it's all quaternions all the way down
I need to fix directional movement to use the orientation still
looks cool though broken like that
you can't find this kind of camera orientation on LOGL
it's basically 4D rotation in a hyperplane 
this is so great
this turned out so much better, and easier than I imagined
it's so much easier to understand code to than that LOGL camera control garbage
I just copied and pasted it and it wasn't even the right coordinate system, and I had no clue how it worked
it does have some roll to it though
nice
LOGL is good cause it has most of the things you need in one place
however, I've found errors in almost all the tutorials (some small, some large)
LOGL is great, what's bad was just how I didn't understand it
I shoudn't call it garbage, and anyway my thing has a roll I have to fix
so it's not as good
this is so much fun
it just works by multiplying two quaternions by the camera orientation, which is also a quaternion
I take the right and up from mouse coordinates, turn them into axis angle -> quat -> multiply both by orientation
then the perspective from the camera is literally just the inverse of the camera's translation and the camera orientation quaternion to matrix form
I got some work do make the key handling and the grid and stuff better
but lots of progress
was able to get rid of the roll by using 2 separate quaternions to store orientation and update them independently
then concatenate them at the end
I think that could be a mode though
this is neat
like use one quaternion and then A and D roll or use two quaternions and then A and D go left or right
your camera needs a bit lower sensitivivititiy
yeah
to make the moving around a little less jerky
it's not even using timestep atm
ah
need to fix all that
also the grid there is enormous
the scale of everything is way off
there is a blog about grids 🙂
nice, it's been fun figuring it out
oh that's a shader
I literally have geometry
lol
those are actually vertices
in mine
yeah I was thinking, hrm this could just be a plane
it's been really cool building my own camera and look at though
my own mouse rotation
nothing is copy pasted, it's all my code, just feels great
: >
this one is good. I implemented it (it's disabled right now, but I should add it back)
i still have it on me todo list
I didn't even think to use a shader for this, I don't have any blending or transparency set up right now
I have written very little GLSL tbh, my voxel game shader code was pretty simple, all the lighting was fill lighting. I had some complex GLSL for texture mapping and that was it
my shaders were all generated by zig
: )
i rember the cool endermen 🙂
added a fly mode with roll so I can have normal camera and also a fly camera for fun
I haven't fixed the sensitivity yet
I could do some glftfs, add a space station, some fighters and have a game lol
and some particles
gamepad controls
I don't think the mouse is a good fly mode input for turning tbh, probably want key controls for right hand for that
you'd need a 3D mouse for this: https://www.youtube.com/watch?v=n3NK-WCAoFI
Plug-in to add support for 3Dconnexion Space Mouse and Space Navigator 3D mice input devices. Control the Godot Engine editor viewport camera with 6DOF (6 degrees of freedom). Freely translate the camera position and also rotate along the yaw, pitch, and roll axes. Available as a free open source plugin for the Godot Engine. Download today.
http...
that's really cool
I'm going to add time step and call it on this one, start the plane math stuff so I can go back to reading
just going to do distance to plane and plane extraction and culling, probably be reading again by monday I hope
actually want to do some normal stuff with the grid too
these normals are correct, but I think I have some bad fp precision in far, I think I know how to to fix it, I read about this. This looks terrible. Also good I added normals because the parallelopoops I was creating were totally broken. Thank god for renderdoc for helping me fix my bad vector math and indices. It's correct now though.
I don't care about the z fighting at the junctions
looks fucking terrible
I'm pro graphics
fixed
lol
I guess I'll fix this tomorrow
hmm.. that's a lot of geometry. a plane looks okay
I'm going to try the infinite projection matrix with the reverse distance components to get better precision in far
Are you on Vulkan or OpenGL? There was a bug with the reverse infinite z support for OpenGL in RenderDoc. it might have been fixed but I need to test it again
OpenGL
I plan on migrating to Vulkan end of year
if it doesn't work I'll just reduce my far so it doesn'tn look so broken :(
You can try it, I opened a bug report on GitHub. it seems fixed on my side but I don't think anyone verified it
I will test it out, thank you!
this the first hit on google, but worked for me: https://nlguillemot.wordpress.com/2016/12/07/reversed-z-in-opengl/
it's good they set their glClipControl to 0 1 I do that too
-1, 1 is DOA
oh I have to attach a framebuffer with a different depth buffer
all the steps are in there
yes
that's really helpful thank you
it actually doesn't look better
because the grid just turns into an ocean
I think I will just reduce the size for now and eventually work on a plane shader grid
no, it's not going to make a difference unless you are rendering like an open world game
yeah
I think I need it for my AO stuff, tho, since I'm trying to put it in a 16-bit buffer cause 32-bit doesn't work on web
I'm currently working on adding a time step
my job is kind of in a critcal place and I am having to work nights and weekends, so only getting a little bit of time in
but
I did buy some more books
I think I will add flecs in too
then I'll work on plane math and then go back to reading
I think after getting through all the perspective chapters and finishing the basic math I'll add a glft importer
nice
I know I'm going to end up using flecs anyway so since I'm adding timestep might as well as add the components now that will represent all the game objects and have the components for position and orientation
did you do this? https://gafferongames.com/post/fix_your_timestep/
Hello readers, I’m no longer posting new content on gafferongames.com
Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to Game Physics.
In the previous article we discussed how to integrate the equations of motion using a numerical integrator. Integration sounds complicated, but it’s just a way to...
yes I'm doing that and the RK4 method along with the subsequent post on there too
it's in progress
it's not done yet
RK4?
It's a physics integrator discussed in an artcle on gaffer on games that's linked to at the top of the time step https://gafferongames.com/post/integration_basics/
Hello readers, I’m no longer posting new content on gafferongames.com
Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to Game Physics.
If you have ever wondered how the physics simulation in a computer game works then this series of articles will explain it for you. I assume you are proficient wi...
I wan to try it out
it creates 4 differentials to calculate changes in position and velocity in that article instead of the euler approach
oh, Runge Kutta yeah. I've done that for physics before. What are you using it for?
got it
flecs did not work out for me
would be too much work to make it work
I don't want to spend a week or two building zig bindings for flecs and I don't want to use zig libraries
I'm just going to do array of structs or some awful thing
ecs_id cannot compile with zig and these macros https://www.flecs.dev/flecs/group__flecs__c__creation.html#ga26d6cffa50175d9be555633e96916d47
just not doable
I looked at zig-gamedev's flecs and they did a lot of work
and it's just not what I want right now
my little scenes don't need this
I'm not building an ecs either
I learned a lot from using flecs in blockens
that code I had before I did flecs was really bad
I learned a lot from flecs though
fuck
ze flecs man is on ze serveur
I need to stop reading websites and go back to reading my expensive books and worry about it when they cover it
ah i didnt read
Yes, it’s not going make it any less work to use
flecs does some fancy macro stuff to do overloading in C
i see
And zig isn’t having any of it
It also does some meta type stuff
Idk no biggie
ecs is cool but doesn’t work for my situation atm
It is cool sanders is on the server though
there are no existing flecs ports you could try? or where people perhaps did some workarounds to the problems you mentioend?
ah
I pull in a new version of zig every day
There are “stable” versions of zig that are released and some libraries stick to those
The problem is those stable versions get no bug fixes and editor extensions updates
Did you try entt? It's pretty good. flecs is more advanced (I needed some features) but entt was a little simpler, which might make integration easier
entt is cpp20 template metafuckery, 0 chance that worsk with zig
can zig even bind to cpp?
i just got learned that zig has a weird file naming convention
random screenshot from a random zig project
i noticed that and got told thats how zig convents this convention
naturally i dont like it heh
Via c extern, but yeah, entt would be a lot of work
So, I was fully unaware that file structs were supposed to have different naming conventions
I just read the game dev discussion
File names fall into two categories: types and namespaces. If the file (implicitly a struct) has top level fields, it should be named like any other struct with fields using TitleCase. Otherwise, it should use snake_case. Directory names should be snake_case.
ye thats ultra stupid, that alone makes zig lose 100 cool points
how is a file implicitly a struct?
This sort of thing doesn’t matter if you’re not writing a library
Every file is a struct in zig
but i might write a library, put my renderer in it so that i can reuse it in all my cool games 
You can declare properties directly at top of file
you omit stuff like other languages have export(s)
for example
but then relying on the naming convention of the file is mega weird, im not buying it (yet)
x: f32,
y: f32,
const point = @This();
pub fn getXPosition(p: *point) f32 {
return p.x;
}
in another place:
const Point = @import("Point.zig");
const p: Point = .{.x = 1.0, .y = 0.0 };
std.debug.log("xpos: {d}\n", .{p.getXPosition()});
okay, I'm not familiar with zig, tbh
a contrived example ^^
this makes sense to me, I guess
I love file structs
I didn't know they needed to be camel case to follow the convention
I hate that
because file systems aren't case sensitive
I guess I will follow the convention though and reread the style guide because I didn't know that and I thought I knew the style guide
nah
camel cased file names are not my thing
I don't care
the zig police can come and arrest me
used the spring accelerator with Runge Kutta from the website for fun, works great. with a time step. I'm only doing time step on the forward movement not the reorientation
lol
it's a UAP
alright I'm done with this one, time for plane stuff
actually I have to make this camera code reusable for my next scenes

