Relative Simulator banner

Relative Simulator

5 devlogs
18h 21m 23s

gravitational simulation program

sbalaji07

i’ve added working commands that also output to the terminal. i decided to just create an accesible ship struct that i’m editing within different files. it seemed to be easier than the more proper solution, which would probably be to create a function that changes the speed and use that wherever i need it, but oh well. and right now i’ve just got a terrible if chain to register the commands, though i think the way i parse it is pretty rad if i say so myself. the if chain just won’t do however, and i am absolutely just going to have to find a better way.

Attachment
0
sbalaji07

good day, i am back, having successfully fixed one rendering bug and spending the rest of my time writing a terminal, for what is supposed to be a physics simulator. i decided (for some reason) it should have a full terminal, within the simulation, so i’m just simulating a rudimentary terminal.

i won’t lie though i’m quite proud of the terminal i think its rather good if i say so myself. oh and i changed the font also so it isn’t an squarish eyesore. the terminal works with another camera instance because i finally learned what they even are, but this isn’t a cameras are my hammers so all problems are nails i promise, i stole this technique (among others) from the raylib example scripts.

Attachment
0
sbalaji07

hello all, turns out that whole grid structure i made is a bit useless and makes everything more complicated so i just got rid of it and started drawing lines. is this what they wanted? this is what they have done.

the ship itself is me drawing two triangles, so the idea that it is one inclusive entity is a lie, just a trick of the cameras, edited in post, if you will. i’m almost certain the problem with the rendering is to do with converting between world coordinates and screen coordinates, but i just can’t prove it. because i don’t know how world coordinates work. i’ve been putting off learning the camera2D function for a while, which is partly responsible for the lack of progress, but im going to have to do it eventually so it may as well be now (or maybe in an hour or two, although at that point i might as well call it tomorrow, or the day after).

Attachment
0
sbalaji07

I wanted a system to be able to work with regular coordinates, since like usual raylib renders taking the top left as (0,0). for that reason I’ve made a grid struct which I can use as regular coordinates, and simply use the stored values to convert back when I’m wanting to render anything.

I’ve also added a box for where the terminal will be. All tools should be accessible via commands, and this will be the panel with which anything in the simulation can be configured.

I spent a while going through some of the basics I’ll need to implement what will follow, and I’ll include an overview below for my own edification and also in case I ever return to look over it.

Firstly, some basic linear algebra to confirm that pythag holds up only in a perfectly euclidean space, and if any non-orthogonal base units are introduced, we get the wrong answers. The real way to calculate distances without fail is by taking the square root of the dot product of a vector with itself, which I’ve proved below since I hadn’t encountered it before. This forms the basis of the justification behind the metric tensor, which defines the curvature of spacetime by simply presenting a formula with which we can calculate the distances between points (in space and time). Currently just focusing on the Minkowski Metric, the values in the lead diagonal which correspond to the spatial dimensions are simply all set to one, which makes sense since it describes the curvature without any gravity, that is, no curvature at all.

What follows is a recap of the lorentz factor, which I’ve found is easier to understand if the photon clock thought experiment is used to derive time dilation. However, it isn’t exactly mathematically rigorous to go backwards to the original transformations, but oh well, it does the job for what I need. The inverse transformations in particular is the first step towards the spacetime interval.

Attachment
Attachment
Attachment
Attachment
0
sbalaji07

basic raylib grid (matrix transformations already??)

Attachment
0