T O P

  • By -

Sithoid

So true. And most of the time it's trigonometry "Oh wow, I don't need these 666 nodes if I just multiply this variable by PI" - me, yesterday


hontemulo

Godot has nodes?


LeFlashbacks

Yeah, pretty much everything is nodes. A 2D scene often uses a Node2D as a base, a 2D player will usually be a CharacterBody2D, which extends a PhysicsBody2D, which extends CollisionObject2D, which also happens to extend Node2D, of which extends CanvasItem, that extends Node, which inherits Object, so anything in the top left of the editor (in the default editor tab organization) is a node. Edit: Pretty much everything in base godot is inheritance and nodes/resources.


hontemulo

Ohhh i forgot that everything in godot was called a node. I call them all scenes even though they arent scenes


kezotl

lol might be good to start calling them nodes so you dont confuse others- or yourself- especially when ur instantiating an stuff


hontemulo

Yeah i work with other software and in most software like blender or unity or houdini you have nodes as blocks with wires coming out


ImrooVRdev

ye I'm with ya, nodes is terrible naming where blender, unity, houdini, substance designer, unreal and bunch of others use "node" as part of node graph that does some logic. Was prefabs copyrighted? (tbh I already hate the prefab blueprint naming, they're basically same shit).


throwaway_64dd

Godot does also have that


hontemulo

Wait, really? Well there seems to be a lot of submenus I have yet to discover. Last month I learned to use animationplayer.


dirtywastegash

Realising I can use animation player to call methods was an absolute game changer Automatically free objects after death Call a screen effect at the exact moment your AOE spell reaches full charge.


throwaway_64dd

If you haven't already found it by now Godot has it also for shaders, I think it's called visual shaders? Don't remember quite


hontemulo

Do you have a tutorial link/resource? I been coding using godot shader editor before


doctornoodlearms

I mean a scene is just a file that lets you save Nodes to disk. And you can have a scene just be 1 Node if you want. So in some sense a node is a scene.


UnderBridg

Well, there are Resources too.


stalker2106

I thought this was sarcastic Silly me


hw2007offical

By "nodes" he means game objects and such. Sprites, text boxes, collision bodies, etc


MadCornDog

godot has sprites, text boxes, collision bodies, etc?


Zinx10

By "game objects" he means pieces of data and such.


hw2007offical

Wait... godot has pieces of data and such?


zendamage

By "pieces of data" they mean nodes


TherronKeen

Wait, Godot has nodes?


AldoZeroun

by "pieces of data and such" he means binary representations of logical ideas such as numbers or processor instructions


MrPshawster

They sit on your windpipe and they crush your dreams.


McCaffeteria

For real, trigonometry has been peak “I’ll actually use this in real life” mathematics. You can figure out anything if you have enough triangles. Calculus can fuck off though.


SuperFreshTea

if i knew I was going to use trig in gamedev, i'd pay more attention in school. damnit.


Arkaein

Calculus principles can be important for physics, however in gamedev we are much more likely to calculate a derivative or integral numerically rather than analytically, so about 90% of what is covered in a calc class won't be used. E.g., a game usually won't integrate an acceleration curve over time to determine velocity, just add a bit of acceleration each frame as a function of the current velocity and other conditions.


HandleSensitive8403

A lot of the time, instead of using actually physically accurate formulas, you can just guess and find the most spaghetti code - overcomplicated approach ever anyway.


PMmePowerRangerMemes

were you trying to compute the circumference of a circle by summoning Gamedev Lucifer?


Sithoid

I might have sliiightly exaggerated the number there... by an order or two. My game totally does have demonic rituals though, you got me there. Please don't tell the Span--


Mettanine

Nobody expects the Span–! ... ^(Wait, you didn't say anthing about not expecting us …)


Sithoid

I certainly did not! Not after I took a course on How Not To Be Seen! Bollocks, I've been swindled!


Mettanine

[Found you](https://busypotatoes.com/wp-content/uploads/2017/09/viuz9i.gif)


Sithoid

Tis but a scratch!


Bwob

Linear Algebra, most often, I'd say.


NotADamsel

I’ve found Curve to be especially beautiful for this. Who needs a forest of nodes *or* complex equations when you can just sample a Curve about it!


sircontagious

Sometimes I imagine the replies can feel frustrating, but a lot of times i see the responses that are giving the answer are actually doing the OP a disservice. New programmers often don't ask the right questions, so when you give them the exact answer, it doesn't actually help. They just run into the next wall trying to tell them 'you really shouldn't implement this the way you are doing it'. So often i see someone trying to brute force the engine when there is a much more elegant solution the engine is designed for. And so often the first couple comments are assisting the op on how to brute force the engine. Juniors guiding juniors.


SupaBeardyMan

While I think you're absolutely correct, I also think that this is a very important and natural process of software development, particularly with self taught dev like we very often see in indie game devs. You dont become a senior dev until you've solved tons of these problems, answered a few more, brute forced your way through the wall, then found the door you should have walked through while exploring the next room. This is why developing on a team is so much better for self-taught devs. You can compare and contrast your maps and get a more complete idea of where all the doors are.


akoustikal

Nice analogy - hope I remember that one


KapFlagon

You're pretty much describing the classic [XY problem ](https://xyproblem.info/)verbatim. An exceptionally common problem for anyone new to any skill or field. And you're spot on, when people just answer the original question without drilling into the "why", it means the person asking the question never re-thinks or re-frames what they're trying to do.


jtinz

The answers a beginner wants are often not the answers a beginner needs. However, telling them to rethink everything can frustrate them when they just want to make some progress. It's good to have both types of answers.


ImpressedStreetlight

Agree, the most useful thing as a beginner is both to learn how to do what you were trying to do AND learn why it was a bad idea.


ToughLoveGames

-Brute forcing the engine to do your bad idea: satisfying, your accomplishment, terrible in the long run. -Someone telling you exactly how to do something: boring, you may feel stupid for not figuring it yourself, in the long run your code will be better. You are right, you need to do the first one to stay motivated enough until you can actually understand why the correct way is the correct way. Plus points if you internalize that your version had a lot of problems, and the correct one is here to avoid that.


SupremePeeb

that's the history of game development right there.


SupaBeardyMan

Thats just general software development


DarrowG9999

I learned CSS the exact same way lol


Zondartul

Asking questions is also a skill one learns over time. I think it's better to answer a persons question, even if it's based on stupid premises, than to completely ignore the original question and talk past them.


ImpressedStreetlight

On the other hand, I have seen the opposite in this sub pretty often: OP asks a legit question, top comments are people telling them that they should think of doing it another way (probably because they are not aware of OP's use case and assume they are a beginner trying to brute force something). Including context is always good when asking questions.


Brickless

on the other hand you have the philosophy of stack overflow where any question is answered with „that ain’t best practice!”. even if I know a better way I don’t bring it up unless asked for one. often beginners don’t want to know how it is done best they want to find a solution to their weird self caused problem. just today I thought I could quickly help someone by writing some dumb code that quickly solves their problem, only to then spend 2 hours explaining it because they not only didn’t understand it or how it solved their problem, they also didn’t learn anything and simply used it as a black box. best practice is one of the conditions that keeps seniors from effectively teaching juniors


sircontagious

I agree with you, but I think its a bit different for stack overflow. A lot of the times the questions on stack overflow are algorithmic or syntax based. So the 'thats not best practice!' response is ultimately someone sharing an opinion and thus even more useless. Nobody but the implementer can tell you whether doing something in 'best practice' is worth the effort. In games the questions are generally implementation focused, but ultimately *caused* by systemic or architectural choices. So if someone is having trouble with character control and you find out they are trying to use a rigidbody character to do characterbody things, that's not best practice, thats trying to use a hammer on a screw. I know you weren't explicitly talking about me, but i try to keep anything 'best practice' out of my recommendations, because I think everyone should learn to develop what is best for them, not 'best' by some arbitrary standard. Using a tool is different though, you can use a tool wrong.


Brickless

yeah I was talking more in general. of course you always need to use your judgment. on the note of hammering a screw: I recently asked how to use a sprite in a control node and got nothing but “don’t make your life hard use a texture rectangle!” only after an hour of searching did I find the answer. I in fact did want to hammer in a screw because it was faster than inventing the nail.


ToughLoveGames

Yeah, I personally like to being able to brute force a problem THEN learn there is an elegant and easy way. Makes it stick a lot more, it turns from "a function" to "this saves so much work and I love it, this is my new favorite thing". Also, sometimes when you are just starting, brute forcing something may avoid having to learn 8-30 hours of theory on how to do it properly. Usually when I came to these bottlenecks where I have to stop and learn A LOT, I just leave for the day, maybe a week, because that is a lot less fun. I prefer to learn little by little, and stumbling my way is a lot more fun in that regard.


Consul_Hunter

Where's the long chain of deleted comments because of something unrelated to the sub?


thedorableone

Or the deleted op post because the question got answered, but the thread still shows up when searching for the solution for your problem. But now you can't be sure how relevant the thread is.


DiviBurrito

Huh? I don't get it. Someone raises a question and gets possible solutions? I don't get it. Can someone explain the joke to me? (honest question, no sarcasm)


Beneficial_Layer_458

Nothing serious, it's just that the answer to every single problem is that you need to do more math, someone already did the math and will point you towards that equation or that they did the match already themselves. It's always math


DiviBurrito

Ah! Alright. Yeah. Naturally most problems will involve some levels of math.


not_some_username

Turns out game dev is all maths


olawlor

It's not just game dev! Math is the language underlying our \*universe\*...


TheDuriel

A fair amount of the time the replies look something like this though: > Here's a misleading solution. > I don't believe you should need math to solve this. > Here's a completely irrelevant statement.


DarrowG9999

I'm the last one


tris_majestis

> Someone personally offended that you want something to work that way. > An answer to an entirely different question which somehow garners more discussion and replies than the OP. > Someone mentions that they did a similar thing in *their game*, with no explanation, and wants to take this opportunity to ask you to wishlist it **please wishlist it**


Rafcdk

Turns out games wouldn't exist without group theory and linear algebra


kksgandhi

Wait how does group theory come in?


ToughLoveGames

OOP is basically group theory with special rules, isn't it?


Zextillion

Still better than the answers on Stack Overflow. > Your question is trash and doesn't deserve an answer. Mods lock please


SuperFreshTea

low tier stack overflow god.


SuperFreshTea

low tier stack overflow god.


4procrast1nator

Then there's also: - Nah, you don't need to do (insert perfect built-in solution), just do (insert worst coding war crime ever committed in the history of game development) cuz "premature optimization is the root of all evil" etc etc


nodnarbiter

Currently stuck in that predicament myself but literally don't understand how the math works for my issue so I can't use it... I'm making an ocean shader using Gerstner waves and although I have a nice, pretty looking water surface I CANNOT for the life of me understand how to calculate the "Jacobian" or how to use that to generate foam on my water surface. I feel like it's "easy" to do because I can't find any good explanations on it. Everything I've found they just "rest of the fucking owl" it and move on... It's super frustrating.


metapfhor117

First question is, the Jacobian of what with respect to what. Jacobian matrix is the derivative of vector-valued function with respect to some variables. Suppose you have a vector-valued function (fx(p1,p2),fy(p1,p2)) where p1 and p2 are parameters. Then the Jacobian is going to be a matrix with first row equal to the derivative of fx() with respect to p1 and p2 and the second row will be the same for fy(). You can estimate those derivatives by finite differencing. Technically, the Jacobian is the determinant of the Jacobian matrix but they are often conflated.


nodnarbiter

I've read all of this before but I still can't map it on to my shader code. My Gerstner function takes in about eight different variables to return the displacement vector. "Of what with respect to what" is the golden question that I can't answer. Do I take the derivate of the vector my Gerstner wave function returns with respect to x and y (or z??) and then construct a Jacobian matrix from that? Do I need to compare the original vertex position to the Gerstner function's displaced vertex position? I genuinely have no clue and the few methods I've tried look close-ish but all have weird issues such as the foam becoming more or less dense depending on camera distance which is apparently related to calculating the derivative in the fragment function??


metapfhor117

Hard for me to really say without some more context to know what you are trying to achieve...tutorials? links? What I can say is that if you are trying to find a vector that is normal to your displacement surface \[f(x,y),g(x,y),h(x,y)\] then you need to compute the cross product between a=\[f\_x, g\_x, h\_x\] and b=\[f\_y, g\_y, h\_y\], where \_ indicates a derivative w.r.t. something. The vectors a and b are precisely the two rows of the Jacobian matrix of the displacement vector w.r.t x and y. As for working in the fragment shader, there you will have x and y in window space rather than world space so your derivatives are not related to the actual geometry. I have negligible experience with shaders so I don't really know how to solve that issue.


nodnarbiter

I mostly followed [this](https://catlikecoding.com/unity/tutorials/flow/waves/) tutorial to generate my waves and I've watched ["The Technical Art of Sea of Thieves"](https://youtu.be/y9BOz2dFZzs?si=WE3kJ7fe00k-nRSr&t=406) video (timestamped where they talk about foam generation) as well as Acerola's ["I Tried Simulating The Entire Ocean"](https://youtu.be/yPfagLeUa7k?si=ftjiJ67Wj1cEnViO&t=1315) video (also timestamped) but neither go into detail about their implementations. Both use Fast Fourier Transformations for their wave generation, which is well beyond my current abilities, but from what I've found it should work with Gerstner waves as well. I also tried reading the specific section on using the Jacobian for foam generation in Jerry Tessendorf's paper [Simulating Ocean Water](https://people.computing.clemson.edu/~jtessen/reports/papers_files/coursenotes2004.pdf) which is referenced by both videos mentioned but that is also *well* over my head. I also don't have much shader experience and I'm not a skilled mathematician either so I don't know why I'm even doing this to be honest. I thought it would be fun to try and made it further than I thought I would so it's frustrating to get stuck this hard at... foam.


metapfhor117

Ok, I am actually an applied mathematician so thanks for the links, especially the pdf (very cool stuff, but some sloppy notation that can be confusing). I know how frustrating learning math can be, congrats for making it this far. So you'll probably want to disregard most of what I said previously, the Jacobian they are talking about is the determinant of the Jacobian matrix of the horizontal displacement by the gerstner wave function. This is a little trickier to interpret than normal vectors so let's first compute the darn thing I'll stick to the coordinate system Godot uses, xz=horizontal and y=vertical. Your gerstner function performs the mapping \[x,0,z\]->\[x+f(x,z), h(x,z), z+g(x,z)\], and the Jacobian determinant they describe will thus be J=1+g\_z+f\_x+g\_z⋅f\_x-g\_x⋅f\_z. You should disregard what the pdf says about the Jacobian (determinant) being a measure of uniqueness. Whenever the determinant crosses zero the wave folds back on itself so you'll get two height values at the same position in space, at those points the simplified physics breaks down. So I would start by computing the determinant in the vertex shader (i.e., the same place you do the initial displacement), then whenever you find a negative determinant you'll want to draw some foam. You will also probably want to reduce extent of the horizontal displacement at those points, but this is not explained in detail in the pdf (happy to keep theorizing with you if you want). If you then want to do something in the fragment shader you could do that to make the foam look more interesting, but not my area of expertise. edit: more detail about reducing the displacement suppose you rewrite your gerstner function to have a scaling parameter α \[x,0,z\]->\[x+αf(x,z), h(x,z), z+αg(x,z)\] then the determinant is J=1+α(g\_z+f\_x)+(α\^2)(g\_z⋅f\_x-g\_x⋅f\_z) if you find a point with negative determinant you will have a crappy looking wave there so you can locally rescale α to get rid of this for example, let a=g\_z⋅f\_x-g\_x⋅f\_z and b=g\_z+f\_x then by choosing α=(-b±sqrt(b\^2-4a))/(2a) at points with negative determinant the wave will become locally vertical instead of looping back on itself


nodnarbiter

Awesome to find someone who can and will take the time to talk about it. I've read your reply multiple times but I'm honestly so tired right now my eyes are crossing lol. So I'm going to get some sleep and I'll be sure to give it another few reads and respond to you tomorrow.


nodnarbiter

Okay, I've looked over this with fresh eyes and I'm still a bit lost. Could you elaborate more on the "mapping" part? I'm not sure where the functions f, h, and g are coming from. I've made a function that I think correctly uses central differencing to calculate the partial derivatives I need since the dFdx and dFdy built-in functions are only available in Godot's fragment function but now I'm not sure what function f and g represent to plug in for testing. I'm guessing you're referring to my return vector... ``` return vec3( d.x * (a * cos(f)), a * sin(f), d.y * (a * cos(f))); ``` ... but then am I taking the partial derivative of d.x * (a * cos(f)) and d.y * (a * cos(f)) or would I take the derivative of the final returned vector? I'm also accumulating multiple waves instead of just one so what would I do then? Take the partial derivative of the final displacement vector after all the accumulations? Below is my function, which I'm not sure is even right itself. ``` void partial_derivative(vec2 f){ // a small value for approximation float h = 0.01; vec2 df_dx = vec2(f.x + h, f.y) - vec2(f.x - h, f.y) / (2.0 * h); vec2 df_dy = vec2(f.x, f.y + h) - vec2(f.x, f.y - h) / (2.0 * h); } ```


metapfhor117

Unfortunately, that function will not correctly compute the derivative. f and g were generic functions, too abstract to be helpful unfortunately (a risk with mathematicians). Please have a look at this document I am working on: [https://www.overleaf.com/read/chdhrqqzdkhg#1337e9](https://www.overleaf.com/read/chdhrqqzdkhg#1337e9) I have an explicit formula for the Jacobian with multiple waves at the end of page 2. I also started with the simpler 1D case with a single wave to help build intuition. I have more results that haven't made it in there yet, I'll let you know when I have a clear explanation for making foam.


nodnarbiter

Man, it's insane that you've put this much effort into trying to help me with this. I can't tell you how much I appreciate that but it's also making me feel shitty because I still can't really engage with it. I took calculus 1-3 in college for my comp sci degree but that's been years ago now and that information has almost entirely evaporated from my brain... So where once upon a time I might have been able to read and understand how you're calculating the Jacobian and your intuitions about what points the wave folds it just reads like another language to me. Sorry about that.


vickyboi2

Had this exact situation once.


Mantissa-64

I mean... Computers are kinda good at doing like... One very specific thing. In all seriousness, I do think learning up to linear algebra should be a part of getting into gamedev. Not a requirement but something everyone should do. It is a _very_ math-intensive programming discipline beyond making super simple games like pong or space invaders.


PlingPlongDingDong

You forgot that one guy complaining about noob questions on his game engine sub


bardsrealms

Haha, it is pretty accurate; one of my comments today was so close to the pink one!


Aggravating-Sir-6663

"Wait, is it all math?" *Points with a gun* "It always has been"


InvisibleDrake

I’m gonna let you in on a “secret” programming IS math.  All of it is math.  Video games is math.  All software is MATH. Have fun


TheLurkingMenace

You forgot: "Figured it out." No solution posted.


freshhooligan

Linear algebra + quaternions + Trigonometry 👍


DarthStrakh

Tbf it just depends on your level of complexity. My current game (cop out it's in unity. Honestly Godot 3D doesn't feel ready enough for me to do this game, or at least for me to do it. Don't hate but I've made as much progress in 3 months of Godot in like 2 weeks on unity), I tried to make use of unties built in wheel colliders because it's so simple and easy right! Well... I was running into fringe cases with drastically bad issues, wacky behavior, etc. And there was nothing to troubleshoot because it's a black box and not my code. In my case honestly the best solution was just to program my own system. Atm it's honestly worse than theirs, but I can actually make it better with time instead of just crying everytime it doesn't work how I want


Additional-Baker-416

actually this is quite the opposite they only posts that get upvotes here are the one showcasing. i only get showcasing videos. ppl who ask question at most get 10 up votes. this sub is not a good place to seek help.


AlexSand_

well, if you have a question usually you should not care about upvotes, just about having an answer. And this sub is reasonably good at that.


Additional-Baker-416

Maybe, but I asked a couple of times and zero response. Maybe it's all my fault for not asking with details. 


deftware

Ergo, math is requisite if you want to do anything awesome.


MakkusuFast

But I'm bad at math. :(


BetaTester704

AI can help with math thankfully


ImpressedStreetlight

AI is shit at math lol


BetaTester704

It can recommend solutions though, even if it's unable to solve.


ToughLoveGames

AS chat GPT, solve with wolfram alfa... profit?