Activity

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

this project was supposed to be something else entirely, however I think where it ended up is okay for now. I have a lot of other constructions that I never got to add into the sandbox system however I suppose they’re just waiting to be utilised. if you want to try this project, mo’ gears mo’ fun, as they say, i’ve added up to 32 (i already had to make changes to my emscripten compile to get that working). i hope someone gets something out of this anyway, because i still think it looks quite cool. the original video from which i made this gif goes on a lot longer by the way, like fine wine, these constructions only get better with time.

Attachment
0
sbalaji07

oh by the gods this is enough, please tell me that you agree that this is enough. i never got around to getting plugboard functionality but i’ll have to do that soon (some day). the wiring actually works now, as you can see by where it gets output. this was a pretty fun project, and my code is a genuine abomination, but this was a pretty fun project.

Attachment
0
sbalaji07

i said i would do it. i did say i would do it. did they listen? did they harken to my words? i dont know, i dont know anymore, maybe you should ask them, maybe they have what you want. the visuals are a little barebones however it’s something, and i think it looks cool. i’m still figuring out the exact wiring, it doesn’t actually correspond correctly yet, however the outputs do work in the terminal,
which is in fact what i’m using to sanity check each step. the code for those wires is a genuine atrocity. a bete noire if you will. but oh well, if it works it works (it doesn’t work right now though)

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

Hello friends, I will admit I slightly lost the plot trying to pursue the excessively complex constructions. They don’t even fit into what I wanted this to be because they’re far too lengthy to reasonably fit cleanly into a short animation period.

I decided to pivot and start working on the actual gear mechanism, and then figure things out from there. I’ve now been on the figure things out stage for quite some time and I think I’m starting to lose the will.

For now, we’re sticking simple with a test of the gear system by just drawing a circle. I spent an hour searching for why it wouldn’t work before spotting I forgot to type the word ‘break’, and so I made up for it by breaking my keyboard into small pieces, all the easier to type with, as grandma says.

I’m pretty sure the answers will come to me naturally as long as I search within myself, or maybe that wasn’t the moral of the third and final kung fu panda movie, I really don’t know anymore just watch the circle get drawn okay?

Attachment
0
sbalaji07

huge updates my avid viewers (there was one comment on the last post so this is a milestone). to begin with i remade the colour system to be able to change the colours for all constructions since inputting values for each construction became a headache very quickly. that isn’t to say that the headache is gone however, because it remains.

i have made a serious and continuous lapse in my judgement and I don’t expect it to ever be resolved, because my modular design to input only points into each of these constructions has made it an absolute pain to accurately tell which point is what, because each point becomes renamed relative to the construction it is immediately a part of. it also means that tracking which lines to draw, which lines to fade, which lines shouldn’t even exist, all becomes like a twenty mile hike without boots up a mountain of legos.

anyway i’ve gotten equal angle constructions working, so that’s neat. and as i spoiled earlier i’ve added a fade function, which may be even worse since its basically a guessing game what is and isn’t going to disappear, however it has resulted in Massive improvements to the visuals of the equal angle construction (it was so much worse before)

Attachment
0
sbalaji07

added angle bisection. i’ve been quite carelessly balling with the trigonometry and somehow it continues to work, in truth there is a fair chance that the moment i try some of these constructions on different points the entire thing combusts, but that is a risk i am willing to take.

i edited the equilateral construction to include a parameter that configures the direction of the triangle (given a point it should be facing away from). this is because as can be seen, there are always two potential triangles that can be formed, and aesthetically, in cases such as in this angle bisection, it is far cleaner if the triangle is facing away from the point we are bisecting. its a bit of a pain to include a random vector if a particular direction is unnecessary, however for now this solution seems to work, and the design of the bisection is worth the extra input.

Attachment
3

Comments

hack.clubber
hack.clubber 3 months ago

Nice project, really unique as well BUT when I tried compiling it started downloading a large file from raylib. I don’t if you know but to use raylib you only need to download 12mb or something like that.
Would be better if you Updated your CMakeLists to only download what’s needed.

sbalaji07
sbalaji07 3 months ago

oh right, thanks, i’ll check out if i can make it simpler.

sbalaji07
sbalaji07 3 months ago

okay so i took a look at where i got the cmake file template from, and it seems it’s downloading the master branch from source since its ‘easier than including prebuilt binaries for every platform and configuration’.

i think its more important for anyone to be able to run the program without hassle than for a smaller download, but if there’s some obviously easier way to compile then i’ll certainly change it

sbalaji07

added equal line construction. this required rethinking the phase system since I needed constructions to begin one after the other. the best way seemed to be to move the update function for each subsidiary construction into its own phase within the update loop and simply check for completion there.

i also standardised the progress to be from 0 to 1, meaning all construction meaning all phases of each construction will take the same amount of time, it may be worthwhile looking to configure custom speeds for each since the vectorLerp i’m using seems sedated.

i then had the problem of hiding certain lines that were being drawn within my constituent constructions. i was thinking about ways of controlling the hidden and shown segments, but wanted it controlled via a single parameter, so i opted for a bitmask which i can configure within my update function.

Attachment
0
sbalaji07

fixed enigma machine, should have working cli operation. switched characters to being 0 index to fix the issue with the mod.

also planned out the graphical layout and started rendering the keyboard.

Attachment
Attachment
0
sbalaji07

added reverse rotor functionality, this is getting trippy. the reverse enciphering is definitely broken since it may output a negative number if the wheel rotates too much but I’ll just have to fix that later. for the most part, or rather, for at least a couple inputs (I’ve only tested a couple) it seems to be working correctly

Attachment
0
sbalaji07

separated modular functions into individual files and switched to the three rotors of Enigma I. now utilising an initialiser function to install all three rotors, allowing for changes in the ordering.

one key concept that took some time to understand is that the wiring of each rotor was exclusively within itself. That means, when a rotor rotates, functionally, the input is shifted by one, the mappings themselves never change, as is often easy to visualise. the implication this returns when simulating a compartmentalised process is that both inputs and outputs have to be shifted in accordance with rotation. a rotor shifted one place takes the input ‘A’ into the ‘B’ wiring, and the ‘B’ connection is what is activated on the other side of the rotor. Significantly, if ‘B’ corresponds to a ‘D’, then the next rotor does NOT receive an input of ‘D’, but rather an input of ‘C’, since the first rotor has been shifted by one position.

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

cleaned up the perpendicular bisector a little more by using a separate function to draw the final line itself. also, added equilateral triangle construction, the repertoire grows

Attachment
0
sbalaji07

cleaned up the heretical bisector construction code. turns out I was actually right the first time and my ultimate solution was just to employ the use of switch cases but cycling through phases of construction with an enum.

it also turns out that raylib has a function to draw arcs in particular, so my incredible method for manually drawing them with hundreds of lines was unnecessary (i’m so glad that function was in a separate section of the docs, and i’m also so glad that it takes degrees rather than radians like everything else for some reason)

Attachment
0
sbalaji07

basic raylib grid (matrix transformations already??)

Attachment
0
sbalaji07

fully animated the perpendicular bisector construction, just please don’t ask how. though, the basic idea was just to split up the total construction progress into each half arc and cycle through the necessary drawings, allowing me to configure each stretch individually. that being said, this may just be the worst possible implementation possible, and I will have to return and fix the yandere sim excerpts (please don’t look at the code)

Attachment
0
sbalaji07

employed the previously created circle construction method to draw bisectors. the arcs are purely for visual purposes however, the coordinates bisector itself is drawn through some amount of trigonometric shenanigans.

Attachment
Attachment
0
sbalaji07

Created a system to construct basic circles using raylib

Attachment
0