Relative Simulator banner

Relative Simulator

9 devlogs
56h 6m 49s

special relativity simulation program

Demo Repository

Loading README...

sbalaji07

Shipped this project!

Hours: 56.11
Cookies: 🍪 1310
Multiplier: 23.34 cookies/hr

I made a special relativity simulator, and it almost killed me. i’m proud of the fact that i think it looks quite good. i’m sorry, i have 10 minutes until flavourtown ends, please read the last devlog for more incoherent digressions

sbalaji07

i’ve had to wrap up this project here because of time, but I want you to know I didn’t give up until it became physically impossible for me to add some of the other features i wanted (flavourtown ends in 15 minutes as I write). For this addition I only got up and down arrow key functionality to copy previous commands, making the dial knobs actually turn, a help command and really cleaning up the terrible pulse code. I did I had big plans for this project (and all my others), great expectations, if you will (call me pip because I blew it). I never got to the real meat of what I was trying to simulate, that being the gravity itself, so thats a shame (in my opinion its all because of my adhd and obviously not my fault), but if anyone likes time dilation (no not like from interstellar this is different) then this might be cool I guess. I’ll come back to this project later, even if there are no cookies to earn, for love of the game, as they say. I’m not sure if you can tell but i’m actually being serious in a devlog for once, i’m really quite disappointed i didn’t finish my projects in time, especially after my copious spreadsheets which seemed to indicate that it would be done with a trivial couple hours a day (turns out that’s impossible), there was that time i had a brief stint getting banned for being 19, but that doesn’t really hold up as an excuse since it wasn’t long. Oh well, maybe the real quest 3 was the friends we made along the way (there was a guy who made a comment on one of my other posts once (i didn’t get a reply though (i have clearly lost it)))

guys i can’t do this anymore, not like this. i’m so exhausted. it’s half five am and i’ve been working on these projects from morning past midnight for the past three days. the sky is bright, I hear the bird chirping. sometimes it feels like no matter how much time i have, and how much i plan things out, i always end up having to do things like this just to scrape by. the real hard work i do then feels overshadowed by the constant pressure that i’m simply trying to make up for my failures, and the knowledge that it’s my own fault that i’m in this entirely voluntary situation is only something that makes it more ridiculous. i mean, i chose to do this, i could have just given up a while ago, no one cares lol, but something just doesn’t let me stop when i’ve come so far already, even if i don’t reach my goal. i just have to know that i really tried. the revolving door doesn’t slow down just because you’ve stumbled, but while others walk out to the other side, i sometimes feels like i’m just walking around and around, always trying to get back on my feet. sometimes the most damaging failure can be the failure to move on, and i feel i can convince anyone that i’m fine except for myself. the only reason i keep going is because i remember what it is i’m doing. to me, it’s art, in my own way. i don’t know whether or not i’m good enough for any standard, let alone my own, and i vacillate aggressively between thinking my work is a masterpiece and garbage. i don’t know whether or not i should have tried to work harder for a dumb programming project i said i’d do for fun, or if i shouldn’t make these severely rambling devlogs that have little to do with the actual development itself. but deep down i do understand that it doesn’t have to be perfect, it doesn’t have to get the most cookies. it just has to be what it already is, something i made. something i dreamt of, something i saw in my head. it’s something i typed out and turned into reality, and at the end of the day, to me, i suppose everything else is just relative.

Attachment
0
sbalaji07

guess who’s back. you thought i quit? you thought i gave up? YOU WERE WRONG. YOU WERE WRONG. I WILL NOT. I WILL NOT (not, not, not). anyway i made an oscilloscope with the dire situation adhd spike that hit me and guys i just cooked. i’m not one to excessively pat myself on the back but lets face it i clearly cooked. chat, where’s my streamy. who’s got my streamy. i’ve spent so long programming today i’m almost certain i’m starting to lose it. my oscilloscope (it’s not oscilliscope by the way, i had to do multiple ctrl + h’s because i can’t remember how to spell) has deployable sources too, but i forgot to show that in the gif and i’m not making again, just look at the repo okay i mean why do you even care. why would i lie to you here? what do i have to gain? this is a open source project, you’re not going to scan my commits and no one is watching live so i essentially have the ability to just lie about features i haven’t added but would i really do that? there is no-one is here, i’m talking to the void right now, i’d just be lying to myself. do i strike you as the type to do something like that? i’m actually not lying right now though i seriously added the ability to deploy sources right at the beginning it was just one function and two lines its not even worth lying about i promise. oh ok so the whole configuration panel is just about being able to change what frequency the source emits at, however the whole point is that its a physics sim so you actually have to wait for your instruction dispatch to reach the source, and then for the updated signal to reach you, that’s what all that is showing. of course, it also takes into account the relativistic effects, which is why it looked like the frequency slowed down when we accelerated to near light speed, that my friend is doppler but with electromagnetic radiation (you may know it from the neom sound a car makes when it goes past)

Attachment
0
sbalaji07

hello everynyan, updates today include a minor dabbling in the actual relative aspect of this so called, simulator. it’s still sticking to special relativity though fairly simple. i’ve added a vector visual with random scaling to see acceleration and velocity, along with three bar displays that show your speed as a fraction of c, the lorentz factor as calculated from absolute rest (absolute rest exists in this program because i am the almighty creator) and the effect of length contraction as shown by the contracting rectangle.

there’s also the stopwatch which shows the effects of time dilation, visualising the increased rate of time you would observe a stationary reference frame to experience having accelerated relative to it.

Attachment
0
sbalaji07

i’ve heisted a lookup table method to register my commands, and its pretty neat if you ask me. i don’t know if this is once again another lookup tables are my hammer so everything is a nail or what but i also used it to catalogue toggleable items in this new info panel i’ve created. i do however swear to god the slightest addition requires half an hour of scouring forums and just scribbling things down to figure out what the hell is going on in c, because i have no idea. you would not believe the process i had to go through in order to get vector quantities to display on the side panel. there’s also that nice up arrow to get last command that i hastily added in a super simple way (i’m just grabbing whatever was in history two elements back) for my own convenience, but i’ll have to make that properly later.

Attachment
0
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 comprehensive entity is a lie, in case you thought that, 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 we may 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